Closed DmytroMuravskyi closed 1 year ago
I think this solution is the wrong approach — it leave's a curve's tangent vector in disagreement with its parameter space.
var arc1 = new Arc(transform, 2, 0, Math.PI / 2.0);
var arc2 = new Arc(transform, 2, Math.PI / 2.0, 0);
Assert.Equal(arc1.PointAtNormalized(0.2), arc2.PointAtNormalized(0.8));
Assert.True(arc1.TransformAtNormalized(0.2).ZAxis.Dot(arc2.TransformAtNormalized(0.8).ZAxis) < -0.9999);
This will fail with this change.
I have implemented the earlier proposed approach here, which satisfies this expectation. https://github.com/hypar-io/Elements/pull/999
Few details I noticed about your implementation that might be by design or already known:
var arc = new Arc(Vector3.Origin, 5.0, 0.0, 180.0);
var t = arc.TransformAt(Math.PI / 2);
Assert.Equal(new Vector3(0, 1, 0), t.XAxis);
Assert.Equal(new Vector3(0, 0, 1), t.YAxis);
Assert.Equal(new Vector3(1, 0, 0), t.ZAxis);
var arc = new Arc(Vector3.Origin, 5.0, 180, 45);
var t = arc.TransformAt(Math.PI / 2); //X = -0.707106781186, Y = 0.70710678118654, Z = 1.22464679914735E-16
var p = arc,PointAt(Math.PI / 2); //X = -3.5355339059327373, Y = 3.5355339059327386, Z = 6.1232339957367663E-16
Few changes that can be copied from this PR into new simplified one:
var arc = new Arc(Vector3.Origin, 2.0, 0.0, -90.0);
var parameters = arc.GetSubdivisionParameters();
Assert.Equal(0, parameters.First()); //Fails and returns -PI/2
@andrewheumann want to make sure you see these comments from Dmytro above.
BACKGROUND:
DESCRIPTION:
TESTING:
FUTURE WORK:
REQUIRED:
CHANGELOG.md
.This change is