Repository navigation
Conversation
…so the surface follows the true helix far more closely. Add SBezier::ConvertQuadraticToCubic(), which raises a quadratic to a cubic in place without changing the curve, in homogeneous coordinates so arcs stay exact. In SSurface::FromRevolutionOf(), a section that turns and moves along the axis gets each row raised to a cubic, and its two inner control points moved along the axis by dz * (2 sin(dtheta/2)/dtheta - w) / (1 + 2w), so the slope at each end matches the helix. Seen along the axis the rows stay exact circles. The axial error drops about 40 times for a 90 degree section, and about 200 times for a 41 degree one. Plain revolutions keep quadratic rows. In SShell::MakeFromHelicalRevolutionOf(), build the edge curve between neighboring surfaces from the surface's whole first row, of whatever degree.
| sc.isExact = true; | ||
| sc.exact = SBezier::From(ss->ctrl[0][0], ss->ctrl[0][1], ss->ctrl[0][2]); | ||
| sc.exact.weight[1] = ss->weight[0][1]; | ||
| sc.exact.deg = ss->degn; |
There was a problem hiding this comment.
| Vector c = ps.ClosestPointOnLine(pt, axis); | ||
| Vector ct = mid.Minus(c).ScaledBy(1 / (w * w)).Plus(c); | ||
|
|
||
| // not sure this is needed |
There was a problem hiding this comment.
#1813 does better here by fixing an existing bug see:
https://github.com/solvespace/solvespace/pull/1813/changes#diff-deec245a10911b7fc46369d2f1d19541c6ba4616ea90aeff8cf3b24749f01005R101
|
@ruevs I thought it might be better (educational) to make it more explicit that each point is essentially converted to a curve, the curve is elevated in degree for helix and shifted axially, and the row of control points in the surface are the ones from that curve. For being compact and direct the other one is obviously better. Close this, merge that ;-) |
You are right about the readability - yours is more readable. If you want - fix this: solvespace/src/srf/surface.cpp Lines 106 to 111 in 84bd1a5 to match solvespace/src/srf/surface.cpp Lines 99 to 105 in 7d711a2 And then your solution will be the same functionally and more readable. Edit: and fix this #1813 (comment) |
|
#1813 got merged. |
Reduces the error over 2nd degree curves by over 40x for 90 degree sweeps.
Add SBezier::ConvertQuadraticToCubic(), which raises a quadratic to a cubic in place without changing the curve, in homogeneous coordinates so arcs stay exact. In SSurface::FromRevolutionOf(), a section that turns and moves along the axis gets each row raised to a cubic, and its two inner control points moved along the axis by dz * (2 sin(dtheta/2)/dtheta - w) / (1 + 2w), so the slope at each end matches the helix. Seen along the axis the rows stay exact circles. The axial error drops about 40 times for a 90 degree section, and about 200 times for a 41 degree one. Plain revolutions keep quadratic rows.
In SShell::MakeFromHelicalRevolutionOf(), build the edge curve between neighboring surfaces from the surface's whole first row, of whatever degree.