Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
constructions/kernel_ftC2.h File Reference
#include <CGAL/determinant.h>
Include dependency graph for constructions/kernel_ftC2.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 
midpointC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, FT &x, FT &y)
 
template<class FT >
CGAL_KERNEL_LARGE_INLINE void circumcenter_translateC2 (const FT &dqx, const FT &dqy, const FT &drx, const FT &dry, FT &dcx, FT &dcy)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void circumcenterC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry, FT &x, FT &y)
 
template<class FT >
void line_from_pointsC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, FT &a, FT &b, FT &c)
 
template<class FT >
void line_from_point_directionC2 (const FT &px, const FT &py, const FT &dx, const FT &dy, FT &a, FT &b, FT &c)
 
template<class FT >
CGAL_KERNEL_INLINE void bisector_of_pointsC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, FT &a, FT &b, FT &c)
 
template<class FT >
FT line_y_at_xC2 (const FT &a, const FT &b, const FT &c, const FT &x)
 
template<class FT >
void line_get_pointC2 (const FT &a, const FT &b, const FT &c, int i, FT &x, FT &y)
 
template<class FT >
void perpendicular_through_pointC2 (const FT &la, const FT &lb, const FT &px, const FT &py, FT &a, FT &b, FT &c)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE void line_project_pointC2 (const FT &la, const FT &lb, const FT &lc, const FT &px, const FT &py, FT &x, FT &y)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE FT squared_circumradiusC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry, FT &x, FT &y)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE FT squared_circumradiusC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry)
 
template<class FT >
CGAL_KERNEL_INLINE FT squared_distanceC2 (const FT &px, const FT &py, const FT &qx, const FT &qy)
 
template<class FT >
CGAL_KERNEL_INLINE FT scaled_distance_to_lineC2 (const FT &la, const FT &lb, const FT &lc, const FT &px, const FT &py)
 
template<class FT >
CGAL_KERNEL_INLINE FT scaled_distance_to_directionC2 (const FT &la, const FT &lb, const FT &px, const FT &py)
 
template<class FT >
CGAL_KERNEL_MEDIUM_INLINE FT scaled_distance_to_lineC2 (const FT &px, const FT &py, const FT &qx, const FT &qy, const FT &rx, const FT &ry)
 

Function Documentation

CGAL_KERNEL_INLINE void bisector_of_pointsC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
FT &  a,
FT &  b,
FT &  c 
)

Definition at line 134 of file constructions/kernel_ftC2.h.

References CGAL_NTS, and square().

137 {
138  a = FT(2)*(px - qx);
139  b = FT(2)*(py - qy);
140  c = CGAL_NTS square(qx) + CGAL_NTS square(qy) -
141  CGAL_NTS square(px) - CGAL_NTS square(py);
142 }
double square(double x)
#define CGAL_NTS

Here is the call graph for this function:

CGAL_KERNEL_LARGE_INLINE void circumcenter_translateC2 ( const FT &  dqx,
const FT &  dqy,
const FT &  drx,
const FT &  dry,
FT &  dcx,
FT &  dcy 
)

Definition at line 69 of file constructions/kernel_ftC2.h.

References CGAL_kernel_assertion, CGAL_NTS, den, det2x2_by_formula(), and square().

Referenced by circumcenterC2(), and squared_circumradiusC2().

72 {
73  // Given 3 points P, Q, R, this function takes as input:
74  // qx-px, qy-py, rx-px, ry-py. And returns cx-px, cy-py,
75  // where (cx, cy) are the coordinates of the circumcenter C.
76 
77  // What we do is intersect the bisectors.
78  FT r2 = CGAL_NTS square(drx) + CGAL_NTS square(dry);
79  FT q2 = CGAL_NTS square(dqx) + CGAL_NTS square(dqy);
80  FT den = FT(2) * det2x2_by_formula(dqx, dqy, drx, dry);
81 
82  // The 3 points aren't collinear.
83  // Hopefully, this is already checked at the upper level.
84  CGAL_kernel_assertion ( den != FT(0) );
85 
86  // One possible optimization here is to precompute 1/den, to avoid one
87  // division. However, we loose precision, and it's maybe not worth it (?).
88  dcx = det2x2_by_formula (dry, dqy, r2, q2) / den;
89  dcy = - det2x2_by_formula (drx, dqx, r2, q2) / den;
90 }
double square(double x)
CGAL_BEGIN_NAMESPACE FT det2x2_by_formula(const FT &a00, const FT &a01, const FT &a10, const FT &a11)
Definition: determinant.h:59
NT & den
#define CGAL_NTS
#define CGAL_kernel_assertion(EX)

