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,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue