Skip to content
Snippets Groups Projects
Commit 82b2778a authored by Jean-Marie Favreau's avatar Jean-Marie Favreau
Browse files

Correct the way that the radius is computed

parent 67b8cbe7
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,7 @@ bool CylinderProjection::compute2DLocation(VertexID vnew, VertexID vknown) {
// the y coordinate corresponds to the one of y plus the angle difference in the base plane
const bool d = Coord3D::scalarProduct(axis, Coord3D::vectorialProduct(pnew, pknown)) > 0;
const double y = mapping[vknown].get2DY() + Coord3D::angleVector(pnew, pknown) * (d ? radius : - radius) * 5;
const double y = mapping[vknown].get2DY() + Coord3D::angleVector(pnew, pknown) * (d ? radius : - radius);
mapping.set2DCoords(vnew, x, y);
mesh.point(vnew).setFlag(1);
return true;
......@@ -164,8 +164,10 @@ void CylinderProjection::initAxis() {
void CylinderProjection::estimateRadius() {
assert(axis.norm() != 0.);
long double sumDistance = 0.;
for(Mesh::const_point_iterator p = mesh.point_begin(); p != mesh.point_end(); ++p)
sumDistance += (*p).distance(line);
radius = sumDistance / mesh.getNbPoints();
}
radius = 0.;
for(Mesh::const_point_iterator p = mesh.point_begin(); p != mesh.point_end(); ++p) {
const double d = (*p).distance(line);
if (d > radius)
radius = d;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment