-
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
Unbound, bound, and trimmed curves. #957
Conversation
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 and @anthonie-kramer)
Elements/src/Geometry/Arc.cs
line 14 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
The Arc validator throws if you use a startAngle / endAngle > 360, but doesn't care anything about < -360. Since the code actually seems to tolerate start/end angles outside of this range, should we remove that validation? alternately, we can set it to clamp at the negative end too (but I would hate to lose the ability to do something like
new Arc(5, -45, 45)
)!
I've changed the validation for arc span to check whether the proposed span is > 360.0, regardless of start /end. LMK what you think.
Elements/src/Geometry/Arc.cs
line 49 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
an circular => a circular
Done.
Elements/src/Geometry/Polyline.cs
line 1416 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
The fact that we can get away with this — not implement this, since the only callers are
Frames
andRenderVertices
, which we also override in this class, feels like maybe a design flaw? If nothing else, it might be worth a comment in the base class which says something like:You don't need to implement this so long as you override
Frames
andRenderVertices
.But that makes me nervous too... the minute we add another capability to
BoundedCurve
which relies onGetSampleParameters
, now all of a sudden we have an issue. IDK, I don't have super strong feelings about this, but as-is it feels vaguely risky.
This is a good catch. I've made GetSampleParameters
abstract so every curve has to implement it. I've also simplified RenderVertices()
to have one implementation, which required allowing curve types to specify which GL line mode they should use to render. See the addition of the internal property IsClosedForRendering
which is set to false
by default and true
for polygons so that the line mode switches to LOOP
. All RenderVertices
was doing differently for polygons was adding one more vertex to the collection so it would draw as a loop.
Elements/src/Geometry/Interfaces/IBoundedCurve.cs
line 5 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
curces => curves
Done.
Elements/src/Math/Domain1d.cs
line 37 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
good catch!
Done.
Elements/test/LineTests.cs
line 646 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
Seems like we missed an automatic lint fix here, this should be
line.Length() / 2
with spaces
Done.
Elements.Serialization.IFC/src/Serialization/IFC/IFCExtensions.cs
line 37 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
I think this can be
.TransformedLine
to avoid the cast.
Done.
Elements/src/Units.cs
line 360 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
Not sure why this method belongs in
Units
. Also, appears to be unused by the code — remove?
Ah yes, created this and used it before realizing that Domain.Includes
existed. Removed.
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 10 of 17 files at r4, 9 of 9 files at r5, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @anthonie-kramer and @ikeough)
Elements/src/Geometry/Arc.cs
line 14 at r3 (raw file):
Previously, ikeough (Ian Keough) wrote…
I've changed the validation for arc span to check whether the proposed span is > 360.0, regardless of start /end. LMK what you think.
LGTM
Elements/src/Geometry/Polygon.cs
line 28 at r5 (raw file):
internal Plane _plane; internal override bool IsClosedForRendering => false;
shouldn't a polygon be IsClosedForRendering
true?
Elements/src/Geometry/Polyline.cs
line 1416 at r3 (raw file):
Previously, ikeough (Ian Keough) wrote…
This is a good catch. I've made
GetSampleParameters
abstract so every curve has to implement it. I've also simplifiedRenderVertices()
to have one implementation, which required allowing curve types to specify which GL line mode they should use to render. See the addition of the internal propertyIsClosedForRendering
which is set tofalse
by default andtrue
for polygons so that the line mode switches toLOOP
. AllRenderVertices
was doing differently for polygons was adding one more vertex to the collection so it would draw as a loop.
That feels a lot cleaner!
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 10 of 48 files at r1, 1 of 10 files at r3, all commit messages.
Reviewable status: complete! 1 change requests, 1 of 1 approvals obtained (waiting on @ikeough)
Elements/src/Geometry/Arc.cs
line 98 at r3 (raw file):
/// </summary> /// <param name="radius">The radius of the arc.</param> /// <param name="startAngle">The angle from 0.0, in degrees, at which the arc will start with respect to the positive X axis.</param>
assuming counter-clockwise, but good to add hints 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: 2 change requests, 0 of 1 approvals obtained (waiting on @ikeough)
Elements/src/Geometry/Line.cs
line 578 at r5 (raw file):
public override Vector3 Mid() { return Start.Average(End);
or PointAt(0.5)
? Fewer operations = more precise (though probably negligible anyway)
Elements/src/Search/LeftMostPointComparer.cs
line 35 at r5 (raw file):
var b = _getSegment(t2); const double small = 0.001;
I don't know if we use constants like these in other places, but there should probably be global constants for tolerances, etc.
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: 2 change requests, 0 of 1 approvals obtained (waiting on @andrewheumann and @anthonie-kramer)
Elements/src/Geometry/Arc.cs
line 98 at r3 (raw file):
Previously, anthonie-kramer (Anthonie Kramer) wrote…
assuming counter-clockwise, but good to add hints here...
Done.
Elements/src/Geometry/Line.cs
line 578 at r5 (raw file):
Previously, anthonie-kramer (Anthonie Kramer) wrote…
or
PointAt(0.5)
? Fewer operations = more precise (though probably negligible anyway)
Parameterization of lines is now 0->length, so PointAt
would have to know the length of the line. Average
is actually the shortest path.
Elements/src/Geometry/Polygon.cs
line 28 at r5 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
shouldn't a polygon be
IsClosedForRendering
true?
Done
Elements/src/Geometry/Polyline.cs
line 1416 at r3 (raw file):
Previously, andrewheumann (Andrew Heumann) wrote…
That feels a lot cleaner!
Done.
Elements/src/Search/LeftMostPointComparer.cs
line 35 at r5 (raw file):
Previously, anthonie-kramer (Anthonie Kramer) wrote…
I don't know if we use constants like these in other places, but there should probably be global constants for tolerances, etc.
We can address in a separate PR. The idea here was to keep the functionality as close to the original functionality, while accommodating the reparameterization.
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.
As discussed, when we're ready to merge this, let's try to get an elements release out the door with any in-flight bug fixes before we make the 2.0 bump. but LGTM!
Reviewed 4 of 4 files at r6, all commit messages.
Reviewable status: complete! 1 change requests, 1 of 1 approvals obtained (waiting on @anthonie-kramer)
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 19 of 48 files at r1, 1 of 2 files at r2, 2 of 10 files at r3, 10 of 17 files at r4, 9 of 9 files at r5, all commit messages.
Reviewable status: complete! 2 of 1 approvals obtained
BACKGROUND:
Ellipse
andEllipticalArc
.Polycurve
type that corresponds toIfcIndexedPolycurve
.DESCRIPTION:
BoundedCurve
IBoundedCurve
interface for bound curves that have a start and end.Polyline
inherit fromBoundedCurve
TrimmedCurve
ITrimmedCurve<T>
interface for trimmed curves which have a basis curve and a domain.Circle
inherit fromCurve
, and makesArc
aTrimmedCurve<Circle>
.Line
aTrimmedCurve<InfiniteLine>
(a line segment) and introduces theInfiniteLine
class which represents an unbound line from a start point along a direction. Optimally,Line
, should becomeLineSegment
andInfiniteLine
should beLine
, but the renaming would break all serialized instances of lines. This should be considered in the future.IConic
for curves which are planar sections of cones likeCircle
and (soon)Ellipse
.Circle
to be [0,2PI], and adjustsArc
domain accordingly to use a start and end angle.Line
to be [0,Length]Polyline
to be [0,length]TESTING:
FUTURE WORK:
NormalizedParameterAt(double u)
.REQUIRED:
CHANGELOG.md
.This change is