Here is the call graph for this function:

Here is the caller graph for this function:

CGAL_KERNEL_MEDIUM_INLINE void circumcenterC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
const FT &  rx,
const FT &  ry,
FT &  x,
FT &  y 
)

Definition at line 95 of file constructions/kernel_ftC2.h.

References circumcenter_translateC2().

99 {
100  circumcenter_translateC2(qx-px, qy-py, rx-px, ry-py, x, y);
101  x += px;
102  y += py;
103 }
void int int REAL REAL * y
Definition: read.cpp:74
CGAL_KERNEL_LARGE_INLINE void circumcenter_translateC2(const FT &dqx, const FT &dqy, const FT &drx, const FT &dry, FT &dcx, FT &dcy)
void int int REAL * x
Definition: read.cpp:74

Here is the call graph for this function:

void line_from_point_directionC2 ( const FT &  px,
const FT &  py,
const FT &  dx,
const FT &  dy,
FT &  a,
FT &  b,
FT &  c 
)
inline

Definition at line 122 of file constructions/kernel_ftC2.h.

References dx, and dy.

125 {
126  a = - dy;
127  b = dx;
128  c = px*dy - py*dx;
129 }
NT dx
NT dy
void line_from_pointsC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
FT &  a,
FT &  b,
FT &  c 
)
inline

Definition at line 108 of file constructions/kernel_ftC2.h.

111 {
112  a = py - qy;
113  b = qx - px;
114  // Suggested by Serge Pashkov (psw@rt.kiam.ru) for better numeric stability.
115  c = -px*a - py*b;
116  // c = px*qy - py*qx;
117 }
void line_get_pointC2 ( const FT &  a,
const FT &  b,
const FT &  c,
int  i,
FT &  x,
FT &  y 
)
inline

Definition at line 155 of file constructions/kernel_ftC2.h.

157 {
158  if (b==FT(0))
159  {
160  x = (-b-c)/a + FT(i)*b;
161  y = FT(1) - FT(i)*a;
162  }
163  else
164  {
165  x = FT(1) + FT(i)*b;
166  y = -(a+c)/b - FT(i)*a;
167  }
168 }
void int int REAL REAL * y
Definition: read.cpp:74
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
CGAL_KERNEL_MEDIUM_INLINE void line_project_pointC2 ( const FT &  la,
const FT &  lb,
const FT &  lc,
const FT &  px,
const FT &  py,
FT &  x,
FT &  y 
)

Definition at line 185 of file constructions/kernel_ftC2.h.

References CGAL_NTS, d, and square().

188 {
189 #if 1
190  // Original old version
191  if (la==FT(0)) // horizontal line
192  {
193  x = px;
194  y = -lc/lb;
195  }
196  else if (lb==FT(0)) // vertical line
197  {
198  x = -lc/la;
199  y = py;
200  }
201  else
202  {
203  FT ab = la/lb, ba = lb/la, ca = lc/la;
204  y = ( -px + ab*py - ca ) / ( ba + ab );
205  x = -ba * y - ca;
206  }
207 #else
208  // New version, with more multiplications, but less divisions and tests.
209  // Let's compare the results of the 2, benchmark them, as well as check
210  // the precision with the intervals.
211  FT a2 = CGAL_NTS square(la);
212  FT b2 = CGAL_NTS square(lb);
213  FT d = a2 + b2;
214  x = (la * (lb * py - lc) - px * b2) / d;
215  y = (lb * (lc - la * px) + py * a2) / d;
216 #endif
217 }
double square(double x)
const NT & d
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74
#define CGAL_NTS

Here is the call graph for this function:

FT line_y_at_xC2 ( const FT &  a,
const FT &  b,
const FT &  c,
const FT &  x 
)
inline

Definition at line 147 of file constructions/kernel_ftC2.h.

148 {
149  return (-a*x-c) / b;
150 }
void int int REAL * x
Definition: read.cpp:74
CGAL_BEGIN_NAMESPACE CGAL_KERNEL_INLINE void midpointC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
FT &  x,
FT &  y 
)

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

