Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
constructions/kernel_ftC3.h File Reference
#include <CGAL/determinant.h>
Include dependency graph for constructions/kernel_ftC3.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class FT >
CGAL_BEGIN_NAMESPACE
CGAL_KERNEL_INLINE void 
midpointC3 (const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, FT &x, FT &y, FT &z)
 
template<class FT >
void circumcenterC3 (const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, const FT &rx, const FT &ry, const FT &rz, const FT &sx, const FT &sy, const FT &sz, FT &x, FT &y, FT &z)
 
template<class FT >
void circumcenterC3 (const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, const FT &sx, const FT &sy, const FT &sz, FT &x, FT &y, FT &z)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void point_on_lineC3 (const FT &lpx, const FT &lpy, const FT &lpz, const FT &ldx, const FT &ldy, const FT &ldz, int i, FT &x, FT &y, FT &z)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void projection_lineC3 (const FT &px, const FT &py, const FT &pz, const FT &lpx, const FT &lpy, const FT &lpz, const FT &ldx, const FT &ldy, const FT &ldz, FT &x, FT &y, FT &z)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void plane_from_pointsC3 (const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz, const FT &rx, const FT &ry, const FT &rz, FT &pa, FT &pb, FT &pc, FT &pd)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void plane_from_point_directionC3 (const FT &px, const FT &py, const FT &pz, const FT &dx, const FT &dy, const FT &dz, FT &pa, FT &pb, FT &pc, FT &pd)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void point_on_planeC3 (const FT &pa, const FT &pb, const FT &pc, const FT &pd, FT &x, FT &y, FT &z)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void projection_planeC3 (const FT &pa, const FT &pb, const FT &pc, const FT &pd, const FT &px, const FT &py, const FT &pz, FT &x, FT &y, FT &z)
 
template<class FT >
CGAL_KERNEL_INLINE FT squared_distanceC3 (const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz)
 
template<class FT >
CGAL_KERNEL_INLINE FT scaled_distance_to_directionC3 (const FT &pa, const FT &pb, const FT &pc, const FT &px, const FT &py, const FT &pz)
 
template<class FT >
CGAL_KERNEL_INLINE FT scaled_distance_to_planeC3 (const FT &pa, const FT &pb, const FT &pc, const FT &pd, const FT &px, const FT &py, const FT &pz)
 
template<class FT >
CGAL_KERNEL_INLINE FT scaled_distance_to_planeC3 (const FT &ppx, const FT &ppy, const FT &ppz, const FT &pqx, const FT &pqy, const FT &pqz, const FT &prx, const FT &pry, const FT &prz, const FT &px, const FT &py, const FT &pz)
 

Function Documentation

void circumcenterC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  qx,
const FT &  qy,
const FT &  qz,
const FT &  rx,
const FT &  ry,
const FT &  rz,
const FT &  sx,
const FT &  sy,
const FT &  sz,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 70 of file constructions/kernel_ftC3.h.

References CGAL_kernel_assertion, CGAL_NTS, den, det3x3_by_formula(), Mesquite::inv(), and square().

Referenced by circumcenter().

75 {
76  // Translate s to origin to simplify the expression.
77  FT psx = px-sx;
78  FT psy = py-sy;
79  FT psz = pz-sz;
80  FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz);
81  FT qsx = qx-sx;
82  FT qsy = qy-sy;
83  FT qsz = qz-sz;
84  FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz);
85  FT rsx = rx-sx;
86  FT rsy = ry-sy;
87  FT rsz = rz-sz;
88  FT rs2 = CGAL_NTS square(rsx) + CGAL_NTS square(rsy) + CGAL_NTS square(rsz);
89 
90  FT num_x = det3x3_by_formula(psy,psz,ps2,
91  qsy,qsz,qs2,
92  rsy,rsz,rs2);
93  FT num_y = det3x3_by_formula(psx,psz,ps2,
94  qsx,qsz,qs2,
95  rsx,rsz,rs2);
96  FT num_z = det3x3_by_formula(psx,psy,ps2,
97  qsx,qsy,qs2,
98  rsx,rsy,rs2);
99  FT den = det3x3_by_formula(psx,psy,psz,
100  qsx,qsy,qsz,
101  rsx,rsy,rsz);
102  CGAL_kernel_assertion( den != FT(0) );
103  FT inv = FT(1)/(FT(2) * den);
104 
105  x = sx + num_x*inv;
106  y = sy - num_y*inv;
107  z = sz + num_z*inv;
108 }
double square(double x)
void int int REAL REAL * y
Definition: read.cpp:74
CGAL_KERNEL_MEDIUM_INLINE FT det3x3_by_formula(const FT &a00, const FT &a01, const FT &a02, const FT &a10, const FT &a11, const FT &a12, const FT &a20, const FT &a21, const FT &a22)
Definition: determinant.h:71
NT & den
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
void inv(Matrix3D &Ainv, const Matrix3D &A)
#define CGAL_NTS
#define CGAL_kernel_assertion(EX)

Here is the call graph for this function:

Here is the caller graph for this function:

void circumcenterC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  qx,
const FT &  qy,
const FT &  qz,
const FT &  sx,
const FT &  sy,
const FT &  sz,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 112 of file constructions/kernel_ftC3.h.

References CGAL_kernel_assertion, CGAL_NTS, den, det3x3_by_formula(), Mesquite::inv(), and square().

116 {
117  // Translate s to origin to simplify the expression.
118  FT psx = px-sx;
119  FT psy = py-sy;
120  FT psz = pz-sz;
121  FT ps2 = CGAL_NTS square(psx) + CGAL_NTS square(psy) + CGAL_NTS square(psz);
122  FT qsx = qx-sx;
123  FT qsy = qy-sy;
124  FT qsz = qz-sz;
125  FT qs2 = CGAL_NTS square(qsx) + CGAL_NTS square(qsy) + CGAL_NTS square(qsz);
126  FT rsx = psy*qsz-psz*qsy;
127  FT rsy = psz*qsx-psx*qsz;
128  FT rsz = psx*qsy-psy*qsx;
129 
130  FT num_x = det3x3_by_formula(psy,psz,ps2,
131  qsy,qsz,qs2,
132  rsy,rsz,FT(0));
133  FT num_y = det3x3_by_formula(psx,psz,ps2,
134  qsx,qsz,qs2,
135  rsx,rsz,FT(0));
136  FT num_z = det3x3_by_formula(psx,psy,ps2,
137  qsx,qsy,qs2,
138  rsx,rsy,FT(0));
139  FT den = det3x3_by_formula(psx,psy,psz,
140  qsx,qsy,qsz,
141  rsx,rsy,rsz);
142  CGAL_kernel_assertion( den != FT(0) );
143  FT inv = FT(1)/(FT(2) * den);
144 
145  x = sx + num_x*inv;
146  y = sy - num_y*inv;
147  z = sz + num_z*inv;
148 }
double square(double x)
void int int REAL REAL * y
Definition: read.cpp:74
CGAL_KERNEL_MEDIUM_INLINE FT det3x3_by_formula(const FT &a00, const FT &a01, const FT &a02, const FT &a10, const FT &a11, const FT &a12, const FT &a20, const FT &a21, const FT &a22)
Definition: determinant.h:71
NT & den
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
void inv(Matrix3D &Ainv, const Matrix3D &A)
#define CGAL_NTS
#define CGAL_kernel_assertion(EX)

Here is the call graph for this function:

CGAL_BEGIN_NAMESPACE CGAL_KERNEL_INLINE void midpointC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  qx,
const FT &  qy,
const FT &  qz,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 58 of file constructions/kernel_ftC3.h.

Referenced by midpoint().

61 {
62  FT half = FT(1) / FT(2);
63  x = (px+qx) * half;
64  y = (py+qy) * half;
65  z = (pz+qz) * half;
66 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

CGAL_KERNEL_MEDIUM_INLINE void plane_from_point_directionC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  dx,
const FT &  dy,
const FT &  dz,
FT &  pa,
FT &  pb,
FT &  pc,
FT &  pd 
)

Definition at line 205 of file constructions/kernel_ftC3.h.

References dx, and dy.

208 {
209  // d is the normal direction
210  pa = dx; pb = dy; pc = dz; pd = -dx*px - dy*py - dz*pz;
211 }
NT dx
NT dy
CGAL_KERNEL_MEDIUM_INLINE void plane_from_pointsC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  qx,
const FT &  qy,
const FT &  qz,
const FT &  rx,
const FT &  ry,
const FT &  rz,
FT &  pa,
FT &  pb,
FT &  pc,
FT &  pd 
)

Definition at line 184 of file constructions/kernel_ftC3.h.

188 {
189  FT rpx = px-rx;
190  FT rpy = py-ry;
191  FT rpz = pz-rz;
192  FT rqx = qx-rx;
193  FT rqy = qy-ry;
194  FT rqz = qz-rz;
195  // Cross product rp * rq
196  pa = rpy*rqz - rqy*rpz;
197  pb = rpz*rqx - rqz*rpx;
198  pc = rpx*rqy - rqx*rpy;
199  pd = - pa*rx - pb*ry - pc*rz;
200 }
CGAL_KERNEL_MEDIUM_INLINE void point_on_lineC3 ( const FT &  lpx,
const FT &  lpy,
const FT &  lpz,
const FT &  ldx,
const FT &  ldy,
const FT &  ldz,
int  i,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 153 of file constructions/kernel_ftC3.h.

157 {
158  x = lpx + ldx*FT(i);
159  y = lpy + ldy*FT(i);
160  z = lpz + ldz*FT(i);
161 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
CGAL_KERNEL_MEDIUM_INLINE void point_on_planeC3 ( const FT &  pa,
const FT &  pb,
const FT &  pc,
const FT &  pd,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 216 of file constructions/kernel_ftC3.h.

218 {
219  x = y = z = FT(0);
220  if (pa != FT(0)) x = -pd/pa;
221  else if (pb != FT(0)) y = -pd/pb;
222  else z = -pd/pc;
223 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
CGAL_KERNEL_MEDIUM_INLINE void projection_lineC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  lpx,
const FT &  lpy,
const FT &  lpz,
const FT &  ldx,
const FT &  ldy,
const FT &  ldz,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 166 of file constructions/kernel_ftC3.h.

170 {
171  // projects p on the line l
172  FT dpx = px-lpx;
173  FT dpy = py-lpy;
174  FT dpz = pz-lpz;
175  FT lambda = (ldx*dpx+ldy*dpy+ldz*dpz) / (ldx*ldx+ldy*ldy+ldz*ldz);
176  x = lpx + lambda * ldx;
177  y = lpy + lambda * ldy;
178  z = lpz + lambda * ldz;
179 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74
CGAL_KERNEL_MEDIUM_INLINE void projection_planeC3 ( const FT &  pa,
const FT &  pb,
const FT &  pc,
const FT &  pd,
const FT &  px,
const FT &  py,
const FT &  pz,
FT &  x,
FT &  y,
FT &  z 
)

Definition at line 228 of file constructions/kernel_ftC3.h.

References den.

Referenced by projection().

231 {
232  // the equation of the plane is Ax+By+Cz+D=0
233  // the normal direction is (A,B,C)
234  // the projected point is p-lambda(A,B,C) where
235  // A(x-lambda A) + B(y-lambda B) + C(z-lambda C) + D = 0
236 
237  FT num = pa*px + pb*py + pc*pz + pd;
238  FT den = pa*pa + pb*pb + pc*pc;
239  FT lambda = num / den;
240 
241  x = px - lambda * pa;
242  y = py - lambda * pb;
243  z = pz - lambda * pc;
244 }
void int int REAL REAL * y
Definition: read.cpp:74
NT & den
void int int int REAL REAL REAL * z
Definition: write.cpp:76
void int int REAL * x
Definition: read.cpp:74

Here is the caller graph for this function:

CGAL_KERNEL_INLINE FT scaled_distance_to_directionC3 ( const FT &  pa,
const FT &  pb,
const FT &  pc,
const FT &  px,
const FT &  py,
const FT &  pz 
)

Definition at line 259 of file constructions/kernel_ftC3.h.

Referenced by cmp_signed_dist_to_directionC3().

261 {
262  return pa*px + pb*py + pc*pz;
263 }

Here is the caller graph for this function:

CGAL_KERNEL_INLINE FT scaled_distance_to_planeC3 ( const FT &  pa,
const FT &  pb,
const FT &  pc,
const FT &  pd,
const FT &  px,
const FT &  py,
const FT &  pz 
)

Definition at line 268 of file constructions/kernel_ftC3.h.

Referenced by scaled_distance_to_plane().

271 {
272  return pa*px + pb*py + pc*pz + pd;
273 }

Here is the caller graph for this function:

CGAL_KERNEL_INLINE FT scaled_distance_to_planeC3 ( const FT &  ppx,
const FT &  ppy,
const FT &  ppz,
const FT &  pqx,
const FT &  pqy,
const FT &  pqz,
const FT &  prx,
const FT &  pry,
const FT &  prz,
const FT &  px,
const FT &  py,
const FT &  pz 
)

Definition at line 278 of file constructions/kernel_ftC3.h.

References det3x3_by_formula().

283 {
284  return det3x3_by_formula(ppx-px,ppy-py,ppz-pz,
285  pqx-px,pqy-py,pqz-pz,
286  prx-px,pry-py,prz-pz);
287 }
CGAL_KERNEL_MEDIUM_INLINE FT det3x3_by_formula(const FT &a00, const FT &a01, const FT &a02, const FT &a10, const FT &a11, const FT &a12, const FT &a20, const FT &a21, const FT &a22)
Definition: determinant.h:71

Here is the call graph for this function:

CGAL_KERNEL_INLINE FT squared_distanceC3 ( const FT &  px,
const FT &  py,
const FT &  pz,
const FT &  qx,
const FT &  qy,
const FT &  qz 
)

Definition at line 249 of file constructions/kernel_ftC3.h.

References CGAL_NTS, and square().

Referenced by cmp_dist_to_pointC3(), and squared_distance().

251 {
252  return CGAL_NTS square(px-qx) + CGAL_NTS square(py-qy) +
253  CGAL_NTS square(pz-qz);
254 }
double square(double x)
#define CGAL_NTS

Here is the call graph for this function:

Here is the caller graph for this function: