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:
Sebastien Loriot 2021-06-25 09:50:39 +02:00 committed by GitHub
commit 2e625cbfaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 78 additions and 19 deletions

View File

@ -336,11 +336,33 @@ public:
FT
> 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());
if(lr && (! lr->et)){
auto& obj = *p.ptr();
const char* tn = typeid(obj).name();
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);
}
@ -366,11 +388,33 @@ public:
FT
> 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());
if(lr && (! lr->et)){
auto& obj = *p.ptr();
const char* tn = typeid(obj).name();
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);
}
@ -413,15 +457,22 @@ public:
int
> LRint;
LR * lr = dynamic_cast<LR*>(p.ptr());
if(lr && (! lr->et)){
auto& obj = *p.ptr();
const char* tn = typeid(obj).name();
if(tn == typeid(LR).name()){
LR * lr = static_cast<LR*>(p.ptr());
if(lr->is_lazy()){
return std::get<1>(lr->l);
}
}else{
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
if(lrint && (! lrint->et)){
if(tn == typeid(LRint).name()){
LRint* lrint = static_cast<LRint*>(p.ptr());
if(lrint->is_lazy()){
return std::get<1>(lrint->l);
}
}
}
return BaseClass().construct_point_2_object()(p);
}
@ -465,21 +516,29 @@ public:
int
> LRint;
auto& obj = *p.ptr();
const char* tn = typeid(obj).name();
LR * lr = dynamic_cast<LR*>(p.ptr());
if(lr && (! lr->et)){
if(tn == typeid(LR).name()){
LR * lr = static_cast<LR*>(p.ptr());
if(lr->is_lazy()){
return std::get<1>(lr->l);
}
}else{
LRint* lrint = dynamic_cast<LRint*>(p.ptr());
if(lrint && (! lrint->et)){
if(tn == typeid(LRint).name()){
LRint* lrint = static_cast<LRint*>(p.ptr());
if(lrint->is_lazy()){
return std::get<1>(lrint->l);
}
}
}
return BaseClass().construct_point_3_object()(p);
}
};
struct Less_xyz_3 : public BaseClass::Less_xyz_3
{
typedef typename Kernel_::Point_3 Point_3;