CGAL中用球面测地线构造Polycurve的问题与方案咨询
在CGAL中基于球面测地线构造Polycurve的编译问题
我尝试在CGAL中基于球面测地线构造polycurve。类模板CGAL::Arr_polycurve_traits_2<SubcurveTraits_2>要求SubcurveTraits_2必须是ArrangementTraits_2和ArrangementDirectionalXMonotoneTraits_2概念的模型。我使用CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel>(属于球面圆弧子集)作为子特征类,但它仅满足ArrangementTraits_2,不满足ArrangementDirectionalXMonotoneTraits_2,导致编译错误。
测试代码
#include <iostream> #include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h> #include <CGAL/Arr_spherical_topology_traits_2.h> #include <CGAL/Surface_sweep_2_algorithms.h> #include <CGAL/point_generators_3.h> #include <CGAL/Arr_spherical_topology_traits_2.h> #include <CGAL/Arrangement_on_surface_2.h> #include <Eigen/Core> #include <CGAL/Arr_polycurve_traits_2.h> using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; using Geom_traits = CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel>; using Point = Geom_traits::Point_2; using X_monotone_curve = Geom_traits::X_monotone_curve_2; using Curve = Geom_traits::Curve_2; using Polycurve = CGAL::Arr_polycurve_traits_2<Geom_traits>; int main() { Geom_traits traits; Polycurve polycurve_trait; auto ctr_pnt = traits.construct_point_2_object(); auto ctr_cv = traits.construct_curve_2_object(); auto ctr_poly = polycurve_trait.push_back_2_object(); Eigen::MatrixXd curve(4, 3); curve << -0.962746937823763, 0.1741138079042976, -0.2068881717451065, -0.9602600833963838, 0.178977377213232, -0.2141673893977384, -0.9595444292144757, 0.1833686986933843, -0.21365956262934, -0.9602511343581622, 0.1870351558488714, -0.2072090959404319; int num_curves = curve.rows(); Polycurve::Curve_2 polycurve; Eigen::MatrixXd extended_curve = curve; for (std::size_t i = 0; i < curve.rows(); i++) { auto p1 = curve.row(i); auto p2 = curve.row((i + 1) % num_curves); auto cv = ctr_cv(ctr_pnt(p1.x(), p1.y(), p1.z()), ctr_pnt(p2.x(), p2.y(), p2.z())); ctr_poly(polycurve, cv); } std::vector<Point> pts; CGAL::compute_intersection_points(polycurve.begin(), polycurve.end(), std::back_inserter(pts), true, polycurve_trait); // 我也尝试过用Geom_trait替换这里的polycurve_trait }
错误信息
Severity Code Description Project File Line Suppression State Details Error C3889 call to object of class type 'CGAL::Arr_polycurve_traits_2<Geom_traits>::Make_x_monotone_2': no matching call operator found bem_curve_network C:\...\CGAL\Surface_sweep_2\Surface_sweep_2_utils.h 61
疑问
作为CGAL新手,我想确认是否误用了模板,或是遗漏了某些步骤;如果不是,是否需要实现可拆分为X单调段的自定义Polycurve特征类?理论上,相连的X单调段组成的曲线应保持X单调,因此构造此类Polycurve应具备可行性。
内容的提问来源于stack exchange,提问作者Cedric Martens
相关产品推荐
相关产品推荐

