-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression fix for Elements.Geometry.Solids.Sweep #1016
Regression fix for Elements.Geometry.Solids.Sweep #1016
Conversation
…olygon.Frames work with startSetback and endSetback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 9 files at r1, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @DmytroMuravskyi)
Elements/src/Geometry/Polygon.cs
line 2094 at r1 (raw file):
// Calculate number of frames. 2 frames corresponding to end parameters. // 1 if startIndex == endIndex. var lenght = endIndex - startIndex + 3;
lenght
=> length
Elements/src/Geometry/Polyline.cs
line 306 at r1 (raw file):
// Calculate number of frames. 2 frames corresponding to end parameters. // 1 if startIndex == endIndex. var lenght = endIndex - startIndex + 3;
lenght
=> length
Elements/test/PolygonTests.cs
line 2234 at r1 (raw file):
Assert.True((Vector3.YAxis - Vector3.XAxis).IsParallelTo(frames[4].ZAxis)); frames = polygon.Frames(2, 2);
polyhon.Frames(1, 1) will throw an exception here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @andrewheumann)
Elements/src/Geometry/Polygon.cs
line 2094 at r1 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
lenght
=>length
Done.
Elements/src/Geometry/Polyline.cs
line 306 at r1 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
lenght
=>length
Done.
Elements/test/PolygonTests.cs
line 2234 at r1 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
polyhon.Frames(1, 1) will throw an exception here.
Good catch. Added index rounding for Polygon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frames being found along the curve are flipped compared to how they used to be — I think this is an unintended regression. This also results in sweeps having "inside-out" normals:
Elements 1.6.0:
Elements 2.0.0:
All three samples are running this code:
var polygon = new Polyline((0, 0), (3, 0), (3, 3), (0, 3));
var model = new Model();
model.AddElement(new ModelCurve(polygon, BuiltInMaterials.XAxis));
var frames = polygon.Frames(0.1, 0.1);
model.AddElements(frames.SelectMany(f => f.ToModelCurves()));
var profile = Polygon.L(0.2, 0.2, 0.05);
var ge = new GeometricElement {
Representation = new Sweep(profile, polygon, 0.1, 0.1, 0, false)
};
model.AddElement(ge);
We have been inconsistent about this in the past, but I think the convention in our code is that the z of a curve's frame is opposite the curve's tangent at that point. (Don't ask me why it is this way, I would 100% expect Z+ to be the same as the tangent.)
Reviewed 3 of 9 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I missed the fact that they are adjusted. Now frames look like this
Note that Frames behaves differently from TrasformAt as first and last frames are not rotated based on position if they are somewhere in the middle of segment but just . One exception is when setback is coincides with a corner, then Frame is also the same as for corner vertex - rotated. I also made tests more explicit about expected results.
Reviewable status: 1 change requests, 0 of 1 approvals obtained
Looks good to me, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: complete! 1 of 1 approvals obtained
BACKGROUND:
DESCRIPTION:
GetSubdivisionParameters
to use startSetbackDistance and endSetbackDistance since they were just ignored.Polyline.Frames
andPolygon.Frames
so they return only frames between setbacks. SinceCreateMiterTransform
andCreateOrthogonalTransform
are focused on vertices, Transforms on setbacks are created manually.TESTING:
FUTURE WORK:
Polyline.TransformAt
feels incorrect as it says that u is "between 0.0 and length" but it's treated as 0 to 1 value. Also, since calculation inside is length based, including normal calculation, curve length can possibly influence frame vectors in a wrong way.REQUIRED:
CHANGELOG.md
.COMMENTS:
This change is