Use to_double to make it work with Epec

This commit is contained in:
Andreas Fabri 2016-03-02 14:44:09 +01:00 committed by Jane Tournois
parent 0832d01b45
commit 2c54acb056
5 changed files with 19 additions and 23 deletions

View File

@ -48,14 +48,14 @@ struct Cotangent_value_Meyer_impl
Vector a = get(ppmap, v0) - get(ppmap, v1);
Vector b = get(ppmap, v2) - get(ppmap, v1);
double dot_ab = a*b;
double dot_ab = to_double(a*b);
// rewritten for safer fp arithmetic
//double dot_aa = a.squared_length();
//double dot_bb = b.squared_length();
//double divider = CGAL::sqrt( dot_aa * dot_bb - dot_ab * dot_ab );
Vector cross_ab = CGAL::cross_product(a, b);
double divider = CGAL::sqrt(cross_ab*cross_ab);
double divider = CGAL::sqrt(to_double(cross_ab*cross_ab));
if(divider == 0 /*|| divider != divider*/)
{
@ -309,12 +309,12 @@ public:
double cot_v1 = CotangentValue::operator()(v_op, v1, v0);
double cot_v_op = CotangentValue::operator()(v0, v_op, v1);
double term1 = cot_v1 * (v_op_p - v0_p).squared_length();
double term2 = cot_v_op * (v1_p - v0_p).squared_length();
double term1 = cot_v1 * to_double((v_op_p - v0_p).squared_length());
double term2 = cot_v_op * to_double((v1_p - v0_p).squared_length());
voronoi_area += (1.0 / 8.0) * (term1 + term2);
}
else {
double area_t = CGAL::sqrt(squared_area(v0_p, v1_p, v_op_p));
double area_t = CGAL::sqrt(to_double(squared_area(v0_p, v1_p, v_op_p)));
if(angle0 == CGAL::OBTUSE) {
voronoi_area += area_t / 2.0;
}

View File

@ -247,20 +247,20 @@ private:
// check whether the edge is border
if( (v0 + 1 == v1 || (v0 == n-1 && v1 == 0) ) && !Q.empty() ) {
angle = 180 - CGAL::abs(
CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],Q[v0]) );
to_double(CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],Q[v0])) );
}
else {
if(e == 2) { continue; }
if(lambda.get(v0, v1) != -1){
const Point_3& p01 = P[lambda.get(v0, v1)];
angle = 180 - CGAL::abs(
CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],p01) );
to_double(CGAL::Mesh_3::dihedral_angle(P[v0],P[v1],P[v_other],p01)) );
}
}
ang_max = (std::max)(ang_max, angle);
}
w = std::make_pair(ang_max, CGAL::sqrt(CGAL::squared_area(P[i],P[j],P[k])));
w = std::make_pair(ang_max, CGAL::sqrt(to_double(CGAL::squared_area(P[i],P[j],P[k]))));
}
public:

View File

@ -868,8 +868,8 @@ namespace internal {
{
vertex_descriptor ph0 = source(border_halfedges[0], mesh_);
vertex_descriptor ph1 = source(border_halfedges[1], mesh_);
double dot = Vector_3(get(vpmap_, v), get(vpmap_, ph0))
* Vector_3(get(vpmap_, v), get(vpmap_, ph1));
double dot = to_double(Vector_3(get(vpmap_, v), get(vpmap_, ph0))
* Vector_3(get(vpmap_, v), get(vpmap_, ph1)));
//check squared cosine is < 0.25 (~120 degrees)
if (0.25 < dot / (sqlength(border_halfedges[0]) * sqlength(border_halfedges[0])))
barycenters[v] = CGAL::midpoint(midpoint(border_halfedges[0]),
@ -936,17 +936,13 @@ namespace internal {
tree_ptr_->traits(),
pid_pmap
);
tree_ptr_->traversal(get(vpmap_, v), projection_traits);
CGAL_assertion(projection_traits.found());
Point proj = projection_traits.closest_point();
put(vpmap_, v, proj);
}
CGAL_assertion(is_valid(mesh_));
CGAL_assertion(is_triangle_mesh(mesh_));
#ifdef CGAL_PMP_REMESHING_DEBUG
debug_self_intersections();
#endif
@ -1013,7 +1009,7 @@ private:
double sqlength(const vertex_descriptor& v1,
const vertex_descriptor& v2) const
{
return CGAL::squared_distance(get(vpmap_, v1), get(vpmap_, v2));
return to_double(CGAL::squared_distance(get(vpmap_, v1), get(vpmap_, v2)));
}
double sqlength(const halfedge_descriptor& h) const
@ -1668,7 +1664,7 @@ private:
//check all normals have same orientation
for (std::size_t i = 1; i < normals.size(); ++i)/*start at 1 on purpose*/
{
double dot = normals[i - 1] * normals[i];
double dot = to_double(normals[i - 1] * normals[i]);
if(dot <= 0.)
return false;
}

View File

@ -93,9 +93,9 @@ private:
}
else {
typename boost::property_traits<VertexPointMap>::reference p = ppmap[v];
x += multiplier * - p.x();
y += multiplier * - p.y();
z += multiplier * - p.z();
x += multiplier * - to_double(p.x());
y += multiplier * - to_double(p.y());
z += multiplier * - to_double(p.z());
}
}
else {

View File

@ -113,9 +113,9 @@ private:
vertex_descriptor vk = target(prev(halfedge(fd,pmesh),pmesh),pmesh);
Point_3 c = CGAL::centroid(vpmap[vi], vpmap[vj], vpmap[vk]);
double sac = (scale_attribute[vi] + scale_attribute[vj] + scale_attribute[vk])/3.0;
double dist_c_vi = CGAL::sqrt(CGAL::squared_distance(c,vpmap[vi]));
double dist_c_vj = CGAL::sqrt(CGAL::squared_distance(c,vpmap[vj]));
double dist_c_vk = CGAL::sqrt(CGAL::squared_distance(c,vpmap[vk]));
double dist_c_vi = CGAL::sqrt(to_double(CGAL::squared_distance(c,vpmap[vi])));
double dist_c_vj = CGAL::sqrt(to_double(CGAL::squared_distance(c,vpmap[vj])));
double dist_c_vk = CGAL::sqrt(to_double(CGAL::squared_distance(c,vpmap[vk])));
if((alpha * dist_c_vi > sac) &&
(alpha * dist_c_vj > sac) &&
(alpha * dist_c_vk > sac) &&
@ -218,7 +218,7 @@ private:
}
const Point_3& vq = vpmap[target(opposite(*circ,pmesh),pmesh)];
sum += CGAL::sqrt(CGAL::squared_distance(vp, vq));
sum += CGAL::sqrt(to_double(CGAL::squared_distance(vp, vq)));
++deg;
} while(++circ != done);