Fix choice of normal for revolution in some corner cases.
Before this commit, if the sketch contain no entities with starting points off of the axis of revolution, the revolution may fail, which manifests as the face normals being inverted. The code at the top of MakeFromRevolutionOf() takes the furthest point from the axis, projects it on that axis to get a vector. In this case that vector is essentially zero length except for rounding errors. After this commit, instead of only considering start points of beziers, all control points are considered. Fix by @phkahler.pull/403/head
parent
b69ef71e63
commit
fa66229030
|
@ -634,7 +634,8 @@ void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
|||
// if we choose a point that lies on the axis, for example.
|
||||
// (And our surface will be self-intersecting if the sketch
|
||||
// spans the axis, so don't worry about that.)
|
||||
Vector p = sb->Start();
|
||||
for(i = 0; i <= sb->deg; i++) {
|
||||
Vector p = sb->ctrl[i];
|
||||
double d = p.DistanceToLine(pt, axis);
|
||||
if(d > md) {
|
||||
md = d;
|
||||
|
@ -642,6 +643,7 @@ void SShell::MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector ptc = pto.ClosestPointOnLine(pt, axis),
|
||||
up = (pto.Minus(ptc)).WithMagnitude(1),
|
||||
vp = (sbls->normal).Cross(up);
|
||||
|
|
Loading…
Reference in New Issue