61 {
62  x = (px+qx) / FT(2);
63  y = (py+qy) / FT(2);
64 }
void int int REAL REAL * y
Definition: read.cpp:74
void int int REAL * x
Definition: read.cpp:74
void perpendicular_through_pointC2 ( const FT &  la,
const FT &  lb,
const FT &  px,
const FT &  py,
FT &  a,
FT &  b,
FT &  c 
)
inline

Definition at line 173 of file constructions/kernel_ftC2.h.

176 {
177  a = -lb;
178  b = la;
179  c = lb * px - la * py;
180 }
CGAL_KERNEL_INLINE FT scaled_distance_to_directionC2 ( const FT &  la,
const FT &  lb,
const FT &  px,
const FT &  py 
)

Definition at line 269 of file constructions/kernel_ftC2.h.

Referenced by cmp_signed_dist_to_directionC2().

271 {
272  // scalar product with direction
273  return la*px + lb*py;
274 }

Here is the caller graph for this function:

CGAL_KERNEL_INLINE FT scaled_distance_to_lineC2 ( const FT &  la,
const FT &  lb,
const FT &  lc,
const FT &  px,
const FT &  py 
)

Definition at line 258 of file constructions/kernel_ftC2.h.

Referenced by cmp_signed_dist_to_lineC2().

260 {
261  // for comparisons, use distance_to_directionsC2 instead
262  // since lc is irrelevant
263  return la*px + lb*py + lc;
264 }

Here is the caller graph for this function:

CGAL_KERNEL_MEDIUM_INLINE FT scaled_distance_to_lineC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
const FT &  rx,
const FT &  ry 
)

Definition at line 279 of file constructions/kernel_ftC2.h.

References det2x2_by_formula().

282 {
283  return det2x2_by_formula(px-rx,py-ry,qx-rx,qy-ry);
284 }
CGAL_BEGIN_NAMESPACE FT det2x2_by_formula(const FT &a00, const FT &a01, const FT &a10, const FT &a11)
Definition: determinant.h:59

Here is the call graph for this function:

CGAL_KERNEL_MEDIUM_INLINE FT squared_circumradiusC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
const FT &  rx,
const FT &  ry,
FT &  x,
FT &  y 
)

Definition at line 222 of file constructions/kernel_ftC2.h.

References CGAL_NTS, circumcenter_translateC2(), and square().

226 {
227  circumcenter_translateC2(qx-px, qy-py, rx-px, ry-py, x, y);
228  FT r2 = CGAL_NTS square(x) + CGAL_NTS square(y);
229  x += px;
230  y += py;
231  return r2;
232 }
double square(double x)
void int int REAL REAL * y
Definition: read.cpp:74
CGAL_KERNEL_LARGE_INLINE void circumcenter_translateC2(const FT &dqx, const FT &dqy, const FT &drx, const FT &dry, FT &dcx, FT &dcy)
void int int REAL * x
Definition: read.cpp:74
#define CGAL_NTS

Here is the call graph for this function:

CGAL_KERNEL_MEDIUM_INLINE FT squared_circumradiusC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy,
const FT &  rx,
const FT &  ry 
)

Definition at line 237 of file constructions/kernel_ftC2.h.

References CGAL_NTS, circumcenter_translateC2(), square(), x, and y.

240 {
241  FT x, y;
242  circumcenter_translateC2(qx-px, qy-py, rx-px, ry-py, x, y);
243  return CGAL_NTS square(x) + CGAL_NTS square(y);
244 }
double square(double x)
void int int REAL REAL * y
Definition: read.cpp:74
CGAL_KERNEL_LARGE_INLINE void circumcenter_translateC2(const FT &dqx, const FT &dqy, const FT &drx, const FT &dry, FT &dcx, FT &dcy)
void int int REAL * x
Definition: read.cpp:74
#define CGAL_NTS

Here is the call graph for this function:

CGAL_KERNEL_INLINE FT squared_distanceC2 ( const FT &  px,
const FT &  py,
const FT &  qx,
const FT &  qy 
)

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

References CGAL_NTS, and square().

Referenced by cmp_dist_to_pointC2().

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

Here is the call graph for this function:

Here is the caller graph for this function: