mirror of https://github.com/CGAL/cgal
Changes after Laurent's review
This commit is contained in:
parent
e39f76b953
commit
f488b9baf9
|
|
@ -1,10 +1,14 @@
|
|||
// Copyright (c) 1999-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
// Copyright (c) 1999
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
// Copyright (c) 1999-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
// Copyright (c) 1999
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
|
|||
|
|
@ -686,6 +686,106 @@ power_testC3(const FT &pwt, const FT &qwt)
|
|||
}
|
||||
|
||||
|
||||
template < class FT >
|
||||
Comparison_result
|
||||
compare_power_distanceC3(
|
||||
const FT &px, const FT &py, const FT &pz,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
|
||||
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
|
||||
{
|
||||
FT dqx = qx - px;
|
||||
FT dqy = qy - py;
|
||||
FT dqz = qz - pz;
|
||||
FT drx = rx - px;
|
||||
FT dry = ry - py;
|
||||
FT drz = rz - pz;
|
||||
return CGAL_NTS compare(dqx*dqx + dqy*dqy + dqz*dqz - qw,
|
||||
drx*drx + dry*dry + drz*drz - rw);
|
||||
}
|
||||
|
||||
|
||||
//return the sign of the power test of weighted point (sx,sy,sz,sw)
|
||||
//with respect to the smallest sphere orthogonal to
|
||||
//p,q,r
|
||||
template< class FT >
|
||||
CGAL_MEDIUM_INLINE
|
||||
Sign
|
||||
in_smallest_orthogonal_sphereC3(
|
||||
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 &rx, const FT &ry, const FT &rz, const FT &rw,
|
||||
const FT &sx, const FT &sy, const FT &sz, const FT &sw)
|
||||
{
|
||||
// Translate p to origin and compute determinants
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
|
||||
FT rpx = rx-px;
|
||||
FT rpy = ry-py;
|
||||
FT rpz = rz-pz;
|
||||
|
||||
FT qq = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + CGAL_NTS square(qpz);
|
||||
FT rr = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + CGAL_NTS square(rpz);
|
||||
FT qr = qpx*rpx + qpy*rpy + qpz*rpz;
|
||||
|
||||
FT qpw = qq - qw + pw ;
|
||||
FT rpw = rr - rw + pw ;
|
||||
|
||||
FT den = determinant(qq,qr,
|
||||
qr,rr);
|
||||
FT detq = determinant(qpw,qr,
|
||||
rpw,rr);
|
||||
FT detr = determinant(qq,qpw,
|
||||
qr,rpw);
|
||||
|
||||
// Smallest smallest orthogonal sphere center
|
||||
// c = detq/2*den q + detr/2*den r (origin at p)
|
||||
// square radius c^2 - pw
|
||||
|
||||
FT spx = sx-px;
|
||||
FT spy = sy-py;
|
||||
FT spz = sz-pz;
|
||||
FT ss = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz);
|
||||
FT sq = spx*qpx + spy*qpy + spz*qpz;
|
||||
FT sr = spx*rpx + spy*rpy + spz*rpz;
|
||||
|
||||
CGAL_assertion( ! CGAL_NTS is_zero(den) );
|
||||
// return sign of (c- s)^2 - (c^2 - pw) - sw note that den >= 0 -
|
||||
return CGAL_NTS sign( den*(ss - sw + pw)- detq*sq - detr*sr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return the sign of the power test of weighted point (rx,ry,rz,rw)
|
||||
// with respect to the smallest sphere orthogoanal to
|
||||
// p,q
|
||||
template< class FT >
|
||||
Sign
|
||||
in_smallest_orthogonal_sphereC3(
|
||||
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 &rx, const FT &ry, const FT &rz, const FT &rw)
|
||||
{
|
||||
FT FT2(2);
|
||||
FT FT4(4);
|
||||
FT dpx = px - qx;
|
||||
FT dpy = py - qy;
|
||||
FT dpz = pz - qz;
|
||||
FT dpw = pw - qw;
|
||||
FT dp2 = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + CGAL_NTS square(dpz);
|
||||
FT drx = rx - (px + qx)/FT2;
|
||||
FT dry = ry - (py + qy)/FT2;
|
||||
FT drz = rz - (pz + qz)/FT2;
|
||||
FT drw = rw - (pw + qw)/FT2;
|
||||
FT dr2 = CGAL_NTS square(drx) + CGAL_NTS square(dry) + CGAL_NTS square(drz);
|
||||
FT dpr = dpx*drx + dpy*dry +dpz*drz;
|
||||
return CGAL_NTS sign (dr2 - dp2/FT4 + dpr*dpw/dp2 - drw );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_PREDICATES_KERNEL_FTC3_H
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@
|
|||
#include <CGAL/Homogeneous/distance_predicatesH3.h>
|
||||
#include <CGAL/Homogeneous/predicates_on_pointsH3.h>
|
||||
#include <CGAL/Homogeneous/predicates_on_pointsH2.h>
|
||||
#include <CGAL/Homogeneous/constructions_on_weighted_points_homogeneous_2.h>
|
||||
|
||||
#include <CGAL/representation_tags.h>
|
||||
#include <CGAL/Homogeneous/function_objects.h>
|
||||
|
|
|
|||
|
|
@ -1,156 +0,0 @@
|
|||
// Copyright (c) 1999 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Sylvain Pion
|
||||
// Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_REGULAR_TRIANGULATION_RTH2_H
|
||||
#define CGAL_REGULAR_TRIANGULATION_RTH2_H
|
||||
|
||||
// This file contains the low level homogeneous predicates
|
||||
// used by the 2D regular triangulation.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class RT>
|
||||
Comparison_result
|
||||
compare_power_distanceH2(const RT& phx, const RT& phy, const RT& phw,
|
||||
const Quotient<RT>& pwt,
|
||||
const RT& qhx, const RT& qhy, const RT& qhw,
|
||||
const Quotient<RT>& qwt,
|
||||
const RT& rhx, const RT& rhy, const RT& rhw)
|
||||
{
|
||||
// returns SMALLER if r is closer to p w.r.t. the power metric
|
||||
RT dphx = rhx * phw - phx * rhw;
|
||||
RT dphy = rhy * phw - phy * rhw;
|
||||
RT dqhx = rhx * qhw - qhx * rhw;
|
||||
RT dqhy = rhy * qhw - qhy * rhw;
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT drhw = CGAL_NTS square(rhw);
|
||||
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
|
||||
|
||||
RT dh1 = (CGAL_NTS square(dphx) + CGAL_NTS square(dphy))*dpwt - npwt * dphw * drhw;
|
||||
RT dh2 = (CGAL_NTS square(dqhx) + CGAL_NTS square(dqhy))*dqwt - nqwt * dqhw * drhw;
|
||||
return CGAL_NTS compare(dh1 * dqhw * dqwt, dh2 * dphw * dpwt );
|
||||
}
|
||||
|
||||
|
||||
template <class RT>
|
||||
Oriented_side
|
||||
power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient<RT> &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw, const Quotient<RT> &qwt,
|
||||
const RT &rhx, const RT &rhy, const RT &rhw, const Quotient<RT> &rwt,
|
||||
const RT &thx, const RT &thy, const RT &thw, const Quotient<RT> &twt)
|
||||
{
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
RT nrwt = rwt.numerator();
|
||||
RT drwt = rwt.denominator();
|
||||
RT ntwt = twt.numerator();
|
||||
RT dtwt = twt.denominator();
|
||||
|
||||
RT dphx = phx*phw;
|
||||
RT dphy = phy*phw;
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dpz = (CGAL_NTS square(phx) + CGAL_NTS square(phy))*dpwt - npwt*dphw;
|
||||
|
||||
RT dqhx = qhx*qhw;
|
||||
RT dqhy = qhy*qhw;
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT dqz = (CGAL_NTS square(qhx) + CGAL_NTS square(qhy))*dqwt - nqwt*dqhw;
|
||||
|
||||
RT drhx = rhx*rhw;
|
||||
RT drhy = rhy*rhw;
|
||||
RT drhw = CGAL_NTS square(rhw);
|
||||
RT drz = (CGAL_NTS square(rhx) + CGAL_NTS square(rhy)) *drwt - nrwt*drhw;
|
||||
|
||||
RT dthx = thx*thw;
|
||||
RT dthy = thy*thw;
|
||||
RT dthw = CGAL_NTS square(thw);
|
||||
RT dtz = (CGAL_NTS square(thx) + CGAL_NTS square(thy))*dtwt - ntwt*dthw;
|
||||
|
||||
dthx *= dtwt;
|
||||
dthy *= dtwt;
|
||||
dthw *= dtwt;
|
||||
|
||||
return sign_of_determinant(dphx, dphy, dpz, dphw,
|
||||
dqhx, dqhy, dqz, dqhw,
|
||||
drhx, drhy, drz, drhw,
|
||||
dthx, dthy, dtz, dthw);
|
||||
}
|
||||
|
||||
|
||||
template <class RT>
|
||||
Oriented_side
|
||||
power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient<RT> &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw, const Quotient<RT> &qwt,
|
||||
const RT &thx, const RT &thy, const RT &thw, const Quotient<RT> &twt)
|
||||
{
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
RT ntwt = twt.numerator();
|
||||
RT dtwt = twt.denominator();
|
||||
|
||||
// Test if we can project on the (x) axis. If not, then on the
|
||||
// (y) axis
|
||||
RT pa, qa, ta;
|
||||
|
||||
if (phx * qhw != qhx * phw )
|
||||
{
|
||||
pa = phx*phw;
|
||||
qa = qhx*qhw;
|
||||
ta = thx*thw;
|
||||
}
|
||||
else
|
||||
{
|
||||
pa = phy*phw;
|
||||
qa = qhy*qhw;
|
||||
ta = thy*thw;
|
||||
}
|
||||
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dpz = (CGAL_NTS square(phx) + CGAL_NTS square(phy))*dpwt - npwt*dphw;
|
||||
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT dqz = (CGAL_NTS square(qhx) + CGAL_NTS square(qhy))*dqwt - nqwt*dqhw;
|
||||
|
||||
RT dthw = CGAL_NTS square(thw);
|
||||
RT dtz = (CGAL_NTS square(thx) + CGAL_NTS square(thy))*dtwt - ntwt*dthw;
|
||||
|
||||
pa *= dtwt;
|
||||
qa *= dtwt;
|
||||
ta *= dtwt;
|
||||
|
||||
return CGAL_NTS compare(pa, qa) * sign_of_determinant(pa, dpz, dphw,
|
||||
qa, dqz, dqhw,
|
||||
ta, dtz, dthw);
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_REGULAR_TRIANGULATION_RTH2_H
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
// Copyright (c) 1999 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Sylvain Pion
|
||||
|
||||
#ifndef CGAL_REGULAR_TRIANGULATION_RTH3_H
|
||||
#define CGAL_REGULAR_TRIANGULATION_RTH3_H
|
||||
|
||||
// This file contains the low level homogeneous predicates
|
||||
// used by the 3D regular triangulation.
|
||||
|
||||
#include <CGAL/predicates/kernel_ftC3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class RT>
|
||||
Oriented_side
|
||||
power_testH3(
|
||||
const RT &phx, const RT &phy, const RT &phz, const RT &phw, const Quotient<RT> &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhz, const RT &qhw, const Quotient<RT> &qwt,
|
||||
const RT &rhx, const RT &rhy, const RT &rhz, const RT &rhw, const Quotient<RT> &rwt,
|
||||
const RT &shx, const RT ­, const RT &shz, const RT &shw, const Quotient<RT> &swt,
|
||||
const RT &thx, const RT &thy, const RT &thz, const RT &thw, const Quotient<RT> &twt)
|
||||
{
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
RT nrwt = rwt.numerator();
|
||||
RT drwt = rwt.denominator();
|
||||
RT nswt = swt.numerator();
|
||||
RT dswt = swt.denominator();
|
||||
RT ntwt = twt.numerator();
|
||||
RT dtwt = twt.denominator();
|
||||
|
||||
RT dphx = phx*phw;
|
||||
RT dphy = phy*phw;
|
||||
RT dphz = phz*phw;
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dpz = (CGAL_NTS square(phx) + CGAL_NTS square(phy) +
|
||||
CGAL_NTS square(phz))*dpwt - npwt*dphw;
|
||||
|
||||
RT dqhx = qhx*qhw;
|
||||
RT dqhy = qhy*qhw;
|
||||
RT dqhz = qhz*qhw;
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT dqz = (CGAL_NTS square(qhx) + CGAL_NTS square(qhy) +
|
||||
CGAL_NTS square(qhz))*dqwt - nqwt*dqhw;
|
||||
|
||||
RT drhx = rhx*rhw;
|
||||
RT drhy = rhy*rhw;
|
||||
RT drhz = rhz*rhw;
|
||||
RT drhw = CGAL_NTS square(rhw);
|
||||
RT drz = (CGAL_NTS square(rhx) + CGAL_NTS square(rhy) +
|
||||
CGAL_NTS square(rhz))*drwt - nrwt*drhw;
|
||||
|
||||
RT dshx = shx*shw;
|
||||
RT dshy = shy*shw;
|
||||
RT dshz = shz*shw;
|
||||
RT dshw = CGAL_NTS square(shw);
|
||||
RT dsz = (CGAL_NTS square(shx) + CGAL_NTS square(shy) +
|
||||
CGAL_NTS square(shz))*dswt - nswt*dshw;
|
||||
|
||||
RT dthx = thx*thw;
|
||||
RT dthy = thy*thw;
|
||||
RT dthz = thz*thw;
|
||||
RT dthw = CGAL_NTS square(thw);
|
||||
RT dtz = (CGAL_NTS square(thx) + CGAL_NTS square(thy) +
|
||||
CGAL_NTS square(thz))*dtwt - ntwt*dthw;
|
||||
|
||||
dthx *= dtwt;
|
||||
dthy *= dtwt;
|
||||
dthz *= dtwt;
|
||||
dthw *= dtwt;
|
||||
|
||||
return - sign_of_determinant(dphx, dphy, dphz, dpz, dphw,
|
||||
dqhx, dqhy, dqhz, dqz, dqhw,
|
||||
drhx, drhy, drhz, drz, drhw,
|
||||
dshx, dshy, dshz, dsz, dshw,
|
||||
dthx, dthy, dthz, dtz, dthw);
|
||||
}
|
||||
|
||||
// The 2 degenerate are not speed critical, and they are quite boring and error
|
||||
// prone to write, so we use the Cartesian version, using FT.
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_REGULAR_TRIANGULATION_RTH3_H
|
||||
|
|
@ -1,10 +1,14 @@
|
|||
// Copyright (c) 1999-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
// Copyright (c) 1999
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
@ -14,7 +18,6 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Mariette Yvinec
|
||||
// Sylvain Pion
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
// Copyright (c) 1999-2004 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
// Copyright (c) 1999
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
|
|
@ -13,8 +17,7 @@
|
|||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Mariette Yvinec
|
||||
// Sylvain Pion
|
||||
|
|
|
|||
|
|
@ -71,6 +71,69 @@ squared_distance( const PointH2<R>& p, const PointH2<R>& q )
|
|||
return FT( sq_dist_numerator ) / FT( sq_dist_denominator );
|
||||
}
|
||||
|
||||
|
||||
template < class RT, class We>
|
||||
void
|
||||
weighted_circumcenterH2( const RT &phx, const RT &phy, const RT &phw,
|
||||
const We &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw,
|
||||
const We &qwt,
|
||||
const RT &rhx, const RT &rhy, const RT &rhw,
|
||||
const We &rwt,
|
||||
RT &vvx, RT &vvy, RT &vvw )
|
||||
{
|
||||
|
||||
// RT qx_px = ( qhx*qhw*phw*phw - phx*phw*qhw*qhw );
|
||||
// RT qy_py = ( qhy*qhw*phw*phw - phy*phw*qhw*qhw );
|
||||
// RT rx_px = ( rhx*rhw*phw*phw - phx*phw*rhw*rhw );
|
||||
// RT ry_py = ( rhy*rhw*phw*phw - phy*phw*rhw*rhw );
|
||||
|
||||
// //intersection of the two radical axis of (qp) and (rp)
|
||||
// RT px2_py2_rx2_ry_2 =
|
||||
// phx*phx*rhw*rhw + phy*phy*rhw*rhw - rhx*rhx*phw*phw -
|
||||
// rhy*rhy*phw*phw - RT(pwt*pwt) + RT(rwt*rwt);
|
||||
// RT px2_py2_qx2_qy_2 =
|
||||
// phx*phx*qhw*qhw + phy*phy*qhw*qhw - qhx*qhx*phw*phw -
|
||||
// qhy*qhy*phw*phw - RT(pwt*pwt) + RT(qwt*qwt);
|
||||
|
||||
// vvx = qy_py * px2_py2_rx2_ry_2 - ry_py * px2_py2_qx2_qy_2;
|
||||
// vvy = rx_px * px2_py2_qx2_qy_2 - qx_px * px2_py2_rx2_ry_2;
|
||||
// vvw = RT(2) * ( qx_px * ry_py - rx_px * qy_py );
|
||||
|
||||
RT a1, b1, c1;
|
||||
RT a2, b2, c2;
|
||||
radical_axisH2(phx,phy,phw,pwt,qhx,qhy,qhw,qwt,a1,b1,c1);
|
||||
radical_axisH2(phx,phy,phw,pwt,rhx,rhy,rhw,rwt,a2,b2,c2);
|
||||
vvx = b1*c2 - c1*b2;
|
||||
vvy = c1*a2 - c2*a1;
|
||||
vvw = a1*b2 - a2*b1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template < class RT , class FT>
|
||||
void
|
||||
radical_axisH2(const RT &phx, const RT &phy, const RT &phw, const FT &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw, const FT &qwt,
|
||||
RT &a, RT &b, RT &c )
|
||||
{
|
||||
Rational_traits<FT> rt;
|
||||
RT npwt = rt.numerator(pwt);
|
||||
RT dpwt = rt.denominator(pwt);
|
||||
RT nqwt = rt.numerator(qwt);
|
||||
RT dqwt = rt.denominator(qwt);
|
||||
|
||||
a = RT(2) * ( phx*phw*qhw*qhw - qhx*qhw*phw*phw );
|
||||
b = RT(2) * ( phy*phw*qhw*qhw - qhy*qhw*phw*phw );
|
||||
c = (- phx*phx*qhw*qhw - phy*phy*qhw*qhw
|
||||
+ qhx*qhx*phw*phw + qhy*qhy*phw*phw) * dpwt * dqwt
|
||||
+ npwt*dqwt*phw*phw*qhw*qhw - nqwt*dpwt*phw*phw*qhw*qhw;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_BASIC_CONSTRUCTIONSH2_H
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Julia Flototto, Mariette Yvinec
|
||||
|
||||
|
||||
#ifndef CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_HOMOGENEOUS_2_H
|
||||
#define CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_HOMOGENEOUS_2_H
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class RT, class We>
|
||||
void
|
||||
weighted_circumcenterH2( const RT &phx, const RT &phy, const RT &phw,
|
||||
const We &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw,
|
||||
const We &qwt,
|
||||
const RT &rhx, const RT &rhy, const RT &rhw,
|
||||
const We &rwt,
|
||||
RT &vvx, RT &vvy, RT &vvw )
|
||||
{
|
||||
|
||||
// RT qx_px = ( qhx*qhw*phw*phw - phx*phw*qhw*qhw );
|
||||
// RT qy_py = ( qhy*qhw*phw*phw - phy*phw*qhw*qhw );
|
||||
// RT rx_px = ( rhx*rhw*phw*phw - phx*phw*rhw*rhw );
|
||||
// RT ry_py = ( rhy*rhw*phw*phw - phy*phw*rhw*rhw );
|
||||
|
||||
// //intersection of the two radical axis of (qp) and (rp)
|
||||
// RT px2_py2_rx2_ry_2 =
|
||||
// phx*phx*rhw*rhw + phy*phy*rhw*rhw - rhx*rhx*phw*phw -
|
||||
// rhy*rhy*phw*phw - RT(pwt*pwt) + RT(rwt*rwt);
|
||||
// RT px2_py2_qx2_qy_2 =
|
||||
// phx*phx*qhw*qhw + phy*phy*qhw*qhw - qhx*qhx*phw*phw -
|
||||
// qhy*qhy*phw*phw - RT(pwt*pwt) + RT(qwt*qwt);
|
||||
|
||||
// vvx = qy_py * px2_py2_rx2_ry_2 - ry_py * px2_py2_qx2_qy_2;
|
||||
// vvy = rx_px * px2_py2_qx2_qy_2 - qx_px * px2_py2_rx2_ry_2;
|
||||
// vvw = RT(2) * ( qx_px * ry_py - rx_px * qy_py );
|
||||
|
||||
RT a1, b1, c1;
|
||||
RT a2, b2, c2;
|
||||
radical_axisH2(phx,phy,phw,pwt,qhx,qhy,qhw,qwt,a1,b1,c1);
|
||||
radical_axisH2(phx,phy,phw,pwt,rhx,rhy,rhw,rwt,a2,b2,c2);
|
||||
vvx = b1*c2 - c1*b2;
|
||||
vvy = c1*a2 - c2*a1;
|
||||
vvw = a1*b2 - a2*b1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template < class RT , class FT>
|
||||
void
|
||||
radical_axisH2(const RT &phx, const RT &phy, const RT &phw, const FT &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw, const FT &qwt,
|
||||
RT &a, RT &b, RT &c )
|
||||
{
|
||||
Rational_traits<FT> rt;
|
||||
RT npwt = rt.numerator(pwt);
|
||||
RT dpwt = rt.denominator(pwt);
|
||||
RT nqwt = rt.numerator(qwt);
|
||||
RT dqwt = rt.denominator(qwt);
|
||||
|
||||
a = RT(2) * ( phx*phw*qhw*qhw - qhx*qhw*phw*phw );
|
||||
b = RT(2) * ( phy*phw*qhw*qhw - qhy*qhw*phw*phw );
|
||||
c = (- phx*phx*qhw*qhw - phy*phy*qhw*qhw
|
||||
+ qhx*qhx*phw*phw + qhy*qhy*phw*phw) * dpwt * dqwt
|
||||
+ npwt*dqwt*phw*phw*qhw*qhw - nqwt*dpwt*phw*phw*qhw*qhw;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
#endif //CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_HOMOGENEOUS_2_H
|
||||
|
|
@ -29,8 +29,8 @@
|
|||
#include <CGAL/Cartesian/function_objects.h>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/predicates/sign_of_determinant.h>
|
||||
#include <CGAL/Homogeneous/Regular_triangulation_rtH3.h>
|
||||
#include <CGAL/Homogeneous/Regular_triangulation_rtH2.h>
|
||||
#include <CGAL/Homogeneous/predicates_on_pointsH2.h>
|
||||
#include <CGAL/Homogeneous/predicates_on_pointsH3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,130 @@ _where_wrt_L_wedge( const PointH2<R>& p, const PointH2<R>& q )
|
|||
return ON_ORIENTED_BOUNDARY;
|
||||
}
|
||||
|
||||
template <class RT>
|
||||
Comparison_result
|
||||
compare_power_distanceH2(const RT& phx, const RT& phy, const RT& phw,
|
||||
const Quotient<RT>& pwt,
|
||||
const RT& qhx, const RT& qhy, const RT& qhw,
|
||||
const Quotient<RT>& qwt,
|
||||
const RT& rhx, const RT& rhy, const RT& rhw)
|
||||
{
|
||||
// returns SMALLER if r is closer to p w.r.t. the power metric
|
||||
RT dphx = rhx * phw - phx * rhw;
|
||||
RT dphy = rhy * phw - phy * rhw;
|
||||
RT dqhx = rhx * qhw - qhx * rhw;
|
||||
RT dqhy = rhy * qhw - qhy * rhw;
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT drhw = CGAL_NTS square(rhw);
|
||||
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
|
||||
|
||||
RT dh1 = (CGAL_NTS square(dphx) + CGAL_NTS square(dphy))*dpwt - npwt * dphw * drhw;
|
||||
RT dh2 = (CGAL_NTS square(dqhx) + CGAL_NTS square(dqhy))*dqwt - nqwt * dqhw * drhw;
|
||||
return CGAL_NTS compare(dh1 * dqhw * dqwt, dh2 * dphw * dpwt );
|
||||
}
|
||||
|
||||
|
||||
template <class RT>
|
||||
Oriented_side
|
||||
power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient<RT> &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw, const Quotient<RT> &qwt,
|
||||
const RT &rhx, const RT &rhy, const RT &rhw, const Quotient<RT> &rwt,
|
||||
const RT &thx, const RT &thy, const RT &thw, const Quotient<RT> &twt)
|
||||
{
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
RT nrwt = rwt.numerator();
|
||||
RT drwt = rwt.denominator();
|
||||
RT ntwt = twt.numerator();
|
||||
RT dtwt = twt.denominator();
|
||||
|
||||
RT dphx = phx*phw;
|
||||
RT dphy = phy*phw;
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dpz = (CGAL_NTS square(phx) + CGAL_NTS square(phy))*dpwt - npwt*dphw;
|
||||
|
||||
RT dqhx = qhx*qhw;
|
||||
RT dqhy = qhy*qhw;
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT dqz = (CGAL_NTS square(qhx) + CGAL_NTS square(qhy))*dqwt - nqwt*dqhw;
|
||||
|
||||
RT drhx = rhx*rhw;
|
||||
RT drhy = rhy*rhw;
|
||||
RT drhw = CGAL_NTS square(rhw);
|
||||
RT drz = (CGAL_NTS square(rhx) + CGAL_NTS square(rhy)) *drwt - nrwt*drhw;
|
||||
|
||||
RT dthx = thx*thw;
|
||||
RT dthy = thy*thw;
|
||||
RT dthw = CGAL_NTS square(thw);
|
||||
RT dtz = (CGAL_NTS square(thx) + CGAL_NTS square(thy))*dtwt - ntwt*dthw;
|
||||
|
||||
dthx *= dtwt;
|
||||
dthy *= dtwt;
|
||||
dthw *= dtwt;
|
||||
|
||||
return sign_of_determinant(dphx, dphy, dpz, dphw,
|
||||
dqhx, dqhy, dqz, dqhw,
|
||||
drhx, drhy, drz, drhw,
|
||||
dthx, dthy, dtz, dthw);
|
||||
}
|
||||
|
||||
|
||||
template <class RT>
|
||||
Oriented_side
|
||||
power_testH2( const RT &phx, const RT &phy, const RT &phw, const Quotient<RT> &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhw, const Quotient<RT> &qwt,
|
||||
const RT &thx, const RT &thy, const RT &thw, const Quotient<RT> &twt)
|
||||
{
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
RT ntwt = twt.numerator();
|
||||
RT dtwt = twt.denominator();
|
||||
|
||||
// Test if we can project on the (x) axis. If not, then on the
|
||||
// (y) axis
|
||||
RT pa, qa, ta;
|
||||
|
||||
if (phx * qhw != qhx * phw )
|
||||
{
|
||||
pa = phx*phw;
|
||||
qa = qhx*qhw;
|
||||
ta = thx*thw;
|
||||
}
|
||||
else
|
||||
{
|
||||
pa = phy*phw;
|
||||
qa = qhy*qhw;
|
||||
ta = thy*thw;
|
||||
}
|
||||
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dpz = (CGAL_NTS square(phx) + CGAL_NTS square(phy))*dpwt - npwt*dphw;
|
||||
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT dqz = (CGAL_NTS square(qhx) + CGAL_NTS square(qhy))*dqwt - nqwt*dqhw;
|
||||
|
||||
RT dthw = CGAL_NTS square(thw);
|
||||
RT dtz = (CGAL_NTS square(thx) + CGAL_NTS square(thy))*dtwt - ntwt*dthw;
|
||||
|
||||
pa *= dtwt;
|
||||
qa *= dtwt;
|
||||
ta *= dtwt;
|
||||
|
||||
return CGAL_NTS compare(pa, qa) * sign_of_determinant(pa, dpz, dphw,
|
||||
qa, dqz, dqhw,
|
||||
ta, dtz, dthw);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Unused, undocumented, un-functorized.
|
||||
template < class R >
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#define CGAL_PREDICATES_ON_POINTSH3_H
|
||||
|
||||
#include <CGAL/Homogeneous/PointH3.h>
|
||||
#include <CGAL/predicates/kernel_ftC3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -125,6 +126,78 @@ bool
|
|||
less_z(const PointH3<R> &p, const PointH3<R> &q)
|
||||
{ return (p.hz() * q.hw() < q.hz() * p.hw() ); }
|
||||
|
||||
|
||||
|
||||
template <class RT>
|
||||
Oriented_side
|
||||
power_testH3(
|
||||
const RT &phx, const RT &phy, const RT &phz, const RT &phw, const Quotient<RT> &pwt,
|
||||
const RT &qhx, const RT &qhy, const RT &qhz, const RT &qhw, const Quotient<RT> &qwt,
|
||||
const RT &rhx, const RT &rhy, const RT &rhz, const RT &rhw, const Quotient<RT> &rwt,
|
||||
const RT &shx, const RT ­, const RT &shz, const RT &shw, const Quotient<RT> &swt,
|
||||
const RT &thx, const RT &thy, const RT &thz, const RT &thw, const Quotient<RT> &twt)
|
||||
{
|
||||
RT npwt = pwt.numerator();
|
||||
RT dpwt = pwt.denominator();
|
||||
RT nqwt = qwt.numerator();
|
||||
RT dqwt = qwt.denominator();
|
||||
RT nrwt = rwt.numerator();
|
||||
RT drwt = rwt.denominator();
|
||||
RT nswt = swt.numerator();
|
||||
RT dswt = swt.denominator();
|
||||
RT ntwt = twt.numerator();
|
||||
RT dtwt = twt.denominator();
|
||||
|
||||
RT dphx = phx*phw;
|
||||
RT dphy = phy*phw;
|
||||
RT dphz = phz*phw;
|
||||
RT dphw = CGAL_NTS square(phw);
|
||||
RT dpz = (CGAL_NTS square(phx) + CGAL_NTS square(phy) +
|
||||
CGAL_NTS square(phz))*dpwt - npwt*dphw;
|
||||
|
||||
RT dqhx = qhx*qhw;
|
||||
RT dqhy = qhy*qhw;
|
||||
RT dqhz = qhz*qhw;
|
||||
RT dqhw = CGAL_NTS square(qhw);
|
||||
RT dqz = (CGAL_NTS square(qhx) + CGAL_NTS square(qhy) +
|
||||
CGAL_NTS square(qhz))*dqwt - nqwt*dqhw;
|
||||
|
||||
RT drhx = rhx*rhw;
|
||||
RT drhy = rhy*rhw;
|
||||
RT drhz = rhz*rhw;
|
||||
RT drhw = CGAL_NTS square(rhw);
|
||||
RT drz = (CGAL_NTS square(rhx) + CGAL_NTS square(rhy) +
|
||||
CGAL_NTS square(rhz))*drwt - nrwt*drhw;
|
||||
|
||||
RT dshx = shx*shw;
|
||||
RT dshy = shy*shw;
|
||||
RT dshz = shz*shw;
|
||||
RT dshw = CGAL_NTS square(shw);
|
||||
RT dsz = (CGAL_NTS square(shx) + CGAL_NTS square(shy) +
|
||||
CGAL_NTS square(shz))*dswt - nswt*dshw;
|
||||
|
||||
RT dthx = thx*thw;
|
||||
RT dthy = thy*thw;
|
||||
RT dthz = thz*thw;
|
||||
RT dthw = CGAL_NTS square(thw);
|
||||
RT dtz = (CGAL_NTS square(thx) + CGAL_NTS square(thy) +
|
||||
CGAL_NTS square(thz))*dtwt - ntwt*dthw;
|
||||
|
||||
dthx *= dtwt;
|
||||
dthy *= dtwt;
|
||||
dthz *= dtwt;
|
||||
dthw *= dtwt;
|
||||
|
||||
return - sign_of_determinant(dphx, dphy, dphz, dpz, dphw,
|
||||
dqhx, dqhy, dqhz, dqz, dqhw,
|
||||
drhx, drhy, drhz, drz, drhw,
|
||||
dshx, dshy, dshz, dsz, dshw,
|
||||
dthx, dthy, dthz, dtz, dthw);
|
||||
}
|
||||
|
||||
// The 2 degenerate are not speed critical, and they are quite boring and error
|
||||
// prone to write, so we use the Cartesian version, using FT.
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_PREDICATES_ON_POINTSH3_H
|
||||
|
|
|
|||
|
|
@ -146,7 +146,12 @@ and <code>src/</code> directories).
|
|||
<!-- Major and breaking changes -->
|
||||
<!-- Arithmetic and Algebra -->
|
||||
<!-- Combinatorial Algorithms -->
|
||||
<!-- Geometry Kernels -->
|
||||
<!-- Geometry Kernels -->
|
||||
<h3>Linear Kernel</h3>
|
||||
<ul>
|
||||
<li>Added a 2D and 3D weighted point class and predicates and constructions.
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Convex Hull Algorithms -->
|
||||
<!-- Polygons -->
|
||||
<!-- Cell Complexes and Polyhedra -->
|
||||
|
|
@ -164,6 +169,20 @@ and <code>src/</code> directories).
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>2D Triangulations</h3>
|
||||
<ul>
|
||||
<li><b>Breaking change</b>: Removed the arbitrary dimensional weighted point class.</li>
|
||||
<li><b>Breaking change</b>: Removed the class <code>Regular_triangulation_filtered_traits_2</code></li>
|
||||
<li><b>Breaking change</b>:The number type of weighted points in regular triangulations is no longer
|
||||
a template parameter but the field type of the geometric traits class.</li>
|
||||
</ul>
|
||||
|
||||
<h3>3D Triangulations</h3>
|
||||
<ul>
|
||||
<li><b>Breaking change</b>: Removed the class <code>Regular_triangulation_filtered_traits_3</code></li>
|
||||
<li><b>Breaking change</b>: The number type of weighted points in regular triangulations is no longer
|
||||
a template parameter but the field type of the geometric traits class.</li>
|
||||
</ul>
|
||||
<!-- Voronoi Diagrams -->
|
||||
<!-- Mesh Generation -->
|
||||
<!-- Surface Reconstruction -->
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ introduces a point `p` initialized to `(x,y)`.
|
|||
*/
|
||||
Point_2(const Kernel::FT &x, const Kernel::FT &y);
|
||||
|
||||
/*!
|
||||
introduces a point from a weighted point.
|
||||
*/
|
||||
Point_2(const Kernel::Weighted_point_2 &wp);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ introduces a point `p` initialized to `(x,y,z)`.
|
|||
*/
|
||||
Point_3(const Kernel::FT &x, const Kernel::FT &y, const Kernel::FT &z);
|
||||
|
||||
/*!
|
||||
introduces a point from a weighted point.
|
||||
*/
|
||||
Point_3(const Kernel::Weighted_point_3 &wp);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ introduces a weighted point from point `p` and weight `w`.
|
|||
*/
|
||||
Weighted_point_2(const Point_2<Kernel>& p, Kernel::FT& w);
|
||||
|
||||
/*!
|
||||
introduces a weighted point with coordinates `x`, `y`, and weight 0.
|
||||
*/
|
||||
Weighted_point_2(const Kernel::FT& x, const Kernel::FT& y);
|
||||
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ In 2D, the types `Type1` and `Type2` can be any of the following:
|
|||
- `Segment_2`
|
||||
- `Triangle_2`
|
||||
|
||||
as well as any combination of `Kernel::Point_2` and `Kernel::Weighted_point_2`
|
||||
|
||||
In 3D, the types `Type1` and `Type2` can be any of the
|
||||
following:
|
||||
|
|
@ -38,7 +39,8 @@ following:
|
|||
- `Segment_3`
|
||||
- `Plane_3`
|
||||
|
||||
as well as the combination `Point_3`/`Triangle_3`.
|
||||
as well as combinations `Point_3`/`Triangle_3`,
|
||||
and `Weighted_point_3`/`Triangle_3`.
|
||||
|
||||
\sa `compare_distance_to_point_grp`
|
||||
\sa `compare_signed_distance_to_line_grp`
|
||||
|
|
|
|||
|
|
@ -2524,6 +2524,7 @@ public:
|
|||
- `Kernel::Segment_2`
|
||||
- `Kernel::Triangle_2`
|
||||
|
||||
as well as any combination of `Kernel::Point_2` and `Kernel::Weighted_point_2`
|
||||
*/
|
||||
Kernel::FT operator()(Type1 obj1, Type2 obj2);
|
||||
|
||||
|
|
@ -2558,6 +2559,8 @@ public:
|
|||
- `Kernel::Ray_3`
|
||||
- `Kernel::Segment_3`
|
||||
- `Kernel::Plane_3`
|
||||
|
||||
as well as any combination of `Kernel::Point_3` and `Kernel::Weighted_point_3`
|
||||
*/
|
||||
Kernel::FT operator()(Type1 obj1, Type2 obj2);
|
||||
|
||||
|
|
@ -5592,6 +5595,11 @@ public:
|
|||
*/
|
||||
Kernel::Point_2 operator()(const CGAL::Origin &CGAL::ORIGIN);
|
||||
|
||||
/*!
|
||||
extracts the bare point from the weighted point.
|
||||
*/
|
||||
Kernel::Point_2 operator()(const CGAL::Weighted_point_2& wp);
|
||||
|
||||
///@}
|
||||
|
||||
}; /* end Kernel::ConstructPoint_2 */
|
||||
|
|
@ -5617,6 +5625,11 @@ public:
|
|||
*/
|
||||
Kernel::Point_3 operator()(const CGAL::Origin &CGAL::ORIGIN);
|
||||
|
||||
/*!
|
||||
extracts the bare point from the weighted point.
|
||||
*/
|
||||
Kernel::Point_3 operator()(const CGAL::Weighted_point_3& wp);
|
||||
|
||||
///@}
|
||||
|
||||
}; /* end Kernel::ConstructPoint_3 */
|
||||
|
|
@ -5732,6 +5745,17 @@ public:
|
|||
|
||||
*/
|
||||
class ConstructRadicalAxis_2 {
|
||||
/// \name Operations
|
||||
/// A model of this concept must provide:
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
returns the radical line of the weighted points.
|
||||
*/
|
||||
Kernel::Line_2 operator()
|
||||
(const Kernel::Weighted_point_2& wp1,
|
||||
const Kernel::Weighted_point_2& wp2);
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include <CGAL/intersection_3.h>
|
||||
#include <CGAL/Kernel/Return_base_tag.h>
|
||||
#include <CGAL/Kernel/global_functions_3.h>
|
||||
#include <CGAL/predicates/predicates_on_weighted_points_cartesian_3.h>
|
||||
|
||||
|
||||
#include <cmath> // for Compute_dihedral_angle
|
||||
|
|
|
|||
|
|
@ -1,134 +0,0 @@
|
|||
// Copyright (c) 1997 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Tran Kai Frank DA <Frank.Da@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_PREDICATES_ON_WEIGHTED_POINTS_CARTESIAN_3
|
||||
#define CGAL_PREDICATES_ON_WEIGHTED_POINTS_CARTESIAN_3
|
||||
|
||||
#include <CGAL/determinant.h>
|
||||
#include <CGAL/enum.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class FT >
|
||||
Comparison_result
|
||||
compare_power_distanceC3(
|
||||
const FT &px, const FT &py, const FT &pz,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
|
||||
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
|
||||
{
|
||||
FT dqx = qx - px;
|
||||
FT dqy = qy - py;
|
||||
FT dqz = qz - pz;
|
||||
FT drx = rx - px;
|
||||
FT dry = ry - py;
|
||||
FT drz = rz - pz;
|
||||
return CGAL_NTS compare(dqx*dqx + dqy*dqy + dqz*dqz - qw,
|
||||
drx*drx + dry*dry + drz*drz - rw);
|
||||
}
|
||||
|
||||
|
||||
//return the sign of the power test of weighted point (sx,sy,sz,sw)
|
||||
//with respect to the smallest sphere orthogonal to
|
||||
//p,q,r
|
||||
template< class FT >
|
||||
CGAL_MEDIUM_INLINE
|
||||
Sign
|
||||
in_smallest_orthogonal_sphereC3(
|
||||
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 &rx, const FT &ry, const FT &rz, const FT &rw,
|
||||
const FT &sx, const FT &sy, const FT &sz, const FT &sw)
|
||||
{
|
||||
// Translate p to origin and compute determinants
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
|
||||
FT rpx = rx-px;
|
||||
FT rpy = ry-py;
|
||||
FT rpz = rz-pz;
|
||||
|
||||
FT qq = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + CGAL_NTS square(qpz);
|
||||
FT rr = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) + CGAL_NTS square(rpz);
|
||||
FT qr = qpx*rpx + qpy*rpy + qpz*rpz;
|
||||
|
||||
FT qpw = qq - qw + pw ;
|
||||
FT rpw = rr - rw + pw ;
|
||||
|
||||
FT den = determinant(qq,qr,
|
||||
qr,rr);
|
||||
FT detq = determinant(qpw,qr,
|
||||
rpw,rr);
|
||||
FT detr = determinant(qq,qpw,
|
||||
qr,rpw);
|
||||
|
||||
// Smallest smallest orthogonal sphere center
|
||||
// c = detq/2*den q + detr/2*den r (origin at p)
|
||||
// square radius c^2 - pw
|
||||
|
||||
FT spx = sx-px;
|
||||
FT spy = sy-py;
|
||||
FT spz = sz-pz;
|
||||
FT ss = CGAL_NTS square(spx) + CGAL_NTS square(spy) + CGAL_NTS square(spz);
|
||||
FT sq = spx*qpx + spy*qpy + spz*qpz;
|
||||
FT sr = spx*rpx + spy*rpy + spz*rpz;
|
||||
|
||||
CGAL_assertion( ! CGAL_NTS is_zero(den) );
|
||||
// return sign of (c- s)^2 - (c^2 - pw) - sw note that den >= 0 -
|
||||
return CGAL_NTS sign( den*(ss - sw + pw)- detq*sq - detr*sr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return the sign of the power test of weighted point (rx,ry,rz,rw)
|
||||
// with respect to the smallest sphere orthogoanal to
|
||||
// p,q
|
||||
template< class FT >
|
||||
Sign
|
||||
in_smallest_orthogonal_sphereC3(
|
||||
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 &rx, const FT &ry, const FT &rz, const FT &rw)
|
||||
{
|
||||
FT FT2(2);
|
||||
FT FT4(4);
|
||||
FT dpx = px - qx;
|
||||
FT dpy = py - qy;
|
||||
FT dpz = pz - qz;
|
||||
FT dpw = pw - qw;
|
||||
FT dp2 = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + CGAL_NTS square(dpz);
|
||||
FT drx = rx - (px + qx)/FT2;
|
||||
FT dry = ry - (py + qy)/FT2;
|
||||
FT drz = rz - (pz + qz)/FT2;
|
||||
FT drw = rw - (pw + qw)/FT2;
|
||||
FT dr2 = CGAL_NTS square(drx) + CGAL_NTS square(dry) + CGAL_NTS square(drz);
|
||||
FT dpr = dpx*drx + dpy*dry +dpz*drz;
|
||||
return CGAL_NTS sign (dr2 - dp2/FT4 + dpr*dpw/dp2 - drw );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
} //namespace CGAL
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
#endif //CGAL_PREDICATES_ON_WEIGHTED_POINTS_CARTESIAN_3
|
||||
|
|
@ -56,9 +56,6 @@ public:
|
|||
/// We do not pass \c const \c Arg_& because \c Arg_ is a ring number type
|
||||
Weighted_point operator()(Arg_ a1, Arg_ a2, Arg_ a3) const
|
||||
{
|
||||
// AF: check this
|
||||
//typedef typename Weighted_point::Point Bare_point;
|
||||
// return Weighted_point(Bare_point(a1,a2,a3));
|
||||
return Weighted_point(a1,a2,a3);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ minimum_dihedral_angle(
|
|||
template <typename K>
|
||||
typename K::FT
|
||||
minimum_dihedral_angle(
|
||||
const typename K::Bare_point& p0,
|
||||
const typename K::Bare_point& p1,
|
||||
const typename K::Bare_point& p2,
|
||||
const typename K::Bare_point& p3,
|
||||
const typename K::Point_3& p0,
|
||||
const typename K::Point_3& p1,
|
||||
const typename K::Point_3& p2,
|
||||
const typename K::Point_3& p3,
|
||||
K k = K())
|
||||
{
|
||||
typedef typename K::FT FT;
|
||||
|
|
@ -101,12 +101,16 @@ minimum_dihedral_angle(
|
|||
typename K::Compute_scalar_product_3 sp =
|
||||
k.compute_scalar_product_3_object();
|
||||
|
||||
typename K::Vector_3 v01 = p1-p0;
|
||||
typename K::Vector_3 v02 = p2-p0;
|
||||
typename K::Vector_3 v03 = p3-p0;
|
||||
typename K::Vector_3 v12 = p2-p1;
|
||||
typename K::Vector_3 v13 = p3-p1;
|
||||
typename K::Vector_3 v23 = p3-p2;
|
||||
typename K::Construct_vector_3 cv =
|
||||
k.construct_vector_3_object();
|
||||
|
||||
|
||||
typename K::Vector_3 v01 = cv(p0,p1);
|
||||
typename K::Vector_3 v02 = cv(p0,p2);
|
||||
typename K::Vector_3 v03 = cv(p0,p3);
|
||||
typename K::Vector_3 v12 = cv(p1,p2);
|
||||
typename K::Vector_3 v13 = cv(p1,p3);
|
||||
typename K::Vector_3 v23 = cv(p2,p3);
|
||||
|
||||
typename K::Vector_3 v_01_02 = cp(v01,v02);
|
||||
FT a_012 = v_01_02*v_01_02;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ Another name for the point type.
|
|||
typedef unspecified_type Bare_point;
|
||||
|
||||
/*!
|
||||
The weighted point type. It has to be
|
||||
a model of the concept `Kernel::WeightedPoint_2`.
|
||||
The weighted point type. It has to be a model of the concept `Kernel::WeightedPoint_2`,
|
||||
and it must be implicitely convertible from and to `Bare_point`.
|
||||
*/
|
||||
typedef unspecified_type Weighted_point_2;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,19 +29,6 @@
|
|||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
||||
#if 0
|
||||
typedef CGAL::Simple_cartesian<CGAL::Interval_nt<> > K;
|
||||
|
||||
int main()
|
||||
{
|
||||
K::Weighted_point_2 wp(K::Point_2(7.8, 1),2);
|
||||
std::cout << wp << std::endl;
|
||||
std::cout << wp.x() << std::endl;
|
||||
std::cout << K::Compute_x_2()(wp.point()) << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef CGAL::Regular_triangulation_euclidean_traits_2
|
||||
<CGAL::Exact_predicates_exact_constructions_kernel> RGt;
|
||||
|
|
@ -71,4 +58,4 @@ int main()
|
|||
std::cout << "done" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ or the weighted point \f$ {p}^{(w)}=(p,w_p)\f$.
|
|||
/// @{
|
||||
|
||||
/*!
|
||||
The weighted point type.
|
||||
The weighted point type. It has to be a model of the concept `Kernel::WeightedPoint_3`,
|
||||
and it must be implicitely convertible from and to `Bare_point`.
|
||||
*/
|
||||
typedef unspecified_type Weighted_point_3;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue