mirror of https://github.com/CGAL/cgal
Don't use the internal traits adapter
This commit is contained in:
parent
aee3b86b1f
commit
ea6e48e1e4
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include <CGAL/Triangulation_3.h>
|
||||
#include <CGAL/Regular_triangulation_cell_base_3.h>
|
||||
#include <CGAL/Weighted_point_triangulation_traits_3.h>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
|
||||
|
|
@ -72,25 +71,25 @@ namespace CGAL {
|
|||
template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default >
|
||||
class Regular_triangulation_3
|
||||
: public Triangulation_3<
|
||||
Weighted_point_triangulation_traits_3<Gt>,
|
||||
Gt,
|
||||
typename Default::Get<Tds_, Triangulation_data_structure_3 <
|
||||
Triangulation_vertex_base_3<Weighted_point_triangulation_traits_3<Gt> >,
|
||||
Regular_triangulation_cell_base_3<Weighted_point_triangulation_traits_3<Gt> > > >::type,
|
||||
Triangulation_vertex_base_3<Gt>,
|
||||
Regular_triangulation_cell_base_3<Gt> > >::type,
|
||||
Lock_data_structure_>
|
||||
{
|
||||
typedef Weighted_point_triangulation_traits_3<Gt> Wptt_3;
|
||||
|
||||
typedef Regular_triangulation_3<Gt, Tds_, Lock_data_structure_> Self;
|
||||
|
||||
typedef typename Default::Get<Tds_, Triangulation_data_structure_3 <
|
||||
Triangulation_vertex_base_3<Wptt_3>,
|
||||
Regular_triangulation_cell_base_3<Wptt_3> > >::type Tds;
|
||||
Triangulation_vertex_base_3<Gt>,
|
||||
Regular_triangulation_cell_base_3<Gt> > >::type Tds;
|
||||
|
||||
typedef Triangulation_3<Wptt_3,Tds,Lock_data_structure_> Tr_Base;
|
||||
typedef Triangulation_3<Gt,Tds,Lock_data_structure_> Tr_Base;
|
||||
|
||||
public:
|
||||
|
||||
typedef Tds Triangulation_data_structure;
|
||||
typedef Wptt_3 Geom_traits;
|
||||
typedef Gt Geom_traits;
|
||||
typedef Geom_traits Traits;
|
||||
typedef typename Tr_Base::Concurrency_tag Concurrency_tag;
|
||||
typedef typename Tr_Base::Lock_data_structure Lock_data_structure;
|
||||
|
|
@ -115,8 +114,8 @@ namespace CGAL {
|
|||
typedef typename Tr_Base::Finite_edges_iterator Finite_edges_iterator;
|
||||
typedef typename Tr_Base::All_cells_iterator All_cells_iterator;
|
||||
|
||||
typedef typename Wptt_3::Weighted_point_3 Weighted_point;
|
||||
typedef typename Wptt_3::Bare_point Bare_point;
|
||||
typedef typename Gt::Weighted_point_3 Weighted_point;
|
||||
typedef typename Gt::Bare_point Bare_point;
|
||||
typedef typename Gt::Segment_3 Segment;
|
||||
typedef typename Gt::Triangle_3 Triangle;
|
||||
typedef typename Gt::Tetrahedron_3 Tetrahedron;
|
||||
|
|
@ -166,11 +165,11 @@ namespace CGAL {
|
|||
using Tr_Base::is_valid;
|
||||
|
||||
Regular_triangulation_3(const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
|
||||
: Tr_Base(Wptt_3(gt), lock_ds), hidden_point_visitor(this)
|
||||
: Tr_Base(gt, lock_ds), hidden_point_visitor(this)
|
||||
{}
|
||||
|
||||
Regular_triangulation_3(Lock_data_structure *lock_ds, const Gt & gt = Gt())
|
||||
: Tr_Base(lock_ds, Wptt_3(gt)), hidden_point_visitor(this)
|
||||
: Tr_Base(lock_ds, gt), hidden_point_visitor(this)
|
||||
{}
|
||||
|
||||
Regular_triangulation_3(const Regular_triangulation_3 & rt)
|
||||
|
|
@ -183,7 +182,7 @@ namespace CGAL {
|
|||
template < typename InputIterator >
|
||||
Regular_triangulation_3(InputIterator first, InputIterator last,
|
||||
const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL)
|
||||
: Tr_Base(Wptt_3(gt), lock_ds), hidden_point_visitor(this)
|
||||
: Tr_Base(gt, lock_ds), hidden_point_visitor(this)
|
||||
{
|
||||
insert(first, last);
|
||||
}
|
||||
|
|
@ -191,7 +190,7 @@ namespace CGAL {
|
|||
template < typename InputIterator >
|
||||
Regular_triangulation_3(InputIterator first, InputIterator last,
|
||||
Lock_data_structure *lock_ds, const Gt & gt = Gt())
|
||||
: Tr_Base(Wptt_3(gt), lock_ds), hidden_point_visitor(this)
|
||||
: Tr_Base(gt, lock_ds), hidden_point_visitor(this)
|
||||
{
|
||||
insert(first, last);
|
||||
}
|
||||
|
|
@ -1557,8 +1556,10 @@ dual(Cell_handle c) const
|
|||
// dimension() == 3
|
||||
Cell_handle n = c->neighbor(i);
|
||||
Bare_point bp = dual(c);
|
||||
if ( ! is_infinite(c) && ! is_infinite(n) )
|
||||
return construct_object(construct_segment( dual(c), dual(n) ));
|
||||
if ( ! is_infinite(c) && ! is_infinite(n) ){
|
||||
Bare_point np = dual(n);
|
||||
return construct_object(construct_segment(bp, np));
|
||||
}
|
||||
|
||||
// either n or c is infinite
|
||||
int in;
|
||||
|
|
|
|||
|
|
@ -1,541 +0,0 @@
|
|||
// Copyright (c) 2004 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) : Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_CARTESIAN_3_H
|
||||
#define CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_CARTESIAN_3_H
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class FT>
|
||||
void
|
||||
determinants_for_weighted_circumcenterC3(
|
||||
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,
|
||||
FT &num_x, FT &num_y, FT &num_z, FT& den)
|
||||
{
|
||||
// translate origin to p
|
||||
// and compute determinants for weighted_circumcenter and
|
||||
// circumradius
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz) - qw + pw;
|
||||
FT rpx = rx-px;
|
||||
FT rpy = ry-py;
|
||||
FT rpz = rz-pz;
|
||||
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
|
||||
CGAL_NTS square(rpz) - rw + pw;
|
||||
FT spx = sx-px;
|
||||
FT spy = sy-py;
|
||||
FT spz = sz-pz;
|
||||
FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) +
|
||||
CGAL_NTS square(spz) - sw + pw;
|
||||
|
||||
num_x = determinant(qpy,qpz,qp2,
|
||||
rpy,rpz,rp2,
|
||||
spy,spz,sp2);
|
||||
num_y = determinant(qpx,qpz,qp2,
|
||||
rpx,rpz,rp2,
|
||||
spx,spz,sp2);
|
||||
num_z = determinant(qpx,qpy,qp2,
|
||||
rpx,rpy,rp2,
|
||||
spx,spy,sp2);
|
||||
den = determinant(qpx,qpy,qpz,
|
||||
rpx,rpy,rpz,
|
||||
spx,spy,spz);
|
||||
}
|
||||
|
||||
template <class FT>
|
||||
void
|
||||
determinants_for_circumcenterC3(
|
||||
const FT &px, const FT &py, const FT &pz,
|
||||
const FT &qx, const FT &qy, const FT &qz,
|
||||
const FT &rx, const FT &ry, const FT &rz,
|
||||
const FT &sx, const FT &sy, const FT &sz,
|
||||
FT &num_x, FT &num_y, FT &num_z, FT& den)
|
||||
{
|
||||
// translate origin to p
|
||||
// and compute determinants for weighted_circumcenter and
|
||||
// circumradius
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz);
|
||||
FT rpx = rx-px;
|
||||
FT rpy = ry-py;
|
||||
FT rpz = rz-pz;
|
||||
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
|
||||
CGAL_NTS square(rpz);
|
||||
FT spx = sx-px;
|
||||
FT spy = sy-py;
|
||||
FT spz = sz-pz;
|
||||
FT sp2 = CGAL_NTS square(spx) + CGAL_NTS square(spy) +
|
||||
CGAL_NTS square(spz);
|
||||
|
||||
num_x = determinant(qpy,qpz,qp2,
|
||||
rpy,rpz,rp2,
|
||||
spy,spz,sp2);
|
||||
num_y = determinant(qpx,qpz,qp2,
|
||||
rpx,rpz,rp2,
|
||||
spx,spz,sp2);
|
||||
num_z = determinant(qpx,qpy,qp2,
|
||||
rpx,rpy,rp2,
|
||||
spx,spy,sp2);
|
||||
den = determinant(qpx,qpy,qpz,
|
||||
rpx,rpy,rpz,
|
||||
spx,spy,spz);
|
||||
}
|
||||
|
||||
|
||||
template < class FT>
|
||||
void
|
||||
weighted_circumcenterC3(
|
||||
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,
|
||||
FT &x, FT &y, FT &z)
|
||||
{
|
||||
// this function compute the weighted circumcenter point only
|
||||
|
||||
// Translate p to origin and compute determinants
|
||||
FT num_x, num_y, num_z, den;
|
||||
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
|
||||
qx, qy, qz, qw,
|
||||
rx, ry, rz, rw,
|
||||
sx, sy, sz, sw,
|
||||
num_x, num_y, num_z,den);
|
||||
|
||||
CGAL_assertion( ! CGAL_NTS is_zero(den) );
|
||||
FT inv = FT(1)/(FT(2) * den);
|
||||
|
||||
x = px + num_x*inv;
|
||||
y = py - num_y*inv;
|
||||
z = pz + num_z*inv;
|
||||
}
|
||||
|
||||
template < class FT>
|
||||
void
|
||||
weighted_circumcenterC3(
|
||||
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,
|
||||
FT &x, FT &y, FT &z, FT &w)
|
||||
{
|
||||
// this function compute the weighted circumcenter point
|
||||
// and the squared weighted circumradius
|
||||
|
||||
// Translate p to origin and compute determinants
|
||||
FT num_x, num_y, num_z, den;
|
||||
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
|
||||
qx, qy, qz, qw,
|
||||
rx, ry, rz, rw,
|
||||
sx, sy, sz, sw,
|
||||
num_x, num_y, num_z, den);
|
||||
|
||||
CGAL_assertion( ! CGAL_NTS is_zero(den) );
|
||||
FT inv = FT(1)/(FT(2) * den);
|
||||
|
||||
x = px + num_x*inv;
|
||||
y = py - num_y*inv;
|
||||
z = pz + num_z*inv;
|
||||
|
||||
w = (CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
|
||||
*CGAL_NTS square(inv) - pw;
|
||||
}
|
||||
|
||||
|
||||
template< class FT >
|
||||
FT
|
||||
squared_radius_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)
|
||||
{
|
||||
|
||||
// this function compute the squared weighted circumradius only
|
||||
|
||||
// Translate p to origin and compute determinants
|
||||
FT num_x, num_y, num_z, den;
|
||||
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
|
||||
qx, qy, qz, qw,
|
||||
rx, ry, rz, rw,
|
||||
sx, sy, sz, sw,
|
||||
num_x, num_y, num_z,den);
|
||||
|
||||
CGAL_assertion( ! CGAL_NTS is_zero(den) );
|
||||
FT inv = FT(1)/(FT(2) * den);
|
||||
|
||||
return
|
||||
(CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
|
||||
*CGAL_NTS square(inv) - pw;
|
||||
}
|
||||
|
||||
|
||||
template <class FT>
|
||||
void
|
||||
determinants_for_weighted_circumcenterC3(
|
||||
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 &num_x, FT &num_y, FT &num_z, FT &den)
|
||||
{
|
||||
// translate origin to p
|
||||
// and compute determinants for weighted_circumcenter and
|
||||
// circumradius
|
||||
|
||||
// Translate s to origin to simplify the expression.
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz) - qw + pw;
|
||||
FT rpx = rx-px;
|
||||
FT rpy = ry-py;
|
||||
FT rpz = rz-pz;
|
||||
FT rp2 = CGAL_NTS square(rpx) + CGAL_NTS square(rpy) +
|
||||
CGAL_NTS square(rpz) - rw + pw;
|
||||
|
||||
FT sx = qpy*rpz-qpz*rpy;
|
||||
FT sy = qpz*rpx-qpx*rpz;
|
||||
FT sz = qpx*rpy-qpy*rpx;
|
||||
|
||||
// The following determinants can be developped and simplified.
|
||||
//
|
||||
// FT num_x = determinant(qpy,qpz,qp2,
|
||||
// rpy,rpz,rp2,
|
||||
// sy,sz,FT(0));
|
||||
// FT num_y = determinant(qpx,qpz,qp2,
|
||||
// rpx,rpz,rp2,
|
||||
// sx,sz,FT(0));
|
||||
// FT num_z = determinant(qpx,qpy,qp2,
|
||||
// rpx,rpy,rp2,
|
||||
// sx,sy,FT(0));
|
||||
|
||||
num_x = qp2 * determinant(rpy,rpz,sy,sz)
|
||||
- rp2 * determinant(qpy,qpz,sy,sz);
|
||||
|
||||
num_y = qp2 * determinant(rpx,rpz,sx,sz)
|
||||
- rp2 * determinant(qpx,qpz,sx,sz);
|
||||
|
||||
num_z = qp2 * determinant(rpx,rpy,sx,sy)
|
||||
- rp2 * determinant(qpx,qpy,sx,sy);
|
||||
|
||||
den = determinant(qpx,qpy,qpz,
|
||||
rpx,rpy,rpz,
|
||||
sx,sy,sz);
|
||||
}
|
||||
|
||||
template < class FT >
|
||||
void
|
||||
weighted_circumcenterC3(
|
||||
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 &x, FT &y, FT &z)
|
||||
{
|
||||
// this function compute the weighted circumcenter point only
|
||||
|
||||
// Translate p to origin and compute determinants
|
||||
FT num_x, num_y, num_z, den;
|
||||
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
|
||||
qx, qy, qz, qw,
|
||||
rx, ry, rz, rw,
|
||||
num_x, num_y, num_z, den);
|
||||
|
||||
CGAL_assertion( den != FT(0) );
|
||||
FT inv = FT(1)/(FT(2) * den);
|
||||
|
||||
x = px + num_x*inv;
|
||||
y = py - num_y*inv;
|
||||
z = pz + num_z*inv;
|
||||
}
|
||||
|
||||
|
||||
template < class FT >
|
||||
void
|
||||
weighted_circumcenterC3(
|
||||
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 &x, FT &y, FT &z, FT &w)
|
||||
{
|
||||
// this function compute the weighted circumcenter and
|
||||
// the weighted squared circumradius
|
||||
|
||||
// Translate p to origin and compute determinants
|
||||
FT num_x, num_y, num_z, den;
|
||||
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
|
||||
qx, qy, qz, qw,
|
||||
rx, ry, rz, rw,
|
||||
num_x, num_y, num_z, den);
|
||||
|
||||
CGAL_assertion( den != FT(0) );
|
||||
FT inv = FT(1)/(FT(2) * den);
|
||||
|
||||
x = px + num_x*inv;
|
||||
y = py - num_y*inv;
|
||||
z = pz + num_z*inv;
|
||||
|
||||
w = (CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
|
||||
*CGAL_NTS square(inv) - pw;
|
||||
}
|
||||
|
||||
|
||||
template< class FT >
|
||||
CGAL_MEDIUM_INLINE
|
||||
FT
|
||||
squared_radius_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)
|
||||
{
|
||||
// this function compute the weighted squared circumradius only
|
||||
|
||||
// Translate p to origin and compute determinants
|
||||
FT num_x, num_y, num_z, den;
|
||||
determinants_for_weighted_circumcenterC3(px, py, pz, pw,
|
||||
qx, qy, qz, qw,
|
||||
rx, ry, rz, rw,
|
||||
num_x, num_y, num_z, den);
|
||||
|
||||
CGAL_assertion( den != FT(0) );
|
||||
FT inv = FT(1)/(FT(2) * den);
|
||||
|
||||
return
|
||||
(CGAL_NTS square(num_x)+CGAL_NTS square(num_y)+CGAL_NTS square(num_z))
|
||||
*CGAL_NTS square(inv) - pw;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template < class FT >
|
||||
void
|
||||
weighted_circumcenterC3(
|
||||
const FT &px, const FT &py, const FT &pz, const FT &pw,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
|
||||
FT &x, FT &y, FT &z)
|
||||
{
|
||||
// this function compute the weighted circumcenter point only
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz);
|
||||
FT inv = FT(1)/(FT(2)*qp2);
|
||||
FT alpha = 1/FT(2) + (pw-qw)*inv;
|
||||
|
||||
x = px + alpha * qpx;
|
||||
y = py + alpha * qpy;
|
||||
z = pz + alpha * qpz;
|
||||
}
|
||||
|
||||
|
||||
template < class FT >
|
||||
void
|
||||
weighted_circumcenterC3(
|
||||
const FT &px, const FT &py, const FT &pz, const FT &pw,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qw,
|
||||
FT &x, FT &y, FT &z, FT &w)
|
||||
{
|
||||
// this function compute the weighted circumcenter point and
|
||||
// the weighted circumradius
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz);
|
||||
FT inv = FT(1)/(FT(2)*qp2);
|
||||
FT alpha = 1/FT(2) + (pw-qw)*inv;
|
||||
|
||||
x = px + alpha * qpx;
|
||||
y = py + alpha * qpy;
|
||||
z = pz + alpha * qpz;
|
||||
|
||||
w = CGAL_NTS square(alpha)*qp2 - pw;
|
||||
}
|
||||
|
||||
|
||||
template< class FT >
|
||||
CGAL_MEDIUM_INLINE
|
||||
FT
|
||||
squared_radius_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)
|
||||
{
|
||||
// this function computes
|
||||
// the weighted circumradius only
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz);
|
||||
FT inv = FT(1)/(FT(2)*qp2);
|
||||
FT alpha = 1/FT(2) + (pw-qw)*inv;
|
||||
|
||||
return CGAL_NTS square(alpha)*qp2 - pw;
|
||||
}
|
||||
|
||||
|
||||
template< class FT >
|
||||
FT
|
||||
power_productC3(
|
||||
const FT &px, const FT &py, const FT &pz, const FT &pw,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qw)
|
||||
{
|
||||
// computes the power product of two weighted points
|
||||
FT qpx = qx-px;
|
||||
FT qpy = qy-py;
|
||||
FT qpz = qz-pz;
|
||||
FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) +
|
||||
CGAL_NTS square(qpz);
|
||||
return qp2 - pw - qw ;
|
||||
}
|
||||
|
||||
template < class RT , class We>
|
||||
void
|
||||
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 &rx, const RT &ry, const RT &rz, const We & /* rw */,
|
||||
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;
|
||||
|
||||
//il manque des tests...
|
||||
|
||||
a= RT(1)*determinant(dqy, dqz, dry, drz);
|
||||
b= - RT(1)*determinant(dqx, dqz, drx, drz);
|
||||
c= RT(1)*determinant(dqx, dqy, drx, dry);
|
||||
}
|
||||
|
||||
// function used in critical_squared_radiusC3
|
||||
// power ( t, tw) with respect to
|
||||
// circle orthogonal (p,pw), (q,qw), (r,rw), (s,sw)
|
||||
template < class FT>
|
||||
FT
|
||||
power_to_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,
|
||||
const FT &tx, const FT &ty, const FT &tz, const FT &tw)
|
||||
{
|
||||
//to get the value of the determinant
|
||||
// We translate the points so that t becomes the origin.
|
||||
FT dpx = px - tx;
|
||||
FT dpy = py - ty;
|
||||
FT dpz = pz - tz;
|
||||
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
|
||||
CGAL_NTS square(dpz) - pw + tw ;
|
||||
FT dqx = qx - tx;
|
||||
FT dqy = qy - ty;
|
||||
FT dqz = qz - tz;
|
||||
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
|
||||
CGAL_NTS square(dqz) - qw + tw;
|
||||
FT drx = rx - tx;
|
||||
FT dry = ry - ty;
|
||||
FT drz = rz - tz;
|
||||
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
|
||||
CGAL_NTS square(drz) - rw + tw;
|
||||
FT dsx = sx - tx;
|
||||
FT dsy = sy - ty;
|
||||
FT dsz = sz - tz;
|
||||
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
|
||||
CGAL_NTS square(dsz) - sw + tw;
|
||||
|
||||
return determinant(dpx, dpy, dpz, dpt,
|
||||
dqx, dqy, dqz, dqt,
|
||||
drx, dry, drz, drt,
|
||||
dsx, dsy, dsz, dst);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// compute the critical weight tw
|
||||
// where weighted point t is orthogonal to weighted points p, q,r,s
|
||||
template < class FT>
|
||||
FT
|
||||
critical_squared_radiusC3(
|
||||
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,
|
||||
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 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 ff1 = power_to_orthogonal_sphereC3(px, py, pz, pw,
|
||||
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
|
||||
// intersect the triangle formed by the centers.
|
||||
// // resolution of the system (where we note c the center)
|
||||
// // | dc^2 = cw + rw
|
||||
// // | (dp-dc)^2 = pw + cw
|
||||
// // | (dq-dc)^2 = qw + cw
|
||||
// // | dc = Lamdba*dp + Mu*dq
|
||||
|
||||
// FT FT2(2);
|
||||
// FT dpx = px-rx;
|
||||
// FT dpy = py-ry;
|
||||
// FT dpz = pz-rz;
|
||||
// FT dp = CGAL_NTS square(dpx)+CGAL_NTS square(dpy)+CGAL_NTS square(dpz);
|
||||
// FT dpp = dp-pw+rw;
|
||||
// FT dqx = qx-rx;
|
||||
// FT dqy = qy-ry;
|
||||
// FT dqz = qz-rz;
|
||||
// FT dq = CGAL_NTS square(dqx)+CGAL_NTS square(dqy)+CGAL_NTS square(dqz);
|
||||
// FT dqq = dq-qw+rw;
|
||||
// FT dpdq = dpx*dqx+dpy*dqy+dpz*dqz;
|
||||
// FT denom = FT2*(dp*dq-CGAL_NTS square(dpdq));
|
||||
// FT Lambda = (dpp*dq-dqq*dpdq)/denom;
|
||||
// FT Mu = (dqq*dp-dpp*dpdq)/denom;
|
||||
|
||||
// return (CGAL_NTS square(Lambda)*dp+CGAL_NTS square(Mu)*dq
|
||||
// +FT2*Lambda*Mu*dpdq - rw);
|
||||
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
#endif //CGAL_CONSTRUCTIONS_ON_WEIGHTED_POINTS_CARTESIAN_3_H
|
||||
|
|
@ -1,164 +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
|
||||
// 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_FTC3_H
|
||||
#define CGAL_REGULAR_TRIANGULATION_FTC3_H
|
||||
|
||||
#include <CGAL/number_utils.h>
|
||||
#include <CGAL/predicates/sign_of_determinant.h>
|
||||
|
||||
// This file contains the low level cartesian predicates
|
||||
// used by the 3D regular triangulation.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// return minus the sign of the 5x5 determinant [P,Q,R,S,T]
|
||||
// where column [P] = transpose[px,py,pz,p^2 -wp,1]
|
||||
template <class FT>
|
||||
Oriented_side
|
||||
power_testC3( const FT &px, const FT &py, const FT &pz, const FT &pwt,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
|
||||
const FT &rx, const FT &ry, const FT &rz, const FT &rwt,
|
||||
const FT &sx, const FT &sy, const FT &sz, const FT &swt,
|
||||
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
|
||||
{
|
||||
// We translate the points so that T becomes the origin.
|
||||
FT dpx = px - tx;
|
||||
FT dpy = py - ty;
|
||||
FT dpz = pz - tz;
|
||||
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
|
||||
CGAL_NTS square(dpz) + (twt - pwt);
|
||||
FT dqx = qx - tx;
|
||||
FT dqy = qy - ty;
|
||||
FT dqz = qz - tz;
|
||||
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
|
||||
CGAL_NTS square(dqz) + (twt - qwt);
|
||||
FT drx = rx - tx;
|
||||
FT dry = ry - ty;
|
||||
FT drz = rz - tz;
|
||||
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
|
||||
CGAL_NTS square(drz) + (twt - rwt);
|
||||
FT dsx = sx - tx;
|
||||
FT dsy = sy - ty;
|
||||
FT dsz = sz - tz;
|
||||
FT dst = CGAL_NTS square(dsx) + CGAL_NTS square(dsy) +
|
||||
CGAL_NTS square(dsz) + (twt - swt);
|
||||
|
||||
return - sign_of_determinant(dpx, dpy, dpz, dpt,
|
||||
dqx, dqy, dqz, dqt,
|
||||
drx, dry, drz, drt,
|
||||
dsx, dsy, dsz, dst);
|
||||
}
|
||||
|
||||
|
||||
template <class FT>
|
||||
Oriented_side
|
||||
power_testC3( const FT &px, const FT &py, const FT &pz, const FT &pwt,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
|
||||
const FT &rx, const FT &ry, const FT &rz, const FT &rwt,
|
||||
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
|
||||
{
|
||||
// Same translation as above.
|
||||
FT dpx = px - tx;
|
||||
FT dpy = py - ty;
|
||||
FT dpz = pz - tz;
|
||||
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
|
||||
CGAL_NTS square(dpz) + (twt - pwt);
|
||||
FT dqx = qx - tx;
|
||||
FT dqy = qy - ty;
|
||||
FT dqz = qz - tz;
|
||||
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
|
||||
CGAL_NTS square(dqz) + (twt - qwt);
|
||||
FT drx = rx - tx;
|
||||
FT dry = ry - ty;
|
||||
FT drz = rz - tz;
|
||||
FT drt = CGAL_NTS square(drx) + CGAL_NTS square(dry) +
|
||||
CGAL_NTS square(drz) + (twt - rwt);
|
||||
Sign cmp;
|
||||
|
||||
// Projection on the (xy) plane.
|
||||
cmp = sign_of_determinant(dpx, dpy, dpt,
|
||||
dqx, dqy, dqt,
|
||||
drx, dry, drt);
|
||||
if (cmp != ZERO)
|
||||
return cmp * sign_of_determinant(px-rx, py-ry,
|
||||
qx-rx, qy-ry);
|
||||
|
||||
// Projection on the (xz) plane.
|
||||
cmp = sign_of_determinant(dpx, dpz, dpt,
|
||||
dqx, dqz, dqt,
|
||||
drx, drz, drt);
|
||||
if (cmp != ZERO)
|
||||
return cmp * sign_of_determinant(px-rx, pz-rz,
|
||||
qx-rx, qz-rz);
|
||||
|
||||
// Projection on the (yz) plane.
|
||||
cmp = sign_of_determinant(dpy, dpz, dpt,
|
||||
dqy, dqz, dqt,
|
||||
dry, drz, drt);
|
||||
return cmp * sign_of_determinant(py-ry, pz-rz,
|
||||
qy-ry, qz-rz);
|
||||
}
|
||||
|
||||
|
||||
template <class FT>
|
||||
Oriented_side
|
||||
power_testC3( const FT &px, const FT &py, const FT &pz, const FT &pwt,
|
||||
const FT &qx, const FT &qy, const FT &qz, const FT &qwt,
|
||||
const FT &tx, const FT &ty, const FT &tz, const FT &twt)
|
||||
{
|
||||
// Same translation as above.
|
||||
FT dpx = px - tx;
|
||||
FT dpy = py - ty;
|
||||
FT dpz = pz - tz;
|
||||
FT dpt = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) +
|
||||
CGAL_NTS square(dpz) + (twt - pwt);
|
||||
FT dqx = qx - tx;
|
||||
FT dqy = qy - ty;
|
||||
FT dqz = qz - tz;
|
||||
FT dqt = CGAL_NTS square(dqx) + CGAL_NTS square(dqy) +
|
||||
CGAL_NTS square (dqz) + (twt - qwt);
|
||||
Comparison_result cmp;
|
||||
|
||||
// We do an orthogonal projection on the (x) axis, if possible.
|
||||
cmp = CGAL_NTS compare(px, qx);
|
||||
if (cmp != EQUAL)
|
||||
return cmp * sign_of_determinant(dpx, dpt, dqx, dqt);
|
||||
|
||||
// We do an orthogonal projection on the (y) axis, if possible.
|
||||
cmp = CGAL_NTS compare(py, qy);
|
||||
if (cmp != EQUAL)
|
||||
return cmp * sign_of_determinant(dpy, dpt, dqy, dqt);
|
||||
|
||||
// We do an orthogonal projection on the (z) axis.
|
||||
cmp = CGAL_NTS compare(pz, qz);
|
||||
return cmp * sign_of_determinant(dpz, dpt, dqz, dqt);
|
||||
}
|
||||
|
||||
template <class FT>
|
||||
Oriented_side
|
||||
power_testC3(const FT &pwt, const FT &qwt)
|
||||
{
|
||||
return CGAL_NTS compare(qwt, pwt);
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_REGULAR_TRIANGULATION_FTC3_H
|
||||
Loading…
Reference in New Issue