mirror of https://github.com/CGAL/cgal
Add Orientation_3::operator()(Origin,Point_3,Point_3,Point_3)
This commit is contained in:
parent
e27855980a
commit
f01e24c75b
|
|
@ -4307,6 +4307,15 @@ namespace CartesianKernelFunctors {
|
|||
w.x(), w.y(), w.z());
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()( Origin o, const Point_3& u,
|
||||
const Point_3& v, const Point_3& w) const
|
||||
{
|
||||
return orientationC3(u.x(), u.y(), u.z(),
|
||||
v.x(), v.y(), v.z(),
|
||||
w.x(), w.y(), w.z());
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()( const Tetrahedron_3& t) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,10 @@ class Epic_converter {
|
|||
typedef typename IK::FT IK_FT;
|
||||
public:
|
||||
|
||||
|
||||
std::pair<Origin, bool> operator()(Origin o) const
|
||||
{
|
||||
return std::make_pair(o, true);
|
||||
}
|
||||
|
||||
std::pair<double,bool> operator()(const typename IK::FT n) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
// Author(s) : Andreas Fabri, Laurent Rineau
|
||||
|
||||
#ifndef CGAL_STATIC_FILTERED_PREDICATE_H
|
||||
|
|
@ -127,23 +126,29 @@ public:
|
|||
result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) const
|
||||
{
|
||||
CGAL::Epic_converter<AK> convert;
|
||||
typedef typename Kernel_traits<A1>::type EK;
|
||||
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
|
||||
typedef typename Kernel_traits<A1>::type EK1;
|
||||
typedef typename Type_mapper<A1,EK1,Exact_predicates_inexact_constructions_kernel>::type T1;
|
||||
std::pair<T1,bool> aa1 = convert(a1.approx());
|
||||
if(! aa1.second){
|
||||
return fp(a1, a2, a3, a4);
|
||||
}
|
||||
typedef typename Type_mapper<A2,EK,Exact_predicates_inexact_constructions_kernel>::type T2;
|
||||
|
||||
typedef typename Kernel_traits<A2>::type EK2;
|
||||
typedef typename Type_mapper<A2,EK2,Exact_predicates_inexact_constructions_kernel>::type T2;
|
||||
std::pair<T2,bool> aa2 = convert(a2.approx());
|
||||
if(! aa2.second){
|
||||
return fp(a1, a2, a3, a4);
|
||||
}
|
||||
typedef typename Type_mapper<A3,EK,Exact_predicates_inexact_constructions_kernel>::type T3;
|
||||
|
||||
typedef typename Kernel_traits<A3>::type EK3;
|
||||
typedef typename Type_mapper<A3,EK3,Exact_predicates_inexact_constructions_kernel>::type T3;
|
||||
std::pair<T3,bool> aa3 = convert(a3.approx());
|
||||
if(! aa3.second){
|
||||
return fp(a1, a2, a3, a4);
|
||||
}
|
||||
typedef typename Type_mapper<A4,EK,Exact_predicates_inexact_constructions_kernel>::type T4;
|
||||
|
||||
typedef typename Kernel_traits<A4>::type EK4;
|
||||
typedef typename Type_mapper<A4,EK4,Exact_predicates_inexact_constructions_kernel>::type T4;
|
||||
std::pair<T4,bool> aa4 = convert(a4.approx());
|
||||
if(! aa4.second){
|
||||
return fp(a1, a2, a3, a4);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,18 @@
|
|||
namespace CGAL {
|
||||
|
||||
class Origin
|
||||
{};
|
||||
{
|
||||
public:
|
||||
const Origin& approx() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Origin& exact() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class Null_vector
|
||||
{};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
//#define CGAL_PROFILE
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Timer.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
typedef K::Point_3 Point_3;
|
||||
typedef CGAL::Timer Timer;
|
||||
|
||||
int main(int argc, char* argv[] )
|
||||
{
|
||||
std::ifstream ifs((argc>1)? argv[1]:CGAL::data_file_path("points/cube.xyz"));
|
||||
|
||||
std::vector<Point_3> points;
|
||||
Point_3 p;
|
||||
|
||||
while(ifs >> p){
|
||||
points.push_back(p);
|
||||
}
|
||||
|
||||
const int N = points.size()-3;
|
||||
|
||||
const K::Orientation_3 orientation = K().orientation_3_object();
|
||||
|
||||
int positive = 0;
|
||||
Timer t;
|
||||
t.start();
|
||||
{
|
||||
|
||||
for(int k = 0; k < 100; ++k)
|
||||
for(int i = 0; i < N; ++i){
|
||||
Point_3 o(CGAL::ORIGIN);
|
||||
if(orientation(o, points[i], points[i+1], points[i+2]) == CGAL::POSITIVE){
|
||||
++positive;
|
||||
}
|
||||
}
|
||||
}
|
||||
t.stop();
|
||||
|
||||
std::cout << t.time() << " sec." << std::endl;
|
||||
|
||||
t.reset();
|
||||
t.start();
|
||||
{
|
||||
for (int k = 0; k < 100; ++k)
|
||||
for(int i = 0; i < N; ++i){
|
||||
if(orientation(CGAL::ORIGIN, points[i], points[i+1], points[i+2]) == CGAL::POSITIVE){
|
||||
--positive;
|
||||
}
|
||||
}
|
||||
}
|
||||
t.stop();
|
||||
|
||||
assert(positive == 0);
|
||||
std::cout << t.time() << " sec." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue