Revert "convert weighted points to bare points when needed"

This reverts commits 19dadd6d58
and 137fe12b6b

We now use Kernel functors instead of Construct_point_3 converters,
because they work with both Point_3 and Weighted_point_3
This commit is contained in:
Jane Tournois 2016-11-04 15:41:00 +01:00
parent 9405829e13
commit 9187318744
4 changed files with 39 additions and 39 deletions

View File

@ -185,8 +185,6 @@ polylines_to_protect(const CGAL::Image_3& cgal_image,
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
// typedef typename boost::graph_traits<Graph>::edge_iterator edge_iterator;
typename K::Construct_point_3 cp;
const int xdim = static_cast<int>(cgal_image.xdim());
const int ydim = static_cast<int>(cgal_image.ydim());
const int zdim = static_cast<int>(cgal_image.zdim());
@ -204,6 +202,10 @@ polylines_to_protect(const CGAL::Image_3& cgal_image,
typename K::Construct_midpoint_3 midpoint =
K().construct_midpoint_3_object();
typename K::Construct_vector_3 vector =
K().construct_vector_3_object();
typename K::Construct_translated_point_3 translate =
K().construct_translated_point_3_object();
for(int axis = 0; axis < 3; ++axis)
{
@ -344,13 +346,13 @@ case_4:
for(double x = 0.05; x < 0.5; x+= 0.05)
{
const Point_3 inter_left =
cp(p00)
+ x * (cp(p10) - cp(p00)) // x
+ ((1.-2.*x)/(2.-3.*x)) * (cp(p01) - cp(p00)); // y
translate(p00
, x * vector(p00, p10) // x
+ ((1.-2.*x)/(2.-3.*x)) * vector(p00, p01)); // y
const Point_3 inter_right =
cp(p11)
+ x * (cp(p01) - cp(p11)) // x
+ ((1.-2.*x)/(2.-3.*x)) * (cp(p10) - cp(p11)); // y
translate(p11
, x * vector(p11, p01) // x
+ ((1.-2.*x)/(2.-3.*x)) * vector(p11, p10)); // y
v_int_left = g_manip.get_vertex(inter_left);
v_int_right = g_manip.get_vertex(inter_right);
g_manip.try_add_edge(old_left, v_int_left);
@ -382,7 +384,8 @@ case_4:
++case211;
Point_3 midleft = midpoint(p00, p01);
Point_3 midright = midpoint(p10, p11);
Point_3 inter = cp(midleft) + (2./3)*(cp(midright)-cp(midleft));
Point_3 inter = translate(midleft
, (2./3) * vector(midleft, midright));
vertex_descriptor v_inter = g_manip.get_vertex(inter);
vertex_descriptor right = g_manip.split(p10, p11, out10, out11);
vertex_descriptor top = g_manip.split(p01, p11, out01, out11);
@ -397,13 +400,13 @@ case_4:
for(double x = 0.51666; x < 0.66; x+= 0.016666)
{
const Point_3 inter_top =
cp(p00)
+ x * (cp(p10) - cp(p00)) // x
+ ((1./x) - 1.) * (cp(p01) - cp(p00)); // y
translate(p00
, x * vector(p00, p10) // x
+ ((1./x) - 1.) * vector(p00, p01)); // y
const Point_3 inter_bottom =
cp(p00)
+ x * (cp(p10) - cp(p00)) // x
+ (2.-(1./x)) * (cp(p01) - cp(p00)); // y
translate(p00
, x * vector(p00, p10) // x
+ (2.-(1./x)) * vector(p00, p01)); // y
v_int_top = g_manip.get_vertex(inter_top);
v_int_bottom = g_manip.get_vertex(inter_bottom);
g_manip.try_add_edge(old_top, v_int_top);
@ -498,9 +501,9 @@ case_4:
for(double x = 0.55; x < 1.; x+= 0.05)
{
const Point_3 inter =
cp(p00)
+ x * (cp(p10) - cp(p00)) // x
+ (1.-1./(2.*x)) * (cp(p01) - cp(p00)); // y
translate(p00
, x * vector(p00, p10) // x
+ (1.-1./(2.*x)) * vector(p00, p01)); // y
v_int = g_manip.get_vertex(inter);
g_manip.try_add_edge(old, v_int);
old = v_int;

View File

@ -987,11 +987,12 @@ private:
const int k3,
const Cell_handle& cell) const
{
Construct_point_3 cp;
return CGAL::abs(CGAL::approximate_dihedral_angle(cp(p),
cp(cell->vertex(k1)->point()),
cp(cell->vertex(k2)->point()),
cp(cell->vertex(k3)->point())));
typename Gt::Compute_approximate_dihedral_angle_3 approx_dihedral_angle
= Gt().compute_approximate_dihedral_angle_3_object();
return CGAL::abs(approx_dihedral_angle(p,
cell->vertex(k1)->point(),
cell->vertex(k2)->point(),
cell->vertex(k3)->point()));
}
/**

View File

@ -65,10 +65,11 @@ struct Graph_manipulations
<< std::boolalpha << a_is_outside << ", "
<< std::boolalpha << b_is_outside << ")\n";
#endif // CGAL_MESH_3_DEBUG_GRAPH_MANIPULATION
typedef typename CGAL::Kernel_traits<Point_3>::Kernel K;
typename K::Construct_point_3 cp;
const Point_3 mid = (a < b) ? midpoint(cp(a), cp(b)) : midpoint(cp(b), cp(a));
typedef typename CGAL::Kernel_traits<Point_3>::Kernel K;
typename K::Construct_midpoint_3 midpt
= K().construct_midpoint_3_object();
const Point_3 mid = a < b ? midpt(a, b) : midpt(b, a);
vertex_descriptor vmid = get_vertex(mid);
typename std::map<Point_3, vertex_descriptor>::iterator
it_a = p2v.find(a),

View File

@ -535,6 +535,8 @@ std::vector<int>
create_histogram(const C3t3& c3t3, double& min_value, double& max_value)
{
typedef typename C3t3::Triangulation::Point Point_3;
typename Kernel::Compute_approximate_dihedral_angle_3 approx_dihedral_angle
= Kernel().compute_approximate_dihedral_angle_3_object();
std::vector<int> histo(181, 0);
@ -561,39 +563,32 @@ create_histogram(const C3t3& c3t3, double& min_value, double& max_value)
const Point_3& p2 = cit->vertex(2)->point();
const Point_3& p3 = cit->vertex(3)->point();
typename Kernel::Construct_point_3 cp;
double a = CGAL::to_double(CGAL::abs(
CGAL::approximate_dihedral_angle(cp(p0), cp(p1), cp(p2), cp(p3))));
double a = CGAL::to_double(CGAL::abs(approx_dihedral_angle(p0, p1, p2, p3)));
histo[static_cast<int>(std::floor(a))] += 1;
min_value = (std::min)(min_value, a);
max_value = (std::max)(max_value, a);
a = CGAL::to_double(CGAL::abs(
CGAL::approximate_dihedral_angle(cp(p0), cp(p2), cp(p1), cp(p3))));
a = CGAL::to_double(CGAL::abs(approx_dihedral_angle(p0, p2, p1, p3)));
histo[static_cast<int>(std::floor(a))] += 1;
min_value = (std::min)(min_value, a);
max_value = (std::max)(max_value, a);
a = CGAL::to_double(CGAL::abs(
CGAL::approximate_dihedral_angle(cp(p0), cp(p3), cp(p1), cp(p2))));
a = CGAL::to_double(CGAL::abs(approx_dihedral_angle(p0, p3, p1, p2)));
histo[static_cast<int>(std::floor(a))] += 1;
min_value = (std::min)(min_value, a);
max_value = (std::max)(max_value, a);
a = CGAL::to_double(CGAL::abs(
CGAL::approximate_dihedral_angle(cp(p1), cp(p2), cp(p0), cp(p3))));
a = CGAL::to_double(CGAL::abs(approx_dihedral_angle(p1, p2, p0, p3)));
histo[static_cast<int>(std::floor(a))] += 1;
min_value = (std::min)(min_value, a);
max_value = (std::max)(max_value, a);
a = CGAL::to_double(CGAL::abs(
CGAL::approximate_dihedral_angle(cp(p1), cp(p3), cp(p0), cp(p2))));
a = CGAL::to_double(CGAL::abs(approx_dihedral_angle(p1, p3, p0, p2)));
histo[static_cast<int>(std::floor(a))] += 1;
min_value = (std::min)(min_value, a);
max_value = (std::max)(max_value, a);
a = CGAL::to_double(CGAL::abs(
CGAL::approximate_dihedral_angle(cp(p2), cp(p3), cp(p0), cp(p1))));
a = CGAL::to_double(CGAL::abs(approx_dihedral_angle(p2, p3, p0, p1)));
histo[static_cast<int>(std::floor(a))] += 1;
min_value = (std::min)(min_value, a);
max_value = (std::max)(max_value, a);