24 if ( p1 && p2 && p3 && result )
27 double area =
triArea( p1, p2, p3 );
32 double area1 =
triArea( &p, p2, p3 );
33 double area2 =
triArea( p1, &p, p3 );
34 double area3 =
triArea( p1, p2, &p );
35 double u = area1 / area;
36 double v = area2 / area;
37 double w = area3 / area;
45 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
55 if ( p1 && p2 && p3 && result )
57 double area =
triArea( p1, p2, p3 );
61 QgsDebugMsg( QStringLiteral(
"warning, p1, p2 and p3 are in a line" ) );
65 double denominator = ( ( p2->
y() - p3->
y() ) * ( p1->
x() - p3->
x() ) - ( p3->
y() - p1->
y() ) * ( p3->
x() - p2->
x() ) );
66 if ( denominator != 0 )
68 px = ( 2 * u * area * ( p1->
x() - p3->
x() ) - 2 * v * area * ( p3->
x() - p2->
x() ) - p2->
x() * p3->
y() * ( p1->
x() - p3->
x() ) + p3->
x() * p1->
y() * ( p3->
x() - p2->
x() ) + p3->
x() * p2->
y() * ( p1->
x() - p3->
x() ) - p1->
x() * p3->
y() * ( p3->
x() - p2->
x() ) ) / denominator;
69 if ( ( p3->
x() - p2->
x() ) != 0 )
71 py = ( 2 * u * area - px * ( p2->
y() - p3->
y() ) - p2->
x() * p3->
y() + p3->
x() * p2->
y() ) / ( p3->
x() - p2->
x() );
75 py = ( 2 * v * area - px * ( p3->
y() - p1->
y() ) - p3->
x() * p1->
y() + p1->
x() * p3->
y() ) / ( p1->
x() - p3->
x() );
80 py = ( 2 * u * area * ( p3->
y() - p1->
y() ) - 2 * v * area * ( p2->
y() - p3->
y() ) - p2->
x() * p3->
y() * ( p3->
y() - p1->
y() ) + p3->
x() * p1->
y() * ( p2->
y() - p3->
y() ) + p3->
x() * p2->
y() * ( p3->
y() - p1->
y() ) - p1->
x() * p3->
y() * ( p2->
y() - p3->
y() ) ) / ( ( p3->
x() - p2->
x() ) * ( p3->
y() - p1->
y() ) - ( p1->
x() - p3->
x() ) * ( p2->
y() - p3->
y() ) );
81 if ( ( p2->
y() - p3->
y() ) != 0 )
83 px = ( 2 * u * area - py * ( p3->
x() - p2->
x() ) - p2->
x() * p3->
y() + p3->
x() * p2->
y() ) / ( p2->
y() - p3->
y() );
87 px = ( 2 * v * area - py * ( p1->
x() - p3->
x() ) - p3->
x() * p1->
y() + p1->
x() * p3->
y() ) / ( p3->
y() - p1->
y() );
96 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
108 return lower( n, i ) * std::pow( t, i ) * std::pow( ( 1 - t ), ( n - i ) );
118 if ( p1 && p2 && p3 && result )
120 double distp1p2 = std::sqrt( ( p1->
x() - p2->
x() ) * ( p1->
x() - p2->
x() ) + ( p1->
y() - p2->
y() ) * ( p1->
y() - p2->
y() ) );
121 double distp2p3 = std::sqrt( ( p2->
x() - p3->
x() ) * ( p2->
x() - p3->
x() ) + ( p2->
y() - p3->
y() ) * ( p2->
y() - p3->
y() ) );
122 if ( distp1p2 > distp2p3 )
129 double denominator = -p3->
x() * p2->
y() + p3->
x() * p1->
y() + p1->
x() * p2->
y() + p2->
x() * p3->
y() - p2->
x() * p1->
y() - p1->
x() * p3->
y();
131 if ( denominator == 0 )
133 QgsDebugMsg( QStringLiteral(
"error: the three points are in a line" ) );
138 result->
setX( 0.5 * ( p1->
x()*p1->
x()*p2->
y() - p1->
x()*p1->
x()*p3->
y() - p3->
x()*p3->
x()*p2->
y() - p1->
y()*p2->
x()*p2->
x() - p1->
y()*p1->
y()*p3->
y() - p3->
y()*p3->
y()*p2->
y() + p1->
y()*p1->
y()*p2->
y() + p3->
y()*p2->
x()*p2->
x() - p1->
y()*p2->
y()*p2->
y() + p1->
y()*p3->
y()*p3->
y() + p1->
y()*p3->
x()*p3->
x() + p3->
y()*p2->
y()*p2->
y() ) / denominator );
139 result->
setY( -0.5 * ( p3->
x()*p2->
x()*p2->
x() + p2->
x()*p1->
y()*p1->
y() + p3->
x()*p2->
y()*p2->
y() - p3->
x()*p1->
x()*p1->
x() + p1->
x()*p3->
y()*p3->
y() - p3->
x()*p1->
y()*p1->
y() - p1->
x()*p2->
x()*p2->
x() - p2->
x()*p3->
y()*p3->
y() - p1->
x()*p2->
y()*p2->
y() - p2->
x()*p3->
x()*p3->
x() + p1->
x()*p3->
x()*p3->
x() + p2->
x()*p1->
x()*p1->
x() ) / denominator );
143 double dist1 = std::sqrt( ( p1->getX() - result->getX() ) * ( p1->getX() - result->getX() ) + ( p1->getY() - result->getY() ) * ( p1->getY() - result->getY() ) );
144 double dist2 = std::sqrt( ( p2->getX() - result->getX() ) * ( p2->getX() - result->getX() ) + ( p2->getY() - result->getY() ) * ( p2->getY() - result->getY() ) );
145 double dist3 = std::sqrt( ( p3->getX() - result->getX() ) * ( p3->getX() - result->getX() ) + ( p3->getY() - result->getY() ) * ( p3->getY() - result->getY() ) );
147 if ( dist1 - dist2 > 1 || dist2 - dist1 > 1 || dist1 - dist3 > 1 || dist3 - dist1 > 1 )
158 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
166 if ( p1 && p2 && p3 && result )
168 QgsPoint midpoint12( ( p1->getX() + p2->getX() ) / 2, ( p1->getY() + p2->getY() ) / 2, 0 );
169 QgsPoint midpoint23( ( p2->getX() + p3->getX() ) / 2, ( p2->getY() + p3->getY() ) / 2, 0 );
170 Vector3D v12( p2->getX() - p1->getX(), p2->getY() - p1->getY(), 0 );
171 Vector3D v23( p3->getX() - p2->getX(), p3->getY() - p2->getY(), 0 );
176 QgsPoint helppoint1( midpoint12.getX() + n12.getX(), midpoint12.getY() + n12.getY(), 0 );
177 QgsPoint helppoint2( midpoint23.getX() + n23.
getX(), midpoint23.getY() + n23.
getY(), 0 );
181 double dist1 = std::sqrt( ( p1->getX() - result->getX() ) * ( p1->getX() - result->getX() ) + ( p1->getY() - result->getY() ) * ( p1->getY() - result->getY() ) );
182 double dist2 = std::sqrt( ( p2->getX() - result->getX() ) * ( p2->getX() - result->getX() ) + ( p2->getY() - result->getY() ) * ( p2->getY() - result->getY() ) );
183 double dist3 = std::sqrt( ( p3->getX() - result->getX() ) * ( p3->getX() - result->getX() ) + ( p3->getY() - result->getY() ) * ( p3->getY() - result->getY() ) );
185 if ( dist1 - dist2 > 1 || dist2 - dist1 > 1 || dist1 - dist3 > 1 || dist3 - dist1 > 1 )
195 cout <<
"null pointer in method MathUtils::circumcenter" << endl << flush;
203 if ( thepoint && p1 && p2 )
206 Vector3D line( p2->
x() - p1->
x(), p2->
y() - p1->
y(), 0 );
208 double a = normal.
getX();
209 double b = normal.
getY();
210 double c = -( normal.
getX() * p2->
x() + normal.
getY() * p2->
y() );
211 double distance = std::fabs( ( a * thepoint->
x() + b * thepoint->
y() +
c ) / ( std::sqrt( a * a + b * b ) ) );
216 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
223 return std::tgamma( n + 1 );
228 double tolerance = 0.0001;
230 if ( testp && p1 && p2 && p3 )
238 double px = testp->
x();
239 double py = testp->
y();
241 double xmin = std::min( std::min( ax, px ), std::min( bx, cx ) );
242 double ymin = std::min( std::min( ay, py ), std::min( by, cy ) );
252 double aValue = ( ax * ax + ay * ay ) *
triArea( p2, p3, testp );
253 aValue = aValue - ( ( bx * bx + by * by ) *
triArea( p1, p3, testp ) );
254 aValue = aValue + ( ( cx * cx + cy * cy ) *
triArea( p1, p2, testp ) );
255 aValue = aValue - ( ( px * px + py * py ) *
triArea( p1, p2, p3 ) );
257 return aValue > tolerance;
261 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
268 return angle( p1, point, p2, point ) > 90;
274 if ( p1 && p2 && point )
276 Vector3D p1p2( p2->getX() - p1->getX(), p2->getY() - p1->getY(), 0 );
278 QgsPoint midpoint( ( p1->getX() + p2->getX() ) / 2, ( p1->getY() + p2->getY() ) / 2, 0 );
279 double radius = p1p2.getLength() / 2;
281 QgsPoint p3( midpoint.getX() + orthogonalvec.getX(), midpoint.getY() + orthogonalvec.getY(), 0 );
282 return inCircle( point, p1, p2, &p3 );
286 cout <<
"null pointer in MathUtils::inDiametral" << endl << flush;
297 double f1 = thepoint.
x() - p1->
x();
298 double f2 = p2->
y() - p1->
y();
299 double f3 = thepoint.
y() - p1->
y();
300 double f4 = p2->
x() - p1->
x();
301 return f1 * f2 - f3 * f4;
306 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
313 if ( p1 && p2 && p3 && p4 )
316 Vector3D p1p2( p2->
x() - p1->
x(), p2->
y() - p1->
y(), 0 );
317 Vector3D p3p4( p4->
x() - p3->
x(), p4->
y() - p3->
y(), 0 );
318 if ( ( p3p4.getX()*p1p2.getY() - p3p4.getY()*p1p2.getX() ) != 0 && p1p2.getX() != 0 )
320 t2 = ( p1->
x() * p1p2.getY() - p1->
y() * p1p2.getX() + p3->
y() * p1p2.getX() - p3->
x() * p1p2.getY() ) / ( p3p4.getX() * p1p2.getY() - p3p4.getY() * p1p2.getX() );
321 t1 = ( p3->
x() - p1->
x() + t2 * p3p4.getX() ) / p1p2.
getX();
323 else if ( ( p1p2.getX()*p3p4.getY() - p1p2.getY()*p3p4.getX() ) != 0 && p3p4.getX() != 0 )
325 t1 = ( p3->
x() * p3p4.getY() - p3->
y() * p3p4.getX() - p1->
x() * p3p4.getY() + p1->
y() * p3p4.getX() ) / ( p1p2.getX() * p3p4.getY() - p1p2.getY() * p3p4.getX() );
326 t2 = ( p1->
x() + t1 * p1p2.getX() - p3->
x() ) / p3p4.getX();
333 if ( t1 > 0 && t1 < 1 && t2 > 0 && t2 < 1 )
335 if ( ( *p1 ) == ( *p3 ) || ( *p1 ) == ( *p4 ) || ( *p2 ) == ( *p3 ) || ( *p2 ) == ( *p4 ) )
349 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
356 if ( p1 && p2 && p3 && p4 )
359 Vector3D p1p2( p2->
x() - p1->
x(), p2->
y() - p1->
y(), 0 );
360 Vector3D p3p4( p4->
x() - p3->
x(), p4->
y() - p3->
y(), 0 );
361 if ( ( p3p4.getX()*p1p2.getY() - p3p4.getY()*p1p2.getX() ) != 0 && p1p2.getX() != 0 )
363 t2 = ( p1->
x() * p1p2.getY() - p1->
y() * p1p2.getX() + p3->
y() * p1p2.getX() - p3->
x() * p1p2.getY() ) / ( p3p4.getX() * p1p2.getY() - p3p4.getY() * p1p2.getX() );
364 t1 = ( p3->
x() - p1->
x() + t2 * p3p4.getX() ) / p1p2.
getX();
366 else if ( ( p1p2.getX()*p3p4.getY() - p1p2.getY()*p3p4.getX() ) != 0 && p3p4.getX() != 0 )
368 t1 = ( p3->
x() * p3p4.getY() - p3->
y() * p3p4.getX() - p1->
x() * p3p4.getY() + p1->
y() * p3p4.getX() ) / ( p1p2.getX() * p3p4.getY() - p1p2.getY() * p3p4.getX() );
369 t2 = ( p1->
x() + t1 * p1p2.getX() - p3->
x() ) / p3p4.getX();
373 intersection_point->
setX( 0 );
374 intersection_point->
setY( 0 );
375 intersection_point->
setZ( 0 );
379 if ( t1 > 0 && t1 < 1 && t2 > 0 && t2 < 1 )
381 if ( ( *p1 ) == ( *p3 ) || ( *p1 ) == ( *p4 ) || ( *p2 ) == ( *p3 ) || ( *p2 ) == ( *p4 ) )
383 intersection_point->
setX( 0 );
384 intersection_point->
setY( 0 );
385 intersection_point->
setZ( 0 );
389 intersection_point->
setX( p1->
x() * ( 1 - t1 ) + p2->
x()*t1 );
390 intersection_point->
setY( p1->
y() * ( 1 - t1 ) + p2->
y()*t1 );
391 intersection_point->
setZ( 0 );
402 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
409 if ( i >= 0 && i <= n )
421 if ( pa && pb && pc )
423 double deter = ( pa->
x() * pb->
y() + pb->
x() * pc->
y() + pc->
x() * pa->
y() - pa->
x() * pc->
y() - pb->
x() * pa->
y() - pc->
x() * pb->
y() );
428 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
435 if ( n != 3 || i > n )
437 QgsDebugMsg( QStringLiteral(
"error, can't calculate hermite polynom" ) );
440 if ( n == 3 && i == 0 )
445 if ( n == 3 && i == 1 )
450 if ( n == 3 && i == 2 )
455 if ( n == 3 && i == 3 )
461 QgsDebugMsg( QStringLiteral(
"unexpected error" ) );
468 if ( n != 3 || i > n )
470 QgsDebugMsg( QStringLiteral(
"error, can't calculate hermite polynom" ) );
473 if ( n == 3 && i == 0 )
480 if ( n == 3 && i == 1 )
486 if ( n == 3 && i == 2 )
492 if ( n == 3 && i == 3 )
500 QgsDebugMsg( QStringLiteral(
"unexpected error" ) );
507 if ( v1 && v2 && result )
524 if ( v1->
getY() == 0 )
528 if ( v1->
getX() < 0 )
530 result->
setY( -length );
535 result->
setY( length );
543 double c = -( length * length );
544 double d = b * b - 4 * a *
c;
548 QgsDebugMsg( QStringLiteral(
"Determinant Error" ) );
552 result->
setX( ( -b + std::sqrt( d ) ) / ( 2 * a ) );
559 if ( !(
leftOf( point1, &point2, &point3 ) < 0 ) )
581 if ( v1->
getY() == 0 )
585 if ( v1->
getX() < 0 )
587 result->
setY( length );
592 result->
setY( -length );
600 double c = -( length * length );
601 double d = b * b - 4 * a *
c;
605 QgsDebugMsg( QStringLiteral(
"Determinant Error" ) );
609 result->
setX( ( -b + std::sqrt( d ) ) / ( 2 * a ) );
616 if ( (
leftOf( point1, &point2, &point3 ) < 0 ) )
634 if ( p1 && p2 && p3 && vec )
636 double ax = p2->
x() - p1->
x();
637 double ay = p2->
y() - p1->
y();
638 double az = p2->
z() - p1->
z();
639 double bx = p3->
x() - p1->
x();
640 double by = p3->
y() - p1->
y();
641 double bz = p3->
z() - p1->
z();
643 vec->
setX( ay * bz - az * by );
644 vec->
setY( az * bx - ax * bz );
645 vec->
setZ( ax * by - ay * bx );
652 if ( first && vec1 && second && vec2 )
662 return ( ( first->
x() * vec1->
getY() - first->
y() * vec1->
getX() - second->
x() * vec1->
getY() + second->
y() * vec1->
getX() ) / ( vec2->
getX() * vec1->
getY() - vec2->
getY() * vec1->
getX() ) );
667 QgsDebugMsg( QStringLiteral(
"warning: vectors are parallel" ) );
675 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
700 if ( tangent && target && result )
702 double xt = tangent->
getX();
703 double yt = tangent->
getY();
704 double zt = tangent->
getZ();
706 double xw = target->
getX();
707 double yw = target->
getY();
708 double zw = target->
getZ();
710 double xg1, yg1, zg1;
711 double xg2, yg2, zg2;
714 double xgalpha1 = 1 / ( 2 * xt * xt * yw * yw * zt * zt - 2 * zt * zt * zt * xt * zw * xw + yt * yt * yt * yt * zw * zw + yt * yt * zw * zw * zt * zt + xt * xt * yt * yt * xw * xw + xt * xt * yw * yw * yt * yt - 2 * xt * xt * xt * zt * zw * xw + yt * yt * yt * yt * xw * xw + yt * yt * yw * yw * zt * zt + 2 * xt * xt * yt * yt * zw * zw - 2 * yt * yt * yt * yw * zt * zw + zt * zt * xt * xt * zw * zw + zt * zt * zt * zt * xw * xw + xt * xt * zt * zt * xw * xw + 2 * zt * zt * xw * xw * yt * yt - 2 * xt * xt * yw * zt * yt * zw - 2 * xt * yt * yt * yt * xw * yw - 2 * xt * xt * xt * yw * yt * xw - 2 * xt * zt * zt * xw * yt * yw - 2 * xt * zt * xw * yt * yt * zw - 2 * yw * zt * zt * zt * yt * zw + xt * xt * xt * xt * yw * yw + yw * yw * zt * zt * zt * zt + xt * xt * xt * xt * zw * zw );
717 QgsDebugMsg( QStringLiteral(
"warning, only complex solution of xg" ) );
720 xg1 = std::sqrt( xgalpha1 ) * ( -yt * yw * xt + yt * yt * xw + xw * zt * zt - zt * xt * zw );
721 xg2 = -sqrt( xgalpha1 ) * ( -yt * yw * xt + yt * yt * xw + xw * zt * zt - zt * xt * zw );
724 double ygalpha1 = 1 / ( 2 * xt * xt * yw * yw * zt * zt - 2 * zt * zt * zt * xt * zw * xw + yt * yt * yt * yt * zw * zw + yt * yt * zw * zw * zt * zt + xt * xt * yt * yt * xw * xw + xt * xt * yw * yw * yt * yt - 2 * xt * xt * xt * zt * zw * xw + yt * yt * yt * yt * xw * xw + yt * yt * yw * yw * zt * zt + 2 * xt * xt * yt * yt * zw * zw - 2 * yt * yt * yt * yw * zt * zw + zt * zt * xt * xt * zw * zw + zt * zt * zt * zt * xw * xw + xt * xt * zt * zt * xw * xw + 2 * zt * zt * xw * xw * yt * yt - 2 * xt * xt * yw * zt * yt * zw - 2 * xt * yt * yt * yt * xw * yw - 2 * xt * xt * xt * yw * yt * xw - 2 * xt * zt * zt * xw * yt * yw - 2 * xt * zt * xw * yt * yt * zw - 2 * yw * zt * zt * zt * yt * zw + xt * xt * xt * xt * yw * yw + yw * yw * zt * zt * zt * zt + xt * xt * xt * xt * zw * zw );
727 QgsDebugMsg( QStringLiteral(
"warning, only complex solution of yg" ) );
730 yg1 = -sqrt( ygalpha1 ) * ( -yw * xt * xt - zt * zt * yw + zt * yt * zw + yt * xw * xt );
731 yg2 = std::sqrt( ygalpha1 ) * ( -yw * xt * xt - zt * zt * yw + zt * yt * zw + yt * xw * xt );
734 double zgalpha1 = 1 / ( 2 * xt * xt * yw * yw * zt * zt - 2 * zt * zt * zt * xt * zw * xw + yt * yt * yt * yt * zw * zw + yt * yt * zw * zw * zt * zt + xt * xt * yt * yt * xw * xw + xt * xt * yw * yw * yt * yt - 2 * xt * xt * xt * zt * zw * xw + yt * yt * yt * yt * xw * xw + yt * yt * yw * yw * zt * zt + 2 * xt * xt * yt * yt * zw * zw - 2 * yt * yt * yt * yw * zt * zw + zt * zt * xt * xt * zw * zw + zt * zt * zt * zt * xw * xw + xt * xt * zt * zt * xw * xw + 2 * zt * zt * xw * xw * yt * yt - 2 * xt * xt * yw * zt * yt * zw - 2 * xt * yt * yt * yt * xw * yw - 2 * xt * xt * xt * yw * yt * xw - 2 * xt * zt * zt * xw * yt * yw - 2 * xt * zt * xw * yt * yt * zw - 2 * yw * zt * zt * zt * yt * zw + xt * xt * xt * xt * yw * yw + yw * yw * zt * zt * zt * zt + xt * xt * xt * xt * zw * zw );
737 QgsDebugMsg( QStringLiteral(
"warning, only complex solution of zg" ) );
740 zg1 = -sqrt( zgalpha1 ) * ( yt * yw * zt - yt * yt * zw + xw * zt * xt - xt * xt * zw );
741 zg2 = std::sqrt( zgalpha1 ) * ( yt * yw * zt - yt * yt * zw + xw * zt * xt - xt * xt * zw );
743 double distance1 = std::sqrt( ( xw - xg1 ) * ( xw - xg1 ) + ( yw - yg1 ) * ( yw - yg1 ) + ( zw - zg1 ) * ( zw - zg1 ) );
744 double distance2 = std::sqrt( ( xw - xg2 ) * ( xw - xg2 ) + ( yw - yg2 ) * ( yw - yg2 ) + ( zw - zg2 ) * ( zw - zg2 ) );
746 if ( distance1 <= distance2 )
763 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
771 if ( test && pt1 && pt2 && pt3 )
773 double a = ( pt1->
z() * ( pt2->
y() - pt3->
y() ) + pt2->
z() * ( pt3->
y() - pt1->
y() ) + pt3->
z() * ( pt1->
y() - pt2->
y() ) ) / ( ( pt1->
x() - pt2->
x() ) * ( pt2->
y() - pt3->
y() ) - ( pt2->
x() - pt3->
x() ) * ( pt1->
y() - pt2->
y() ) );
774 double b = ( pt1->
z() * ( pt2->
x() - pt3->
x() ) + pt2->
z() * ( pt3->
x() - pt1->
x() ) + pt3->
z() * ( pt1->
x() - pt2->
x() ) ) / ( ( pt1->
y() - pt2->
y() ) * ( pt2->
x() - pt3->
x() ) - ( pt2->
y() - pt3->
y() ) * ( pt1->
x() - pt2->
x() ) );
775 double c = pt1->
z() - a * pt1->
x() - b * pt1->
y();
776 double zpredicted = test->
x() * a + test->
y() * b +
c;
777 return ( test->
z() - zpredicted );
781 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
788 if ( p1 && p2 && p3 && p4 )
792 double value = acos( ( v1.getX() * v2.getX() + v1.getY() * v2.getY() ) / ( v1.getLength() * v2.getLength() ) ) * 180 / M_PI;
797 QgsDebugMsg( QStringLiteral(
"warning, null pointer" ) );
void setX(double x)
Sets the x-component of the vector.
bool ANALYSIS_EXPORT normalRight(Vector3D *v1, Vector3D *result, double length)
Assigns the vector 'result', which is normal to the vector 'v1', on the right side of v1 and has leng...
void setZ(double z)
Sets the point's z-coordinate.
double ANALYSIS_EXPORT cFDerBernsteinPoly(int n, int i, double t)
Calculates the first derivative of a Bernstein polynomial with respect to the parameter t...
bool ANALYSIS_EXPORT lineIntersection(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Returns true, if line1 (p1 to p2) and line2 (p3 to p4) intersect. If the lines have an endpoint in co...
double ANALYSIS_EXPORT triArea(QgsPoint *pa, QgsPoint *pb, QgsPoint *pc)
Returns the area of a triangle. If the points are ordered counterclockwise, the value will be positiv...
bool ANALYSIS_EXPORT BarycentricToXY(double u, double v, double w, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *result)
bool ANALYSIS_EXPORT calcBarycentricCoordinates(double x, double y, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *result)
Calculates the barycentric coordinates of a point (x,y) with respect to p1, p2, p3 and stores the thr...
bool ANALYSIS_EXPORT inDiametral(QgsPoint *p1, QgsPoint *p2, QgsPoint *point)
Tests, whether 'point' is inside the diametral circle through 'p1' and 'p2'.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
bool ANALYSIS_EXPORT pointInsideTriangle(double x, double y, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3)
Returns true, if the point with coordinates x and y is inside (or at the edge) of the triangle p1...
double getZ() const
Returns the z-component of the vector.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
bool ANALYSIS_EXPORT normalMinDistance(Vector3D *tangent, Vector3D *target, Vector3D *result)
Calculates a Vector orthogonal to 'tangent' with length 1 and closest possible to result...
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
void setZ(double z)
Sets the z-component of the vector.
bool ANALYSIS_EXPORT normalLeft(Vector3D *v1, Vector3D *result, double length)
Assigns the vector 'result', which is normal to the vector 'v1', on the left side of v1 and has lengt...
bool ANALYSIS_EXPORT circumcenter(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *result)
Calculates the center of the circle passing through p1, p2 and p3. Returns true in case of success an...
double ANALYSIS_EXPORT distPointFromLine(QgsPoint *thepoint, QgsPoint *p1, QgsPoint *p2)
Calculates the (2 dimensional) distance from 'thepoint' to the line defined by p1 and p2...
Point geometry type, with support for z-dimension and m-values.
double ANALYSIS_EXPORT planeTest(QgsPoint *test, QgsPoint *pt1, QgsPoint *pt2, QgsPoint *pt3)
Tests, if 'test' is in the same plane as 'p1', 'p2' and 'p3' and returns the z-difference from the pl...
void setX(double x)
Sets the point's x-coordinate.
void setY(double y)
Sets the point's y-coordinate.
double getY() const
Returns the y-component of the vector.
bool ANALYSIS_EXPORT inCircle(QgsPoint *testp, QgsPoint *p1, QgsPoint *p2, QgsPoint *p3)
Tests, whether 'testp' is inside the circle through 'p1', 'p2' and 'p3'.
void setY(double y)
Sets the y-component of the vector.
double ANALYSIS_EXPORT crossVec(QgsPoint *first, Vector3D *vec1, QgsPoint *second, Vector3D *vec2)
Calculates the intersection of the two vectors vec1 and vec2, which start at first(vec1) and second(v...
double ANALYSIS_EXPORT calcBernsteinPoly(int n, int i, double t)
Calculates the value of a Bernstein polynomial.
double getX() const
Returns the x-component of the vector.
void ANALYSIS_EXPORT normalFromPoints(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, Vector3D *vec)
Calculates the normal vector of the plane through the points p1, p2 and p3 and assigns the result to ...
int ANALYSIS_EXPORT lower(int n, int i)
Lower function.
double ANALYSIS_EXPORT cFDerCubicHermitePoly(int n, int i, double t)
Calculates the first derivative of a cubic Hermite polynomial with respect to the parameter t...
double ANALYSIS_EXPORT leftOf(const QgsPoint &thepoint, const QgsPoint *p1, const QgsPoint *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'. Negativ values mean left a...
double ANALYSIS_EXPORT calcCubicHermitePoly(int n, int i, double t)
Calculates the value of a cubic Hermite polynomial.
bool ANALYSIS_EXPORT derVec(const Vector3D *v1, const Vector3D *v2, Vector3D *result, double x, double y)
Calculates the z-component of a vector with coordinates 'x' and 'y'which is in the same tangent plane...
int ANALYSIS_EXPORT faculty(int n)
Faculty function.