Skip to content

Commit

Permalink
Fix choice of normal for revolution in some corner cases.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
whitequark committed Apr 22, 2019
1 parent b69ef71 commit fa66229
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/srf/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,13 @@ 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();
double d = p.DistanceToLine(pt, axis);
if(d > md) {
md = d;
pto = p;
for(i = 0; i <= sb->deg; i++) {
Vector p = sb->ctrl[i];
double d = p.DistanceToLine(pt, axis);
if(d > md) {
md = d;
pto = p;
}
}
}
}
Expand Down

0 comments on commit fa66229

Please sign in to comment.