Improved readability of weighted point-related functors (no real changes)

Fixed indentation, trailing whitespace, english, etc.
This commit is contained in:
Mael Rouxel-Labbé 2017-04-19 11:40:58 +02:00
parent 046058fabe
commit 1223f5f5a0
4 changed files with 544 additions and 618 deletions

View File

@ -418,12 +418,11 @@ scaled_distance_to_lineC2( const FT &px, const FT &py,
return determinant<FT>(px-rx, py-ry, qx-rx, qy-ry); return determinant<FT>(px-rx, py-ry, qx-rx, qy-ry);
} }
template < class RT > template < class RT >
void void
weighted_circumcenter_translateC2(const RT &dqx, const RT &dqy, const RT &dqw, weighted_circumcenter_translateC2(const RT &dqx, const RT &dqy, const RT &dqw,
const RT &drx, const RT &dry, const RT &drw, const RT &drx, const RT &dry, const RT &drw,
RT &dcx, RT &dcy) RT &dcx, RT &dcy)
{ {
// Given 3 points P, Q, R, this function takes as input: // Given 3 points P, Q, R, this function takes as input:
// qx-px, qy-py,qw-pw, rx-px, ry-py, rw-pw. And returns cx-px, cy-py, // qx-px, qy-py,qw-pw, rx-px, ry-py, rw-pw. And returns cx-px, cy-py,
@ -449,30 +448,29 @@ weighted_circumcenter_translateC2(const RT &dqx, const RT &dqy, const RT &dqw,
template < class RT, class We> template < class RT, class We>
void void
weighted_circumcenterC2( const RT &px, const RT &py, const We &pw, weighted_circumcenterC2( const RT &px, const RT &py, const We &pw,
const RT &qx, const RT &qy, const We &qw, const RT &qx, const RT &qy, const We &qw,
const RT &rx, const RT &ry, const We &rw, const RT &rx, const RT &ry, const We &rw,
RT &x, RT &y ) RT &x, RT &y )
{ {
RT dqw = RT(qw-pw); RT dqw = RT(qw-pw);
RT drw = RT(rw-pw); RT drw = RT(rw-pw);
weighted_circumcenter_translateC2(qx-px, qy-py, dqw,rx-px, ry-py,drw,x, y); weighted_circumcenter_translateC2(qx-px, qy-py, dqw,rx-px, ry-py,drw,x, y);
x += px; x += px;
y += py; y += py;
} }
template < class RT , class We> template < class RT , class We>
void void
radical_axisC2(const RT &px, const RT &py, const We &pw, radical_axisC2(const RT &px, const RT &py, const We &pw,
const RT &qx, const RT &qy, const We &qw, const RT &qx, const RT &qy, const We &qw,
RT &a, RT &b, RT& c ) RT &a, RT &b, RT& c )
{ {
a = RT(2)*(px - qx); a = RT(2)*(px - qx);
b = RT(2)*(py - qy); b = RT(2)*(py - qy);
c = - CGAL_NTS square(px) - CGAL_NTS square(py) c = - CGAL_NTS square(px) - CGAL_NTS square(py)
+ CGAL_NTS square(qx) + CGAL_NTS square(qy) + CGAL_NTS square(qx) + CGAL_NTS square(qy)
+RT(pw) - RT(qw); + RT(pw) - RT(qw);
} }
template< class FT > template< class FT >

View File

@ -1,4 +1,4 @@
// Copyright (c) 2000 // Copyright (c) 2000
// Utrecht University (The Netherlands), // Utrecht University (The Netherlands),
// ETH Zurich (Switzerland), // ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France), // INRIA Sophia-Antipolis (France),
@ -403,113 +403,109 @@ squared_areaC3(const FT &px, const FT &py, const FT &pz,
return (CGAL_NTS square(vx) + CGAL_NTS square(vy) + CGAL_NTS square(vz))/4; return (CGAL_NTS square(vx) + CGAL_NTS square(vy) + CGAL_NTS square(vz))/4;
} }
template <class FT> template <class FT>
void void
determinants_for_weighted_circumcenterC3( determinants_for_weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw, const FT &sx, const FT &sy, const FT &sz, const FT &sw,
FT &num_x, FT &num_y, FT &num_z, FT& den) FT &num_x, FT &num_y, FT &num_z, FT& den)
{ {
// translate origin to p // translate origin to p
// and compute determinants for weighted_circumcenter and // and compute determinants for weighted_circumcenter and
// circumradius // circumradius
FT qpx = qx-px; FT qpx = qx - px;
FT qpy = qy-py; FT qpy = qy - py;
FT qpz = qz-pz; FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz) - qw + pw; CGAL_NTS square(qpz) - qw + pw;
FT rpx = rx-px; FT rpx = rx - px;
FT rpy = ry-py; FT rpy = ry - py;
FT rpz = rz-pz; FT rpz = rz - pz;
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
CGAL_NTS square(rpz) - rw + pw; CGAL_NTS square(rpz) - rw + pw;
FT spx = sx-px; FT spx = sx - px;
FT spy = sy-py; FT spy = sy - py;
FT spz = sz-pz; FT spz = sz - pz;
FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) + FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) +
CGAL_NTS square(spz) - sw + pw; CGAL_NTS square(spz) - sw + pw;
num_x = determinant(qpy,qpz,qp2, num_x = determinant(qpy,qpz,qp2,
rpy,rpz,rp2, rpy,rpz,rp2,
spy,spz,sp2); spy,spz,sp2);
num_y = determinant(qpx,qpz,qp2, num_y = determinant(qpx,qpz,qp2,
rpx,rpz,rp2, rpx,rpz,rp2,
spx,spz,sp2); spx,spz,sp2);
num_z = determinant(qpx,qpy,qp2, num_z = determinant(qpx,qpy,qp2,
rpx,rpy,rp2, rpx,rpy,rp2,
spx,spy,sp2); spx,spy,sp2);
den = determinant(qpx,qpy,qpz, den = determinant(qpx,qpy,qpz,
rpx,rpy,rpz, rpx,rpy,rpz,
spx,spy,spz); spx,spy,spz);
} }
template <class FT> template <class FT>
void void
determinants_for_circumcenterC3( determinants_for_circumcenterC3(const FT &px, const FT &py, const FT &pz,
const FT &px, const FT &py, const FT &pz, const FT &qx, const FT &qy, const FT &qz,
const FT &qx, const FT &qy, const FT &qz, const FT &rx, const FT &ry, const FT &rz,
const FT &rx, const FT &ry, const FT &rz, const FT &sx, const FT &sy, const FT &sz,
const FT &sx, const FT &sy, const FT &sz, FT &num_x, FT &num_y, FT &num_z, FT& den)
FT &num_x, FT &num_y, FT &num_z, FT& den)
{ {
// translate origin to p // translate origin to p
// and compute determinants for weighted_circumcenter and // and compute determinants for weighted_circumcenter and
// circumradius // circumradius
FT qpx = qx-px; FT qpx = qx - px;
FT qpy = qy-py; FT qpy = qy - py;
FT qpz = qz-pz; FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz); CGAL_NTS square(qpz);
FT rpx = rx-px; FT rpx = rx - px;
FT rpy = ry-py; FT rpy = ry - py;
FT rpz = rz-pz; FT rpz = rz - pz;
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
CGAL_NTS square(rpz); CGAL_NTS square(rpz);
FT spx = sx-px; FT spx = sx - px;
FT spy = sy-py; FT spy = sy - py;
FT spz = sz-pz; FT spz = sz - pz;
FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) + FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) +
CGAL_NTS square(spz); CGAL_NTS square(spz);
num_x = determinant(qpy,qpz,qp2, num_x = determinant(qpy,qpz,qp2,
rpy,rpz,rp2, rpy,rpz,rp2,
spy,spz,sp2); spy,spz,sp2);
num_y = determinant(qpx,qpz,qp2, num_y = determinant(qpx,qpz,qp2,
rpx,rpz,rp2, rpx,rpz,rp2,
spx,spz,sp2); spx,spz,sp2);
num_z = determinant(qpx,qpy,qp2, num_z = determinant(qpx,qpy,qp2,
rpx,rpy,rp2, rpx,rpy,rp2,
spx,spy,sp2); spx,spy,sp2);
den = determinant(qpx,qpy,qpz, den = determinant(qpx,qpy,qpz,
rpx,rpy,rpz, rpx,rpy,rpz,
spx,spy,spz); spx,spy,spz);
} }
template < class FT> template < class FT>
void void
weighted_circumcenterC3( weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw, FT &x, FT &y, FT &z)
FT &x, FT &y, FT &z)
{ {
// this function compute the weighted circumcenter point only // this function computes the weighted circumcenter point only
// Translate p to origin and compute determinants // Translate p to origin and compute determinants
FT num_x, num_y, num_z, den; FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw, determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
sx, sy, sz, sw, sx, sy, sz, sw,
num_x, num_y, num_z,den); num_x, num_y, num_z,den);
CGAL_assertion( ! CGAL_NTS is_zero(den) ); CGAL_assertion( ! CGAL_NTS is_zero(den) );
FT inv = FT(1)/(FT(2) * den); FT inv = FT(1)/(FT(2) * den);
x = px + num_x*inv; x = px + num_x*inv;
y = py - num_y*inv; y = py - num_y*inv;
@ -518,248 +514,231 @@ weighted_circumcenterC3(
template < class FT> template < class FT>
void void
weighted_circumcenterC3( weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw, FT &x, FT &y, FT &z, FT &w)
FT &x, FT &y, FT &z, FT &w)
{ {
// this function compute the weighted circumcenter point // this function computes the weighted circumcenter point
// and the squared weighted circumradius // and the squared weighted circumradius
// Translate p to origin and compute determinants // Translate p to origin and compute determinants
FT num_x, num_y, num_z, den; FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw, determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
sx, sy, sz, sw, sx, sy, sz, sw,
num_x, num_y, num_z, den); num_x, num_y, num_z, den);
CGAL_assertion( ! CGAL_NTS is_zero(den) ); CGAL_assertion( ! CGAL_NTS is_zero(den) );
FT inv = FT(1)/(FT(2) * den); FT inv = FT(1)/(FT(2) * den);
x = px + num_x*inv; x = px + num_x*inv;
y = py - num_y*inv; y = py - num_y*inv;
z = pz + num_z*inv; z = pz + num_z*inv;
w = (CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z)) w = (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw; * CGAL_NTS square(inv) - pw;
} }
template< class FT > template< class FT >
FT FT
squared_radius_orthogonal_sphereC3( squared_radius_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw) const FT &sx, const FT &sy, const FT &sz, const FT &sw)
{ {
// this function computes the squared weighted circumradius only
// this function compute the squared weighted circumradius only
// Translate p to origin and compute determinants // Translate p to origin and compute determinants
FT num_x, num_y, num_z, den; FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw, determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
sx, sy, sz, sw, sx, sy, sz, sw,
num_x, num_y, num_z,den); num_x, num_y, num_z,den);
CGAL_assertion( ! CGAL_NTS is_zero(den) ); CGAL_assertion( ! CGAL_NTS is_zero(den) );
FT inv = FT(1)/(FT(2) * den); FT inv = FT(1)/(FT(2) * den);
return return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
(CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z)) * CGAL_NTS square(inv) - pw;
*CGAL_NTS square(inv) - pw;
} }
template <class FT> template <class FT>
void void
determinants_for_weighted_circumcenterC3( determinants_for_weighted_circumcenterC3(
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
FT &num_x, FT &num_y, FT &num_z, FT &den) FT &num_x, FT &num_y, FT &num_z, FT &den)
{ {
// translate origin to p // translate origin to p and compute determinants for weighted_circumcenter
// and compute determinants for weighted_circumcenter and // and circumradius
// circumradius
// Translate s to origin to simplify the expression. // Translate s to origin to simplify the expression.
FT qpx = qx-px; FT qpx = qx - px;
FT qpy = qy-py; FT qpy = qy - py;
FT qpz = qz-pz; FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz) - qw + pw; CGAL_NTS square(qpz) - qw + pw;
FT rpx = rx-px; FT rpx = rx - px;
FT rpy = ry-py; FT rpy = ry - py;
FT rpz = rz-pz; FT rpz = rz - pz;
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
CGAL_NTS square(rpz) - rw + pw; CGAL_NTS square(rpz) - rw + pw;
FT sx = qpy*rpz-qpz*rpy; FT sx = qpy*rpz - qpz*rpy;
FT sy = qpz*rpx-qpx*rpz; FT sy = qpz*rpx - qpx*rpz;
FT sz = qpx*rpy-qpy*rpx; FT sz = qpx*rpy - qpy*rpx;
// The following determinants can be developped and simplified. // The following determinants can be developped and simplified.
// //
// FT num_x = determinant(qpy,qpz,qp2, // FT num_x = determinant(qpy,qpz,qp2,
// rpy,rpz,rp2, // rpy,rpz,rp2,
// sy,sz,FT(0)); // sy,sz,FT(0));
// FT num_y = determinant(qpx,qpz,qp2, // FT num_y = determinant(qpx,qpz,qp2,
// rpx,rpz,rp2, // rpx,rpz,rp2,
// sx,sz,FT(0)); // sx,sz,FT(0));
// FT num_z = determinant(qpx,qpy,qp2, // FT num_z = determinant(qpx,qpy,qp2,
// rpx,rpy,rp2, // rpx,rpy,rp2,
// sx,sy,FT(0)); // sx,sy,FT(0));
num_x = qp2 * determinant(rpy,rpz,sy,sz) num_x = qp2 * determinant(rpy,rpz,sy,sz)
- rp2 * determinant(qpy,qpz,sy,sz); - rp2 * determinant(qpy,qpz,sy,sz);
num_y = qp2 * determinant(rpx,rpz,sx,sz) num_y = qp2 * determinant(rpx,rpz,sx,sz)
- rp2 * determinant(qpx,qpz,sx,sz); - rp2 * determinant(qpx,qpz,sx,sz);
num_z = qp2 * determinant(rpx,rpy,sx,sy) num_z = qp2 * determinant(rpx,rpy,sx,sy)
- rp2 * determinant(qpx,qpy,sx,sy); - rp2 * determinant(qpx,qpy,sx,sy);
den = determinant(qpx,qpy,qpz, den = determinant(qpx,qpy,qpz,
rpx,rpy,rpz, rpx,rpy,rpz,
sx,sy,sz); sx,sy,sz);
} }
template < class FT > template < class FT >
void void
weighted_circumcenterC3( weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, FT &x, FT &y, FT &z)
FT &x, FT &y, FT &z)
{ {
// this function compute the weighted circumcenter point only // this function computes the weighted circumcenter point only
// Translate p to origin and compute determinants // Translate p to origin and compute determinants
FT num_x, num_y, num_z, den; FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw, determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
num_x, num_y, num_z, den); num_x, num_y, num_z, den);
CGAL_assertion( den != FT(0) ); CGAL_assertion( den != FT(0) );
FT inv = FT(1)/(FT(2) * den); FT inv = FT(1) / (FT(2) * den);
x = px + num_x*inv; x = px + num_x*inv;
y = py - num_y*inv; y = py - num_y*inv;
z = pz + num_z*inv; z = pz + num_z*inv;
} }
template < class FT > template < class FT >
void void
weighted_circumcenterC3( weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, FT &x, FT &y, FT &z, FT &w)
FT &x, FT &y, FT &z, FT &w)
{ {
// this function compute the weighted circumcenter and // this function computes the weighted circumcenter and
// the weighted squared circumradius // the weighted squared circumradius
// Translate p to origin and compute determinants // Translate p to origin and compute determinants
FT num_x, num_y, num_z, den; FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw, determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
num_x, num_y, num_z, den); num_x, num_y, num_z, den);
CGAL_assertion( den != FT(0) ); CGAL_assertion( den != FT(0) );
FT inv = FT(1)/(FT(2) * den); FT inv = FT(1) / (FT(2) * den);
x = px + num_x*inv; x = px + num_x*inv;
y = py - num_y*inv; y = py - num_y*inv;
z = pz + num_z*inv; z = pz + num_z*inv;
w = (CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z)) w = (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
*CGAL_NTS square(inv) - pw; *CGAL_NTS square(inv) - pw;
} }
template< class FT > template< class FT >
CGAL_MEDIUM_INLINE CGAL_MEDIUM_INLINE
FT FT
squared_radius_smallest_orthogonal_sphereC3( squared_radius_smallest_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw) const FT &rx, const FT &ry, const FT &rz, const FT &rw)
{ {
// this function compute the weighted squared circumradius only // this function computes the weighted squared circumradius only
// Translate p to origin and compute determinants // Translate p to origin and compute determinants
FT num_x, num_y, num_z, den; FT num_x, num_y, num_z, den;
determinants_for_weighted_circumcenterC3(px, py, pz, pw, determinants_for_weighted_circumcenterC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
num_x, num_y, num_z, den); num_x, num_y, num_z, den);
CGAL_assertion( den != FT(0) ); CGAL_assertion( den != FT(0) );
FT inv = FT(1)/(FT(2) * den); FT inv = FT(1)/(FT(2) * den);
return return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z))
(CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z)) * CGAL_NTS square(inv) - pw;
*CGAL_NTS square(inv) - pw;
} }
template < class FT > template < class FT >
void void
weighted_circumcenterC3( weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, FT &x, FT &y, FT &z)
FT &x, FT &y, FT &z)
{ {
// this function compute the weighted circumcenter point only // this function computes the weighted circumcenter point only
FT qpx = qx-px; FT qpx = qx - px;
FT qpy = qy-py; FT qpy = qy - py;
FT qpz = qz-pz; FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz); CGAL_NTS square(qpz);
FT inv = FT(1)/(FT(2)*qp2); FT inv = FT(1) / (FT(2) * qp2);
FT alpha = 1/FT(2) + (pw-qw)*inv; FT alpha = 1 / FT(2) + (pw-qw) * inv;
x = px + alpha * qpx; x = px + alpha * qpx;
y = py + alpha * qpy; y = py + alpha * qpy;
z = pz + alpha * qpz; z = pz + alpha * qpz;
} }
template < class FT > template < class FT >
void void
weighted_circumcenterC3( weighted_circumcenterC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, FT &x, FT &y, FT &z, FT &w)
FT &x, FT &y, FT &z, FT &w)
{ {
// this function compute the weighted circumcenter point and // this function computes the weighted circumcenter point and
// the weighted circumradius // the weighted circumradius
FT qpx = qx-px; FT qpx = qx - px;
FT qpy = qy-py; FT qpy = qy - py;
FT qpz = qz-pz; FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz); CGAL_NTS square(qpz);
FT inv = FT(1)/(FT(2)*qp2); FT inv = FT(1) / (FT(2) * qp2);
FT alpha = 1/FT(2) + (pw-qw)*inv; FT alpha = 1 / FT(2) + (pw-qw) * inv;
x = px + alpha * qpx; x = px + alpha * qpx;
y = py + alpha * qpy; y = py + alpha * qpy;
z = pz + alpha * qpz; z = pz + alpha * qpz;
w = CGAL_NTS square(alpha)*qp2 - pw; w = CGAL_NTS square(alpha) * qp2 - pw;
} }
template< class FT > template< class FT >
CGAL_MEDIUM_INLINE CGAL_MEDIUM_INLINE
FT FT
@ -767,30 +746,27 @@ squared_radius_smallest_orthogonal_sphereC3(
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw) const FT &qx, const FT &qy, const FT &qz, const FT &qw)
{ {
// this function computes // this function computes the weighted circumradius only
// the weighted circumradius only FT qpx = qx - px;
FT qpx = qx-px; FT qpy = qy - py;
FT qpy = qy-py; FT qpz = qz - pz;
FT qpz = qz-pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz); CGAL_NTS square(qpz);
FT inv = FT(1)/(FT(2)*qp2); FT inv = FT(1) / (FT(2) * qp2);
FT alpha = 1/FT(2) + (pw-qw)*inv; FT alpha = 1 / FT(2) + (pw-qw) * inv;
return CGAL_NTS square(alpha)*qp2 - pw; return CGAL_NTS square(alpha)*qp2 - pw;
} }
template< class FT > template< class FT >
FT FT
power_productC3( power_productC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw)
const FT &qx, const FT &qy, const FT &qz, const FT &qw)
{ {
// computes the power product of two weighted points // computes the power product of two weighted points
FT qpx = qx-px; FT qpx = qx - px;
FT qpy = qy-py; FT qpy = qy - py;
FT qpz = qz-pz; FT qpz = qz - pz;
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
CGAL_NTS square(qpz); CGAL_NTS square(qpz);
return qp2 - pw - qw ; return qp2 - pw - qw ;
@ -799,17 +775,17 @@ power_productC3(
template < class RT , class We> template < class RT , class We>
void void
radical_axisC3(const RT &px, const RT &py, const RT &pz, const We & /* pw */, radical_axisC3(const RT &px, const RT &py, const RT &pz, const We & /* pw */,
const RT &qx, const RT &qy, const RT &qz, const We & /* qw */, const RT &qx, const RT &qy, const RT &qz, const We & /* qw */,
const RT &rx, const RT &ry, const RT &rz, const We & /* rw */, const RT &rx, const RT &ry, const RT &rz, const We & /* rw */,
RT &a, RT &b, RT& c ) RT &a, RT &b, RT& c )
{ {
RT dqx=qx-px, dqy=qy-py, dqz=qz-pz, drx=rx-px, dry=ry-py, drz=rz-pz; RT dqx=qx-px, dqy=qy-py, dqz=qz-pz, drx=rx-px, dry=ry-py, drz=rz-pz;
//il manque des tests... //il manque des tests...
a= RT(1)*determinant(dqy, dqz, dry, drz); a = RT(1)*determinant(dqy, dqz, dry, drz);
b= - RT(1)*determinant(dqx, dqz, drx, drz); b = - RT(1)*determinant(dqx, dqz, drx, drz);
c= RT(1)*determinant(dqx, dqy, drx, dry); c = RT(1)*determinant(dqx, dqy, drx, dry);
} }
// function used in critical_squared_radiusC3 // function used in critical_squared_radiusC3
@ -817,77 +793,69 @@ radical_axisC3(const RT &px, const RT &py, const RT &pz, const We & /* pw */,
// circle orthogonal (p,pw), (q,qw), (r,rw), (s,sw) // circle orthogonal (p,pw), (q,qw), (r,rw), (s,sw)
template < class FT> template < class FT>
FT FT
power_to_orthogonal_sphereC3( power_to_orthogonal_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw, const FT &tx, const FT &ty, const FT &tz, const FT &tw)
const FT &tx, const FT &ty, const FT &tz, const FT &tw)
{ {
//to get the value of the determinant //to get the value of the determinant
// We translate the points so that t becomes the origin. // We translate the points so that t becomes the origin.
FT dpx = px - tx; FT dpx = px - tx;
FT dpy = py - ty; FT dpy = py - ty;
FT dpz = pz - tz; FT dpz = pz - tz;
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
CGAL_NTS square(dpz) - pw + tw ; CGAL_NTS square(dpz) - pw + tw ;
FT dqx = qx - tx; FT dqx = qx - tx;
FT dqy = qy - ty; FT dqy = qy - ty;
FT dqz = qz - tz; FT dqz = qz - tz;
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) + FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
CGAL_NTS square(dqz) - qw + tw; CGAL_NTS square(dqz) - qw + tw;
FT drx = rx - tx; FT drx = rx - tx;
FT dry = ry - ty; FT dry = ry - ty;
FT drz = rz - tz; FT drz = rz - tz;
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) + FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
CGAL_NTS square(drz) - rw + tw; CGAL_NTS square(drz) - rw + tw;
FT dsx = sx - tx; FT dsx = sx - tx;
FT dsy = sy - ty; FT dsy = sy - ty;
FT dsz = sz - tz; FT dsz = sz - tz;
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) + FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
CGAL_NTS square(dsz) - sw + tw; CGAL_NTS square(dsz) - sw + tw;
return determinant(dpx, dpy, dpz, dpt,
dqx, dqy, dqz, dqt,
drx, dry, drz, drt,
dsx, dsy, dsz, dst);
return determinant(dpx, dpy, dpz, dpt,
dqx, dqy, dqz, dqt,
drx, dry, drz, drt,
dsx, dsy, dsz, dst);
} }
// compute the critical weight tw // compute the critical weight tw
// where weighted point t is orthogonal to weighted points p, q,r,s // where weighted point t is orthogonal to weighted points p, q,r,s
template < class FT> template < class FT>
FT FT
power_distance_to_power_sphereC3( power_distance_to_power_sphereC3(const FT &px, const FT &py, const FT &pz, const FT &pw,
const FT &px, const FT &py, const FT &pz, const FT &pw, const FT &qx, const FT &qy, const FT &qz, const FT &qw,
const FT &qx, const FT &qy, const FT &qz, const FT &qw, const FT &rx, const FT &ry, const FT &rz, const FT &rw,
const FT &rx, const FT &ry, const FT &rz, const FT &rw, const FT &sx, const FT &sy, const FT &sz, const FT &sw,
const FT &sx, const FT &sy, const FT &sz, const FT &sw, const FT &tx, const FT &ty, const FT &tz, const FT & )
const FT &tx, const FT &ty, const FT &tz, const FT & )
{ {
// the 5x5 det is a linear function of tw ff(tw)= ff(0) + tw ff(1) // the 5x5 det is a linear function of tw ff(tw)= ff(0) + tw ff(1)
// the critical value for tw is - ff(0)/( ff(1) - ff(0)) // the critical value for tw is - ff(0)/( ff(1) - ff(0))
FT ff0 = power_to_orthogonal_sphereC3(px, py, pz, pw,
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
tx, ty, tz, FT(0));
FT ff0 = power_to_orthogonal_sphereC3(px, py, pz, pw, FT ff1 = power_to_orthogonal_sphereC3(px, py, pz, pw,
qx, qy, qz, qw, qx, qy, qz, qw,
rx, ry, rz, rw, rx, ry, rz, rw,
sx, sy, sz, sw, sx, sy, sz, sw,
tx, ty, tz, FT(0)); tx, ty, tz, FT(1));
FT ff1 = power_to_orthogonal_sphereC3(px, py, pz, pw, return -ff0/(ff1 - ff0);
qx, qy, qz, qw,
rx, ry, rz, rw,
sx, sy, sz, sw,
tx, ty, tz, FT(1));
return -ff0/(ff1 - ff0);
} }
// I will use this to test if the radial axis of three spheres // I will use this to test if the radial axis of three spheres
// intersect the triangle formed by the centers. // intersect the triangle formed by the centers.
// // resolution of the system (where we note c the center) // // resolution of the system (where we note c the center)
@ -913,9 +881,7 @@ power_distance_to_power_sphereC3(
// FT Mu = (dqq*dp-dpp*dpdq)/denom; // FT Mu = (dqq*dp-dpp*dpdq)/denom;
// return (CGAL_NTS square(Lambda)*dp+CGAL_NTS square(Mu)*dq // return (CGAL_NTS square(Lambda)*dp+CGAL_NTS square(Mu)*dq
// +FT2*Lambda*Mu*dpdq - rw); // + FT2*Lambda*Mu*dpdq - rw);
} //namespace CGAL } //namespace CGAL

View File

@ -635,12 +635,11 @@ side_of_oriented_lineC2(const FT &a, const FT &b, const FT &c,
return CGAL_NTS sign(a*x+b*y+c); return CGAL_NTS sign(a*x+b*y+c);
} }
template <class FT> template <class FT>
Comparison_result Comparison_result
compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt, compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt,
const FT& qx, const FT& qy, const FT& qwt, const FT& qx, const FT& qy, const FT& qwt,
const FT& rx, const FT& ry) const FT& rx, const FT& ry)
{ {
// returns SMALLER if r is closer to p w.r.t. the power metric // returns SMALLER if r is closer to p w.r.t. the power metric
FT d1 = CGAL_NTS square(rx - px) + CGAL_NTS square(ry - py) - pwt; FT d1 = CGAL_NTS square(rx - px) + CGAL_NTS square(ry - py) - pwt;
@ -648,7 +647,6 @@ compare_power_distanceC2(const FT& px, const FT& py, const FT& pwt,
return CGAL_NTS compare(d1, d2); return CGAL_NTS compare(d1, d2);
} }
template <class FT> template <class FT>
Oriented_side Oriented_side
power_side_of_oriented_power_circleC2( const FT &px, const FT &py, const FT &pwt, power_side_of_oriented_power_circleC2( const FT &px, const FT &py, const FT &pwt,
@ -699,7 +697,6 @@ power_side_of_oriented_power_circleC2( const FT &px, const FT &py, const FT &pwt
return cmpy * sign_of_determinant(dpy, dpz, dqy, dqz); return cmpy * sign_of_determinant(dpy, dpz, dqy, dqz);
} }
} //namespace CGAL } //namespace CGAL
#endif // CGAL_PREDICATES_KERNEL_FTC2_H #endif // CGAL_PREDICATES_KERNEL_FTC2_H

View File

@ -301,7 +301,6 @@ namespace CommonKernelFunctors {
} }
}; };
template < typename K > template < typename K >
class Compare_power_distance_3 class Compare_power_distance_3
{ {
@ -310,407 +309,373 @@ namespace CommonKernelFunctors {
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
typedef typename K::Comparison_result Comparison_result; typedef typename K::Comparison_result Comparison_result;
typedef Comparison_result result_type; typedef Comparison_result result_type;
Comparison_result operator() ( const Point_3 & p, Comparison_result operator()(const Point_3 & p,
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r) const const Weighted_point_3 & r) const
{ {
return compare_power_distanceC3(p.x(), p.y(), p.z(), return compare_power_distanceC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(), q.weight(), q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight()); r.x(), r.y(), r.z(), r.weight());
} }
}; };
template < typename K >
class Construct_weighted_circumcenter_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::Point_3 Point_3;
typedef typename K::FT FT;
typedef Point_3 result_type;
template < typename K > Point_3 operator()(const Weighted_point_3 & p,
class Construct_weighted_circumcenter_3 const Weighted_point_3 & q,
{ const Weighted_point_3 & r,
public: const Weighted_point_3 & s) const
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::Point_3 Point_3;
typedef typename K::FT FT;
typedef Point_3 result_type;
Point_3 operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s) const
{ {
FT x, y, z; FT x, y, z;
weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(), weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(), q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(), r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight(), s.x(), s.y(), s.z(), s.weight(),
x,y,z); x,y,z);
return Point_3(x,y,z); return Point_3(x,y,z);
} }
Point_3 operator() ( const Weighted_point_3 & p, Point_3 operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r) const const Weighted_point_3 & r) const
{ {
FT x, y, z; FT x, y, z;
weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(), weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(), q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(), r.x(), r.y(), r.z(), r.weight(),
x,y,z); x,y,z);
return Point_3(x,y,z); return Point_3(x,y,z);
} }
Point_3 operator() ( const Weighted_point_3 & p, Point_3 operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q) const const Weighted_point_3 & q) const
{ {
FT x, y, z; FT x, y, z;
weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(), weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(), q.x(), q.y(), q.z(), q.weight(),
x,y,z); x,y,z);
return Point_3(x,y,z); return Point_3(x,y,z);
} }
}; };
////////////////////// // operator ()
// return the sign of the power test of last weighted point
// operator () // with respect to the smallest sphere orthogonal to the others
// return the sign of the power test of last weighted point template< typename K >
// with respect to the smallest sphere orthogonal to the others class Power_side_of_bounded_power_sphere_3
template< typename K >
class Power_side_of_bounded_power_sphere_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::Sign Sign;
typedef Bounded_side result_type;
Bounded_side operator() (const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const Weighted_point_3 & t) const
{ {
K traits; public:
typename K::Orientation_3 orientation = traits.orientation_3_object(); typedef typename K::Weighted_point_3 Weighted_point_3;
typename K::Power_side_of_oriented_power_sphere_3 power_test = traits.power_side_of_oriented_power_sphere_3_object(); typedef typename K::Sign Sign;
typename K::Orientation o = orientation(p,q,r,s);
typename K::Oriented_side os = power_test(p,q,r,s,t);
// power_test_3
// returns in fact minus the 5x5 determinant of lifted (p,q,r,s.t)
CGAL_assertion(o != COPLANAR);
return enum_cast<Bounded_side>(o * os);
}
Bounded_side operator() (const Weighted_point_3 & p, typedef Bounded_side result_type;
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s) const
{
return power_side_of_bounded_power_sphereC3(
p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight());
}
Bounded_side operator() (const Weighted_point_3 & p, Bounded_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r) const const Weighted_point_3 & r,
{ const Weighted_point_3 & s,
return power_side_of_bounded_power_sphereC3( const Weighted_point_3 & t) const
p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight());
}
Bounded_side operator() (const Weighted_point_3 & p,
const Weighted_point_3 & q) const
{
return enum_cast<Bounded_side>(
- CGAL_NTS sign( CGAL_NTS square(p.x()-q.x()) +
CGAL_NTS square(p.y()-q.y()) +
CGAL_NTS square(p.z()-q.z()) +
p.weight() - q.weight()));
}
};
template < typename K >
class Power_side_of_oriented_power_sphere_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::Oriented_side Oriented_side;
typedef Oriented_side result_type;
Oriented_side operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const Weighted_point_3 & t) const
{ {
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(), K traits;
q.x(), q.y(), q.z(), q.weight(), typename K::Orientation_3 orientation = traits.orientation_3_object();
r.x(), r.y(), r.z(), r.weight(), typename K::Power_side_of_oriented_power_sphere_3 power_test = traits.power_side_of_oriented_power_sphere_3_object();
s.x(), s.y(), s.z(), s.weight(), typename K::Orientation o = orientation(p,q,r,s);
t.x(), t.y(), t.z(), t.weight()); typename K::Oriented_side os = power_test(p,q,r,s,t);
// power_test_3
// returns in fact minus the 5x5 determinant of lifted (p,q,r,s.t)
CGAL_assertion(o != COPLANAR);
return enum_cast<Bounded_side>(o * os);
} }
Oriented_side operator() ( const Weighted_point_3 & p, Bounded_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r, const Weighted_point_3 & r,
const Weighted_point_3 & s) const const Weighted_point_3 & s) const
{ {
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(), return power_side_of_bounded_power_sphereC3(
q.x(), q.y(), q.z(), q.weight(), p.x(), p.y(), p.z(), p.weight(),
r.x(), r.y(), r.z(), r.weight(), q.x(), q.y(), q.z(), q.weight(),
s.x(), s.y(), s.z(), s.weight()); r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight());
} }
Oriented_side operator() ( const Weighted_point_3 & p, Bounded_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q, const Weighted_point_3 & q,
const Weighted_point_3 & r) const const Weighted_point_3 & r) const
{ {
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(), return power_side_of_bounded_power_sphereC3(
q.x(), q.y(), q.z(), q.weight(), p.x(), p.y(), p.z(), p.weight(),
r.x(), r.y(), r.z(), r.weight()); q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight());
} }
Oriented_side operator() ( const Weighted_point_3 & p, Bounded_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q) const const Weighted_point_3 & q) const
{
return enum_cast<Bounded_side>(
- CGAL_NTS sign( CGAL_NTS square(p.x()-q.x()) +
CGAL_NTS square(p.y()-q.y()) +
CGAL_NTS square(p.z()-q.z()) +
p.weight() - q.weight()));
}
};
template < typename K >
class Power_side_of_oriented_power_sphere_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::Oriented_side Oriented_side;
typedef Oriented_side result_type;
Oriented_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const Weighted_point_3 & t) const
{
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight(),
t.x(), t.y(), t.z(), t.weight());
}
Oriented_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s) const
{
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight());
}
Oriented_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r) const
{
return power_side_of_oriented_power_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight());
}
Oriented_side operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q) const
{ {
return power_side_of_oriented_power_sphereC3(p.weight(),q.weight()); return power_side_of_oriented_power_sphereC3(p.weight(),q.weight());
} }
}; };
template < typename K > template < typename K >
class Compute_weight_2 class Compute_weight_2
{
public:
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename K::FT Weight;
typedef const Weight& result_type;
const Weight& operator()(const Weighted_point_2 & p) const
{ {
return p.rep().weight(); public:
} typedef typename K::Weighted_point_2 Weighted_point_2;
}; typedef typename K::FT Weight;
typedef const Weight& result_type;
template < typename K > const Weight& operator()(const Weighted_point_2 & p) const
class Compute_weight_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT Weight;
typedef const Weight& result_type;
const Weight& operator()(const Weighted_point_3 & p) const
{
return p.rep().weight();
}
};
template < typename K >
class Compute_power_product_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT FT;
typedef FT result_type;
FT operator() (const Weighted_point_3 & p,
const Weighted_point_3 & q) const
{
return power_productC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight());
}
};
template < typename K >
class Compute_squared_radius_smallest_orthogonal_circle_2
{
public:
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename K::FT FT;
typedef FT result_type;
FT operator()(const Weighted_point_2& p,
const Weighted_point_2& q,
const Weighted_point_2& r) const
{
return squared_radius_orthogonal_circleC2(p.x(), p.y(), p.weight(),
q.x(), q.y(), q.weight(),
r.x(), r.y(), r.weight());
}
FT operator()(const Weighted_point_2& p,
const Weighted_point_2& q) const
{
return squared_radius_smallest_orthogonal_circleC2(p.x(), p.y(), p.weight(),
q.x(), q.y(), q.weight());
}
FT operator()(const Weighted_point_2& p) const
{
return - p.weight();
}
};
template < typename K >
class Compute_squared_radius_smallest_orthogonal_sphere_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT FT;
typedef FT result_type;
FT operator() ( const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s) const
{ {
return squared_radius_orthogonal_sphereC3( return p.rep().weight();
p.x(), p.y(), p.z(), p.weight(), }
q.x(), q.y(), q.z(), q.weight(), };
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight()); template < typename K >
class Compute_weight_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT Weight;
typedef const Weight& result_type;
const Weight& operator()(const Weighted_point_3 & p) const
{
return p.rep().weight();
}
};
template < typename K >
class Compute_power_product_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT FT;
typedef FT result_type;
FT operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q) const
{
return power_productC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight());
}
};
template < typename K >
class Compute_squared_radius_smallest_orthogonal_circle_2
{
public:
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename K::FT FT;
typedef FT result_type;
FT operator()(const Weighted_point_2& p,
const Weighted_point_2& q,
const Weighted_point_2& r) const
{
return squared_radius_orthogonal_circleC2(p.x(), p.y(), p.weight(),
q.x(), q.y(), q.weight(),
r.x(), r.y(), r.weight());
} }
FT operator() ( const Weighted_point_3 & p, FT operator()(const Weighted_point_2& p,
const Weighted_point_3 & q, const Weighted_point_2& q) const
const Weighted_point_3 & r) const
{ {
return squared_radius_smallest_orthogonal_sphereC3( return squared_radius_smallest_orthogonal_circleC2(p.x(), p.y(), p.weight(),
p.x(), p.y(), p.z(), p.weight(), q.x(), q.y(), q.weight());
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight());
} }
FT operator() (const Weighted_point_3 & p, FT operator()(const Weighted_point_2& p) const
const Weighted_point_3 & q) const {
return - p.weight();
}
};
template < typename K >
class Compute_squared_radius_smallest_orthogonal_sphere_3
{ {
return squared_radius_smallest_orthogonal_sphereC3( public:
p.x(), p.y(), p.z(), p.weight(), typedef typename K::Weighted_point_3 Weighted_point_3;
q.x(), q.y(), q.z(), q.weight()); typedef typename K::FT FT;
}
typedef FT result_type;
FT operator() (const Weighted_point_3 & p) const
FT operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s) const
{
return squared_radius_orthogonal_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight(),
s.x(), s.y(), s.z(), s.weight());
}
FT operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r) const
{
return squared_radius_smallest_orthogonal_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight(),
r.x(), r.y(), r.z(), r.weight());
}
FT operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q) const
{
return squared_radius_smallest_orthogonal_sphereC3(p.x(), p.y(), p.z(), p.weight(),
q.x(), q.y(), q.z(), q.weight());
}
FT operator()(const Weighted_point_3 & p) const
{
return - p.weight();
}
};
// Compute the square radius of the sphere centered in t
// and orthogonal to the sphere orthogonal to p,q,r,s
template< typename K>
class Compute_power_distance_to_power_sphere_3
{ {
return -p.weight(); public:
} typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename K::FT FT;
};
typedef FT result_type;
// Compute the square radius of the sphere centered in t result_type operator()(const Weighted_point_3 & p,
// and orthogonal to the sphere orthogonal to p,q,r,s const Weighted_point_3 & q,
template< typename K> const Weighted_point_3 & r,
class Compute_power_distance_to_power_sphere_3 const Weighted_point_3 & s,
{ const Weighted_point_3 & t) const
public: {
typedef typename K::Weighted_point_3 Weighted_point_3; return power_distance_to_power_sphereC3 (p.x(),p.y(),p.z(),FT(p.weight()),
typedef typename K::FT FT; q.x(),q.y(),q.z(),FT(q.weight()),
r.x(),r.y(),r.z(),FT(r.weight()),
s.x(),s.y(),s.z(),FT(s.weight()),
t.x(),t.y(),t.z(),FT(t.weight()));
}
};
typedef FT result_type; template <typename K>
class Compare_weighted_squared_radius_3
result_type operator() (const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const Weighted_point_3 & t) const
{ {
return power_distance_to_power_sphereC3 (p.x(),p.y(),p.z(),FT(p.weight()), public:
q.x(),q.y(),q.z(),FT(q.weight()), typedef typename K::Weighted_point_3 Weighted_point_3;
r.x(),r.y(),r.z(),FT(r.weight()), typedef typename K::Comparison_result Comparison_result;
s.x(),s.y(),s.z(),FT(s.weight()), typedef typename K::FT FT;
t.x(),t.y(),t.z(),FT(t.weight()));
}
};
typedef Comparison_result result_type;
result_type operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const FT& w) const
{
return CGAL::compare(squared_radius_orthogonal_sphereC3(
p.x(),p.y(),p.z(),p.weight(),
q.x(),q.y(),q.z(),q.weight(),
r.x(),r.y(),r.z(),r.weight(),
s.x(),s.y(),s.z(),s.weight()),
w);
}
template <typename K> result_type operator()(const Weighted_point_3 & p,
class Compare_weighted_squared_radius_3 const Weighted_point_3 & q,
{ const Weighted_point_3 & r,
const FT& w) const
typedef typename K::Weighted_point_3 Weighted_point_3; {
typedef typename K::Comparison_result Comparison_result; return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3(
typedef typename K::FT FT; p.x(),p.y(),p.z(),p.weight(),
q.x(),q.y(),q.z(),q.weight(),
public: r.x(),r.y(),r.z(),r.weight()),
typedef Comparison_result result_type; w);
}
result_type operator() (
const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
const FT& w) const
{
return CGAL::compare(
squared_radius_orthogonal_sphereC3(
p.x(),p.y(),p.z(),p.weight(),
q.x(),q.y(),q.z(),q.weight(),
r.x(),r.y(),r.z(),r.weight(),
s.x(),s.y(),s.z(),s.weight() ),
w);
}
result_type operator() (
const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const FT& w) const
{
return CGAL::compare(
squared_radius_smallest_orthogonal_sphereC3(
p.x(),p.y(),p.z(),p.weight(),
q.x(),q.y(),q.z(),q.weight(),
r.x(),r.y(),r.z(),r.weight() ),
w);
}
result_type operator() (
const Weighted_point_3 & p,
const Weighted_point_3 & q,
const FT& w) const
{
return CGAL::compare(
squared_radius_smallest_orthogonal_sphereC3(
p.x(),p.y(),p.z(),p.weight(),
q.x(),q.y(),q.z(),q.weight() ),
w);
}
result_type operator() (
const Weighted_point_3 & p,
const FT& w) const
{
return CGAL::compare(-p.weight(),w);
}
};
//////////////////////
result_type operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const FT& w) const
{
return CGAL::compare(squared_radius_smallest_orthogonal_sphereC3(
p.x(),p.y(),p.z(),p.weight(),
q.x(),q.y(),q.z(),q.weight()),
w);
}
result_type operator()(const Weighted_point_3 & p,
const FT& w) const
{
return CGAL::compare(-p.weight(), w);
}
};
template <typename K> template <typename K>
class Compare_squared_distance_2 class Compare_squared_distance_2