OpendTect  6.6
trigonometry.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Kristofer Tingdahl
8  Date: 23-11-2002
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 
13 -*/
14 
15 #include "algomod.h"
16 #include "coord.h"
17 #include "typeset.h"
18 #include <math.h>
19 class Plane3;
20 
21 
26 inline void interpolateOnTriangle2D( const Coord pt,
27  const Coord a, const Coord b, const Coord c,
28  double& weight_a, double& weight_b, double& weight_c )
29 {
30  const Coord3 ba = Coord3(b-a,0.);
31  const Coord3 ca = Coord3(c-a,0.);
32  const double triarea = ba.cross( ca ).abs()*0.5;
33 
34  const Coord3 pa = Coord3(pt-a,0.);
35  const Coord3 pb = Coord3(pt-b,0.);
36  const Coord3 pc = Coord3(pt-c,0.);
37 
38  if ( mIsZero(triarea,1e-8) )
39  {
40  const double distpa = pa.abs();
41  if ( mIsZero(distpa,1e-8) )
42  {
43  weight_a = 1.; weight_b = 0.; weight_c = 0.;
44  return;
45  }
46 
47  const double distpb = pb.abs();
48  if ( mIsZero(distpb,1e-8) )
49  {
50  weight_a = 0.; weight_b = 1.; weight_c = 0.;
51  return;
52  }
53 
54  const double distpc = pc.abs();
55  if ( mIsZero(distpc,1e-8) )
56  {
57  weight_a = 0.; weight_b = 0.; weight_c = 1.;
58  return;
59  }
60 
61  const double totalinversedist = 1./distpa + 1./distpb + 1./distpc;
62  weight_a = 1./(distpa*totalinversedist);
63  weight_b = 1./(distpb*totalinversedist);
64  weight_c = 1./(distpc*totalinversedist);
65  }
66  else
67  {
68  const double triareapab = pa.cross( pb ).abs()*0.5;
69  const double triareapac = pa.cross( pc ).abs()*0.5;
70  const double triareapcb = pc.cross( pb ).abs()*0.5;
71 
72  weight_a = triareapcb / triarea;
73  weight_b = triareapac / triarea;
74  weight_c = triareapab / triarea;
75  }
76 }
77 
78 
84 /*Calculate a 3x3 matrix's determinent given by v[0]-v[8] with 9 elements. */
85 inline double determinent33( const double* v )
86 {
87  return v[0]*(v[4]*v[8]-v[5]*v[7])+v[1]*(v[5]*v[6]-v[3]*v[8])+
88  v[2]*(v[3]*v[7]-v[4]*v[6]);
89 }
90 
91 
92 /*Calculate a 4x4 matrix's determinent given by rows r0, r1, r2, r3 with the
93  last column 1, 1, 1, 1. */
94 inline double determinent44( const Coord3& r0, const Coord3& r1,
95  const Coord3& r2, const Coord3& r3 )
96 {
97  const double d0[9] = { r1.y, r1.z, 1, r2.y, r2.z, 1, r3.y, r3.z, 1 };
98  const double d1[9] = { r1.x, r1.z, 1, r2.x, r2.z, 1, r3.x, r3.z, 1 };
99  const double d2[9] = { r1.x, r1.y, 1, r2.x, r2.y, 1, r3.x, r3.y, 1 };
100  const double d3[9] = { r1.x, r1.y, r1.z, r2.x, r2.y, r2.z, r3.x, r3.y,r3.z};
101  return r0.x*determinent33( d0 )-r0.y*determinent33( d1 )+
102  r0.z*determinent33( d2 )-determinent33( d3 );
103 }
104 
106 inline double determinent44( const double* r0, const double* r1,
107  const double* r2, const double* r3 )
108 {
109  const double d0[9] = { r1[1], r1[2], r1[3], r2[1], r2[2], r2[3],
110  r3[1], r3[2], r3[3] };
111  const double d1[9] = { r1[0], r1[2], r1[3], r2[0], r2[2], r2[3],
112  r3[0], r3[2], r3[3] };
113  const double d2[9] = { r1[0], r1[1], r1[3], r2[0], r2[1], r2[3],
114  r3[0], r3[1], r3[3] };
115  const double d3[9] = { r1[0], r1[1], r1[2], r2[0], r2[1], r2[2],
116  r3[0], r3[1], r3[2] };
117  return r0[0]*determinent33( d0 )-r0[1]*determinent33( d1 )+
118  r0[2]*determinent33( d2 )-r0[3]*determinent33( d3 );
119 }
120 
122 inline bool isInsideCircle( const Coord& pt,
123  const Coord& p1, const Coord& p2, const Coord& p3 )
124 {
125  Coord center;
126  const Coord d12 = p1-p2;
127  const Coord d13 = p1-p3;
128  const Coord d = p1-pt;
129  const double deter=d13.x*d12.y-d13.y*d12.x;
130  const double a12 = ( p1.dot(p1)-p2.dot(p2) )/2;
131  const double a13 = ( p1.dot(p1)-p3.dot(p3) )/2;
132  center.x = (a13*d12.y-a12*d13.y)/deter;
133  center.y = (d13.x*a12-d12.x*a13)/deter;
134  return pt.sqAbs()-p1.sqAbs()+2*center.dot(d)<0;
135 }
136 
137 
139 inline bool isInsideCircumSphere( const Coord3& p, const Coord3& a,
140  const Coord3& b, const Coord3& c, const Coord3& d )
141 {
142  const Coord3 ab = a-b;
143  const Coord3 ac = a-c;
144  const Coord3 ad = a-d;
145  const double t[9] = { ab.x, ab.y, ab.z, ac.x, ac.y, ac.z, ad.x, ad.y, ad.z};
146  const double deter = determinent33( t );
147 
148  const double sqra = a.x*a.x+a.y*a.y+a.z*a.z;
149  const double d0 = (sqra-(b.x*b.x+b.y*b.y+b.z*b.z))/2;
150  const double d1 = (sqra-(c.x*c.x+c.y*c.y+c.z*c.z))/2;
151  const double d2 = (sqra-(d.x*d.x+d.y*d.y+d.z*d.z))/2;
152  const double t0[9] = { d0, ab.y, ab.z, d1, ac.y, ac.z, d2, ad.y, ad.z };
153  const double t1[9] = { ab.x, d0, ab.z, ac.x, d1, ac.z, ad.x, d2, ad.z };
154  const double t2[9] = { ab.x, ab.y, d0, ac.x, ac.y, d1, ad.x, ad.y, d2 };
155  const double centerx = determinent33(t0)/deter;
156  const double centery = determinent33(t1)/deter;
157  const double centerz = determinent33(t2)/deter;
158 
159  return (p.x*p.x+p.y*p.y+p.z*p.z-sqra+
160  2*(centerx*(a.x-p.x)+centery*(a.y-p.y)+centerz*(a.z-p.z)))<0;
161 }
162 
163 
165 inline bool sameSide2D( const Coord& p1, const Coord& p2,
166  const Coord& a, const Coord& b, double epsilon )
167 {
168  double xdiff = b.x-a.x;
169  double ydiff = b.y-a.y;
170  return ((p1.x-a.x)*ydiff-(p1.y-a.y)*xdiff)*
171  ((p2.x-a.x)*ydiff-(p2.y-a.y)*xdiff)>=-epsilon;
172 }
173 
174 
176 inline bool sameSide3D( const Coord3& p1, const Coord3& p2,
177  const Coord3& a, const Coord3& b, double epsilon )
178 {
179  const Coord3 cpp1 = (b-a).cross(p1-a);
180  const Coord3 cpp2 = (b-a).cross(p2-a);
181  return cpp1.dot(cpp2)>=-epsilon;
182 }
183 
184 
186 inline bool pointInTriangle2D( const Coord& p, const Coord& a, const Coord& b,
187  const Coord& c, double epsilon )
188 {
189  if ( (p.x>a.x && p.x>b.x && p.x>c.x) || (p.x<a.x && p.x<b.x && p.x<c.x) ||
190  (p.y>a.y && p.y>b.y && p.y>c.y) || (p.y<a.y && p.y<b.y && p.y<c.y) )
191  return false;
192 
193  return sameSide2D(p,a,b,c,epsilon) && sameSide2D(p,b,a,c,epsilon) &&
194  sameSide2D(p,c,a,b,epsilon);
195 }
196 
197 
199 inline bool pointInTriangle3D( const Coord3& p, const Coord3& a,
200  const Coord3& b, const Coord3& c, double epsilon,
201  bool useangularmethod )
202 {
203  if ( !useangularmethod )
204  {
205  return sameSide3D(p,a,b,c,epsilon) && sameSide3D(p,b,a,c,epsilon) &&
206  sameSide3D(p,c,a,b,epsilon);
207  }
208 
209  Coord3 ap = a - p;
210  ap = ap.normalize();
211  Coord3 bp = b - p;
212  bp = bp.normalize();
213  Coord3 cp = c - p;
214  cp = cp.normalize();
215 
216  const double d1 = ap.dot( bp );
217  const double d2 = bp.dot( cp );
218  const double d3 = cp.dot( ap );
219  const double angle = Math::ACos(d1) + Math::ACos(d2) + Math::ACos(d3);
220 
221  return mIsEqual(angle,M_2PI,epsilon);
222 }
223 
224 
226 inline bool pointInTriangle3D( const Coord3& p, const Coord3& a,
227  const Coord3& b, const Coord3& c, double epsilon )
228 { return pointInTriangle3D( p, a, b, c, epsilon, false ); }
229 
230 
232 inline bool pointOnEdge2D( const Coord& p, const Coord& a, const Coord& b,
233  double epsilon )
234 {
235  const Coord pa = p-a;
236  const Coord ba = b-a;
237  const double t = pa.dot(ba)/ba.sqAbs();
238  if ( t<0 || t>1 )
239  return false;
240 
241  const Coord intersectpt = a+Coord(t*ba.x, t*ba.y);
242  const Coord pq = p-intersectpt;
243  return pq.sqAbs()<epsilon*epsilon;
244 }
245 
246 
247 inline bool pointOnEdge3D( const Coord3& p, const Coord3& a, const Coord3& b,
248  double epsilon )
249 {
250  const Coord3 pa = p-a;
251  const Coord3 ba = b-a;
252  const double t = pa.dot(ba)/ba.sqAbs();
253  if ( t<0 || t>1 )
254  return false;
255 
256  const Coord3 pq = pa-t*ba;
257  return pq.sqAbs()<epsilon*epsilon;
258 }
259 
260 
264 inline bool pointInPolygon( const Coord3& pt, const TypeSet<Coord3>& plgknots,
265  double epsilon )
266 {
267  const int nrvertices = plgknots.size();
268  if ( nrvertices==2 )
269  {
270  const double newepsilon = plgknots[0].distTo(plgknots[1])*0.001;
271  return pointOnEdge3D( pt, plgknots[0], plgknots[1], newepsilon );
272  }
273  else if ( nrvertices==3 )
274  return pointInTriangle3D( pt, plgknots[0], plgknots[1], plgknots[2],
275  epsilon );
276  else
277  {
278  Coord3 p1, p2;
279  double anglesum = 0, cosangle;
280  for ( int idx=0; idx<nrvertices; idx++ )
281  {
282  p1 = plgknots[idx] - pt;
283  p2 = plgknots[(idx+1)%nrvertices] - pt;
284 
285  const double d1 = p1.abs();
286  const double d2 = p2.abs();
287  if ( d1*d2 <= epsilon*epsilon || d1 <= epsilon || d2 <= epsilon )
288  return true;
289  else
290  cosangle = p1.dot(p2) / (d1*d2);
291 
292  anglesum += acos( cosangle );
293  }
294 
295  return mIsEqual( anglesum, 6.2831853071795862, 1e-4 );
296  }
297 }
298 
299 
300 typedef Coord3 Vector3;
301 
308 
316  bool checkforundefs );
317 
318 
328 {
329 public:
330  Quaternion(double s,double x,double y,double z);
331  Quaternion(const Vector3& axis,float angle);
332 
333  void setRotation(const Vector3& axis,float angle);
334  void getRotation(Vector3& axis,float& angle) const;
336  Coord3 rotate(const Coord3&) const;
337 
344 
346 
347  double s_;
349 };
350 
351 
362 {
363 public:
364  ParamLine2(double slope=0,double intcpt=0);
365  ParamLine2(const Coord&,double slope);
366  ParamLine2(const Coord& p0,const Coord& p1);
369  bool operator==(const ParamLine2&) const;
370 
371  Coord direction(bool normalized=true) const;
372 
373  Coord getPoint(double t) const;
374 
375  double closestPoint(const Coord& point) const;
381  double distanceToPoint(const Coord&) const;
382  double sqDistanceToPoint(const Coord&) const;
383 
384  double x0_;
385  double y0_;
386  double alpha_;
387  double beta_;
388 };
389 
390 
397 {
398 public:
399  Line2(double slope=0,double intcpt=0);
400  Line2(const Coord&,double slope);
401  Line2(const Coord&,const Coord&);
402 
403  bool operator==(const Line2&) const;
404 
405  Coord direction() const;
407  Coord closestPoint(const Coord& point) const;
411  Coord intersection(const Line2&,bool checkinlimit=true) const;
412 
413  double distanceTo(const Line2&) const;
415  bool getParallelLine(Line2& line,double dist) const;
417  bool getPerpendicularLine(Line2& line,const Coord& pt) const;
419  bool isOnLine(const Coord& pt) const;
420 
421  double slope_;
422  double yintcpt_;
423 
424  bool isvertical_;
425  double xintcpt_;
429 };
430 
431 
441 {
442 public:
443  Line3();
444  Line3( double x0, double y0, double z0,
445  double alpha, double beta, double gamma );
446  Line3( const Coord3&, const Vector3& );
447 
448  Vector3 direction( bool normalize = true ) const
449  {
450  const Vector3 res( alpha_, beta_, gamma_ );
451  return normalize ? res.normalize() : res;
452  }
453 
454  Coord3 getPoint(double t) const;
455  bool intersectWith( const Plane3&, double& t ) const;
460  double distanceToPoint( const Coord3& point ) const;
461  double sqDistanceToPoint( const Coord3& point ) const;
462  double closestPoint( const Coord3& point ) const;
465  void closestPoint( const Line3& line, double& t_this,
466  double& t_line ) const;
470  double x0_;
471  double y0_;
472  double z0_;
473  double alpha_;
474  double beta_;
475  double gamma_;
476 };
477 
478 
484 {
485 public:
487  Plane3(double, double, double, double);
488  Plane3( const Coord3& vectors, const Coord3&,
489  bool twovectors );
493  Plane3( const Coord3&, const Coord3&, const Coord3& );
495 
496  void set( const Coord3& vector, const Coord3&,
497  bool twovectors );
501  void set( const Coord3&, const Coord3&, const Coord3& );
502  float set( const TypeSet<Coord3>& );
508  bool operator==(const Plane3&) const;
509  bool operator!=(const Plane3&) const;
510 
511  Coord3 normal() const { return Coord3( A_, B_, C_ ); }
512 
513  double distanceToPoint( const Coord3&,
514  bool wichside=false ) const;
519  bool intersectWith( const Line3&, Coord3& ) const;
522  bool intersectWith( const Plane3&, Line3& ) const;
526  bool onSameSide(const Coord3& p1,const Coord3& p2);
530  double A_;
531  double B_;
532  double C_;
533  double D_;
534 };
535 
536 
543 {
544 public:
546  const Coord3& origin,
547  const Coord3& pt10);
552  virtual ~Plane3CoordSystem() {}
553  bool isOK() const;
557  const Plane3& plane() const { return plane_; }
558 
559  Coord transform(const Coord3&,bool project) const;
564  Coord3 transform(const Coord&) const;
565 
566 protected:
567 
568  const Plane3 plane_;
572  bool isok_;
573 };
574 
575 
582 {
583 public:
584  Sphere(float r=0,float t=0,float p=0)
585  : radius(r),theta(t),phi(p) {}
586 
587  Sphere(const Coord3& crd)
588  : radius((float) crd.x),theta((float) crd.y)
589  , phi((float) crd.z) {}
590  inline bool operator ==(const Sphere&) const;
591  inline bool operator !=( const Sphere& oth ) const
592  { return !(oth == *this); }
593 
594  float radius;
595  float theta;
596  float phi;
597 
598  static const Sphere& nullSphere();
599  bool isNull() const;
600 
601 };
602 
603 
604 mGlobal(Algo) Sphere cartesian2Spherical(const Coord3&,bool math);
607 mGlobal(Algo) Coord3 spherical2Cartesian(const Sphere&,bool math);
611 inline bool Sphere::operator ==( const Sphere& s ) const
612 {
613  const float dr = radius-s.radius;
614  const float dt = theta-s.theta;
615  const float dp = phi-s.phi;
616  return mIsZero(dr,1e-8) && mIsZero(dt,1e-8) && mIsZero(dp,1e-8);
617 }
618 
619 
626  Coord3 trVert0, Coord3 trVert1, Coord3 trVert2 )
627 {
628  Coord3 res = Coord3::udf();
629 
630  const Coord3 edge1 = trVert1 - trVert0;
631  const Coord3 edge2 = trVert2 - trVert0;
632  const Coord3 seg = segEnd - segStart;
633  const Coord3 h = seg.cross( edge2 );
634  const double a = edge1.dot( h );
635  if ( mIsZero( a, mDefEps ) )
636  return res;
637 
638  const double f = 1.0/a;
639  const Coord3 s = segStart - trVert0;
640  const double u = f * s.dot( h );
641  if ( u<0.0 || u>1.0 )
642  return res;
643 
644  const Coord3 q = s.cross( edge1 );
645  const double v = f * seg.dot( q ) ;
646  if ( v<0.0 || u+v>1.0 )
647  return res;
648 
649  const double t = f * edge2.dot( q );
650  if ( t>mDefEps && t<1-mDefEps )
651  return res = segStart + seg * t;
652 
653  return res;
654 }
Plane3CoordSystem::transform
Coord3 transform(const Coord &) const
Plane3CoordSystem
Defines a 2D coordinate system on a 3D plane and transforms between the 3D space and the coordinate s...
Definition: trigonometry.h:543
Coord3
A cartesian coordinate in 3D space.
Definition: coord.h:72
determinent44
double determinent44(const Coord3 &r0, const Coord3 &r1, const Coord3 &r2, const Coord3 &r3)
Definition: trigonometry.h:94
Quaternion::operator-
Quaternion operator-(const Quaternion &) const
Plane3::set
void set(const Coord3 &, const Coord3 &, const Coord3 &)
ParamLine2::distanceToPoint
double distanceToPoint(const Coord &) const
Quaternion::rotate
Coord3 rotate(const Coord3 &) const
Line2::getParallelLine
bool getParallelLine(Line2 &line, double dist) const
sameSide2D
bool sameSide2D(const Coord &p1, const Coord &p2, const Coord &a, const Coord &b, double epsilon)
Definition: trigonometry.h:165
Sphere::isNull
bool isNull() const
compares with epsilon
Line2::isOnLine
bool isOnLine(const Coord &pt) const
ParamLine2::ParamLine2
ParamLine2(double slope=0, double intcpt=0)
Line2::getPerpendicularLine
bool getPerpendicularLine(Line2 &line, const Coord &pt) const
Quaternion::s_
double s_
Definition: trigonometry.h:347
Plane3CoordSystem::vec01_
Coord3 vec01_
Definition: trigonometry.h:571
Line3::Line3
Line3(const Coord3 &, const Vector3 &)
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
Coord3::udf
static const Coord3 & udf()
mIsEqual
#define mIsEqual(x, y, eps)
Definition: commondefs.h:67
makeSphereVectorSet
TypeSet< Vector3 > * makeSphereVectorSet(double dangle)
Divides a sphere in a number of vectors, divided by approximately dangle from each other....
Plane3::Plane3
Plane3(const Coord3 &, const Coord3 &, const Coord3 &)
Line2::start_
Coord start_
Definition: trigonometry.h:427
pointInTriangle3D
bool pointInTriangle3D(const Coord3 &p, const Coord3 &a, const Coord3 &b, const Coord3 &c, double epsilon, bool useangularmethod)
Definition: trigonometry.h:199
Quaternion::Quaternion
Quaternion(const Vector3 &axis, float angle)
Coord3::z
OrdType z
Definition: coord.h:124
Plane3::B_
double B_
Definition: trigonometry.h:531
Sphere::operator==
bool operator==(const Sphere &) const
Definition: trigonometry.h:611
pointOnEdge3D
bool pointOnEdge3D(const Coord3 &p, const Coord3 &a, const Coord3 &b, double epsilon)
Definition: trigonometry.h:247
Quaternion::operator+=
Quaternion & operator+=(const Quaternion &)
Quaternion::operator-=
Quaternion & operator-=(const Quaternion &)
Line2::stop_
Coord stop_
Definition: trigonometry.h:428
interpolateOnTriangle2D
void interpolateOnTriangle2D(const Coord pt, const Coord a, const Coord b, const Coord c, double &weight_a, double &weight_b, double &weight_c)
Given a point pt in a triangle ABC, we calculate the interpolation weights for each vertex.
Definition: trigonometry.h:26
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
Line2::Line2
Line2(const Coord &, const Coord &)
isInsideCircumSphere
bool isInsideCircumSphere(const Coord3 &p, const Coord3 &a, const Coord3 &b, const Coord3 &c, const Coord3 &d)
Definition: trigonometry.h:139
ParamLine2::x0_
double x0_
Definition: trigonometry.h:384
Line3::beta_
double beta_
Definition: trigonometry.h:474
Plane3::onSameSide
bool onSameSide(const Coord3 &p1, const Coord3 &p2)
Quaternion::Quaternion
Quaternion(double s, double x, double y, double z)
mDefEps
#define mDefEps
Definition: commondefs.h:71
ParamLine2
A ParamLine2 is a line in space, with the following equations:
Definition: trigonometry.h:362
Line2
A Line2 is a line on XY-plane, and it is defined in slope-intercept form y = slope*x + y-intercept; f...
Definition: trigonometry.h:397
ParamLine2::sqDistanceToPoint
double sqDistanceToPoint(const Coord &) const
spherical2Cartesian
Coord3 spherical2Cartesian(const Sphere &, bool math)
typeset.h
ParamLine2::operator==
bool operator==(const ParamLine2 &) const
Line3::gamma_
double gamma_
Definition: trigonometry.h:475
operator==
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:81
Line3::direction
Vector3 direction(bool normalize=true) const
Definition: trigonometry.h:448
Line2::Line2
Line2(double slope=0, double intcpt=0)
Line3::y0_
double y0_
Definition: trigonometry.h:471
Plane3::D_
double D_
Definition: trigonometry.h:533
Plane3CoordSystem::Plane3CoordSystem
Plane3CoordSystem(const Coord3 &normal, const Coord3 &origin, const Coord3 &pt10)
Quaternion::operator*
Quaternion operator*(const Quaternion &) const
Plane3CoordSystem::plane_
const Plane3 plane_
Definition: trigonometry.h:568
Quaternion::operator*=
Quaternion & operator*=(const Quaternion &)
Plane3::normal
Coord3 normal() const
Definition: trigonometry.h:511
M_2PI
#define M_2PI
Definition: commondefs.h:83
Line2::yintcpt_
double yintcpt_
Definition: trigonometry.h:422
Coord
A cartesian coordinate in 2D space.
Definition: coord.h:25
lineSegmentIntersectsTriangle
Coord3 lineSegmentIntersectsTriangle(Coord3 segStart, Coord3 segEnd, Coord3 trVert0, Coord3 trVert1, Coord3 trVert2)
Line segment/ray triangle intersection (Moller-Trumbore algorithm). Returns Coord3::udf() if no inter...
Definition: trigonometry.h:625
Line2::isvertical_
bool isvertical_
Definition: trigonometry.h:424
Coord3::dot
DistType dot(const Coord3 &) const
Definition: coord.h:248
Sphere::theta
float theta
Definition: trigonometry.h:595
Plane3CoordSystem::plane
const Plane3 & plane() const
Definition: trigonometry.h:557
ParamLine2::ParamLine2
ParamLine2(const Coord &, double slope)
Line2::Line2
Line2(const Coord &, double slope)
sameSide3D
bool sameSide3D(const Coord3 &p1, const Coord3 &p2, const Coord3 &a, const Coord3 &b, double epsilon)
Definition: trigonometry.h:176
ParamLine2::y0_
double y0_
Definition: trigonometry.h:385
Line2::operator==
bool operator==(const Line2 &) const
Plane3::distanceToPoint
double distanceToPoint(const Coord3 &, bool wichside=false) const
ParamLine2::beta_
double beta_
Definition: trigonometry.h:387
estimateAverageVector
Coord3 estimateAverageVector(const TypeSet< Coord3 > &, bool normalize, bool checkforundefs)
Computes an average of a number of vectors using:
Line3::closestPoint
double closestPoint(const Coord3 &point) const
mIsZero
#define mIsZero(x, eps)
Definition: commondefs.h:66
Plane3::getProjection
Coord3 getProjection(const Coord3 &pos)
Line3::sqDistanceToPoint
double sqDistanceToPoint(const Coord3 &point) const
pointOnEdge2D
bool pointOnEdge2D(const Coord &p, const Coord &a, const Coord &b, double epsilon)
Definition: trigonometry.h:232
operator!=
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:90
Quaternion::vec_
Vector3 vec_
Definition: trigonometry.h:348
Plane3CoordSystem::origin_
const Coord3 origin_
Definition: trigonometry.h:569
Line2::intersection
Coord intersection(const Line2 &, bool checkinlimit=true) const
Sphere::radius
float radius
Definition: trigonometry.h:594
Plane3::set
float set(const TypeSet< Coord3 > &)
Line3::getPoint
Coord3 getPoint(double t) const
Line3
A Line3 is a line in space, with the following equations:
Definition: trigonometry.h:441
Coord3::cross
Coord3 cross(const Coord3 &) const
Definition: coord.h:252
Plane3::Plane3
Plane3(double, double, double, double)
Coord3::normalize
Coord3 normalize() const
Definition: coord.h:256
Plane3
A Plane3 is a plane in space, with the equation: Ax + By + Cz + D = 0.
Definition: trigonometry.h:484
Sphere::phi
float phi
Definition: trigonometry.h:596
Geom::Point2D::sqAbs
T sqAbs() const
Definition: geometry.h:381
Sphere::nullSphere
static const Sphere & nullSphere()
Quaternion
Quaternion is an extension to complex numbers.
Definition: trigonometry.h:328
isInsideCircle
bool isInsideCircle(const Coord &pt, const Coord &p1, const Coord &p2, const Coord &p3)
Definition: trigonometry.h:122
Line3::distanceToPoint
double distanceToPoint(const Coord3 &point) const
Line3::z0_
double z0_
Definition: trigonometry.h:472
Coord::dot
OrdType dot(const Coord &) const
ParamLine2::getPoint
Coord getPoint(double t) const
Plane3::intersectWith
bool intersectWith(const Line3 &, Coord3 &) const
Plane3::Plane3
Plane3()
Plane3::Plane3
Plane3(const TypeSet< Coord3 > &)
pointInPolygon
bool pointInPolygon(const Coord3 &pt, const TypeSet< Coord3 > &plgknots, double epsilon)
Definition: trigonometry.h:264
Plane3CoordSystem::isOK
bool isOK() const
Sphere::Sphere
Sphere(float r=0, float t=0, float p=0)
Definition: trigonometry.h:584
Geom::Point2D::y
T y
Definition: geometry.h:68
Plane3CoordSystem::vec10_
Coord3 vec10_
Definition: trigonometry.h:570
Line3::alpha_
double alpha_
Definition: trigonometry.h:473
Sphere::Sphere
Sphere(const Coord3 &crd)
Definition: trigonometry.h:587
Quaternion::setRotation
void setRotation(const Vector3 &axis, float angle)
Plane3CoordSystem::isok_
bool isok_
Definition: trigonometry.h:572
Plane3::operator!=
bool operator!=(const Plane3 &) const
Geom::Point2D::x
T x
Definition: geometry.h:67
Plane3::Plane3
Plane3(const Coord3 &vectors, const Coord3 &, bool twovectors)
determinent33
double determinent33(const double *v)
Here are some commonly used functions to judge the position relation between point and line,...
Definition: trigonometry.h:85
Plane3CoordSystem::~Plane3CoordSystem
virtual ~Plane3CoordSystem()
Definition: trigonometry.h:552
Line3::x0_
double x0_
Definition: trigonometry.h:470
Quaternion::getRotation
void getRotation(Vector3 &axis, float &angle) const
Sphere
Represents a point in spherical coordinates. The angle phi lies in the horizontal plane,...
Definition: trigonometry.h:582
pointInTriangle2D
bool pointInTriangle2D(const Coord &p, const Coord &a, const Coord &b, const Coord &c, double epsilon)
Definition: trigonometry.h:186
Line3::closestPoint
void closestPoint(const Line3 &line, double &t_this, double &t_line) const
Plane3CoordSystem::transform
Coord transform(const Coord3 &, bool project) const
Plane3::C_
double C_
Definition: trigonometry.h:532
Line2::direction
Coord direction() const
Line2::closestPoint
Coord closestPoint(const Coord &point) const
ParamLine2::ParamLine2
ParamLine2(const Coord &p0, const Coord &p1)
Quaternion::inverse
Quaternion inverse() const
Line3::intersectWith
bool intersectWith(const Plane3 &, double &t) const
ParamLine2::closestPoint
double closestPoint(const Coord &point) const
cartesian2Spherical
Sphere cartesian2Spherical(const Coord3 &, bool math)
Line2::xintcpt_
double xintcpt_
Definition: trigonometry.h:425
Coord3::sqAbs
DistType sqAbs() const
Line3::Line3
Line3()
Plane3::set
void set(const Coord3 &vector, const Coord3 &, bool twovectors)
Plane3::intersectWith
bool intersectWith(const Plane3 &, Line3 &) const
Line2::slope_
double slope_
Definition: trigonometry.h:421
Line2::distanceTo
double distanceTo(const Line2 &) const
Plane3::A_
double A_
Definition: trigonometry.h:530
ParamLine2::direction
Coord direction(bool normalized=true) const
Vector3
Coord3 Vector3
Definition: trigonometry.h:300
Line3::Line3
Line3(double x0, double y0, double z0, double alpha, double beta, double gamma)
Plane3::operator==
bool operator==(const Plane3 &) const
Quaternion::operator+
Quaternion operator+(const Quaternion &) const
Math::ACos
float ACos(float)
ParamLine2::alpha_
double alpha_
Definition: trigonometry.h:386
TypeSet< Coord3 >
Coord3::abs
DistType abs() const
coord.h

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021