mirror of https://github.com/CGAL/cgal
Merge pull request #5775 from afabri/Filtered_kernel-Construct_point-mglisse
fast dynamic_cast in Lazy_kernel::Construct_point_3
This commit is contained in:
commit
2e625cbfaf
|
|
@ -336,11 +336,33 @@ public:
|
||||||
FT
|
FT
|
||||||
> LR;
|
> LR;
|
||||||
|
|
||||||
|
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_2,
|
||||||
|
typename Exact_kernel::Weighted_point_2,
|
||||||
|
typename Approximate_kernel::Construct_weighted_point_2,
|
||||||
|
typename Exact_kernel::Construct_weighted_point_2,
|
||||||
|
E2A_,
|
||||||
|
Return_base_tag,
|
||||||
|
Point_2,
|
||||||
|
int
|
||||||
|
> LRint;
|
||||||
|
|
||||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
auto& obj = *p.ptr();
|
||||||
if(lr && (! lr->et)){
|
const char* tn = typeid(obj).name();
|
||||||
return std::get<2>(lr->l);
|
|
||||||
|
if(tn == typeid(LR).name()){
|
||||||
|
LR * lr = static_cast<LR*>(p.ptr());
|
||||||
|
if(lr->is_lazy()){
|
||||||
|
return std::get<2>(lr->l);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(tn == typeid(LRint).name()){
|
||||||
|
LRint* lrint = static_cast<LRint*>(p.ptr());
|
||||||
|
if(lrint->is_lazy()){
|
||||||
|
return std::get<2>(lrint->l);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BaseClass().compute_weight_2_object()(p);
|
return BaseClass().compute_weight_2_object()(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -366,11 +388,33 @@ public:
|
||||||
FT
|
FT
|
||||||
> LR;
|
> LR;
|
||||||
|
|
||||||
|
typedef Lazy_rep_n<typename Approximate_kernel::Weighted_point_3,
|
||||||
|
typename Exact_kernel::Weighted_point_3,
|
||||||
|
typename Approximate_kernel::Construct_weighted_point_3,
|
||||||
|
typename Exact_kernel::Construct_weighted_point_3,
|
||||||
|
E2A_,
|
||||||
|
Return_base_tag,
|
||||||
|
Point_3,
|
||||||
|
int
|
||||||
|
> LRint;
|
||||||
|
|
||||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
auto& obj = *p.ptr();
|
||||||
if(lr && (! lr->et)){
|
const char* tn = typeid(obj).name();
|
||||||
return std::get<2>(lr->l);
|
|
||||||
|
if(tn == typeid(LR).name()){
|
||||||
|
LR * lr = static_cast<LR*>(p.ptr());
|
||||||
|
if(lr->is_lazy()){
|
||||||
|
return std::get<2>(lr->l);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(tn == typeid(LRint).name()){
|
||||||
|
LRint* lrint = static_cast<LRint*>(p.ptr());
|
||||||
|
if(lrint->is_lazy()){
|
||||||
|
return std::get<2>(lrint->l);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BaseClass().compute_weight_3_object()(p);
|
return BaseClass().compute_weight_3_object()(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,13 +457,20 @@ public:
|
||||||
int
|
int
|
||||||
> LRint;
|
> LRint;
|
||||||
|
|
||||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
auto& obj = *p.ptr();
|
||||||
if(lr && (! lr->et)){
|
const char* tn = typeid(obj).name();
|
||||||
return std::get<1>(lr->l);
|
|
||||||
} else {
|
if(tn == typeid(LR).name()){
|
||||||
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
|
LR * lr = static_cast<LR*>(p.ptr());
|
||||||
if(lrint && (! lrint->et)){
|
if(lr->is_lazy()){
|
||||||
return std::get<1>(lrint->l);
|
return std::get<1>(lr->l);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(tn == typeid(LRint).name()){
|
||||||
|
LRint* lrint = static_cast<LRint*>(p.ptr());
|
||||||
|
if(lrint->is_lazy()){
|
||||||
|
return std::get<1>(lrint->l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -465,21 +516,29 @@ public:
|
||||||
int
|
int
|
||||||
> LRint;
|
> LRint;
|
||||||
|
|
||||||
|
auto& obj = *p.ptr();
|
||||||
|
const char* tn = typeid(obj).name();
|
||||||
|
|
||||||
LR * lr = dynamic_cast<LR*>(p.ptr());
|
if(tn == typeid(LR).name()){
|
||||||
if(lr && (! lr->et)){
|
LR * lr = static_cast<LR*>(p.ptr());
|
||||||
return std::get<1>(lr->l);
|
if(lr->is_lazy()){
|
||||||
|
return std::get<1>(lr->l);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
|
if(tn == typeid(LRint).name()){
|
||||||
if(lrint && (! lrint->et)){
|
LRint* lrint = static_cast<LRint*>(p.ptr());
|
||||||
return std::get<1>(lrint->l);
|
if(lrint->is_lazy()){
|
||||||
|
return std::get<1>(lrint->l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BaseClass().construct_point_3_object()(p);
|
return BaseClass().construct_point_3_object()(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Less_xyz_3 : public BaseClass::Less_xyz_3
|
struct Less_xyz_3 : public BaseClass::Less_xyz_3
|
||||||
{
|
{
|
||||||
typedef typename Kernel_::Point_3 Point_3;
|
typedef typename Kernel_::Point_3 Point_3;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue