Skip to content
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 Elements.Geometry.Solids.Sweep #1007

Open
pederlh opened this issue Aug 2, 2023 · 3 comments
Open

Regression Elements.Geometry.Solids.Sweep #1007

pederlh opened this issue Aug 2, 2023 · 3 comments
Milestone

Comments

@pederlh
Copy link
Contributor

pederlh commented Aug 2, 2023

Describe the bug
From version 1.6.0 to 2.0.0, an exception is thrown when initializing some Sweep objects, in cases where possible earlier. A reproducible example is included below.

Test method HyparDebugging.GeometryTest.Sweepbug threw exception: 
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'The vector could not be created. One or more of the components was NaN.')
    Stack Trace:
        at Elements.Geometry.Vector3..ctor(Double x, Double y, Double z)
   at Elements.Geometry.Solids.Solid.ProjectEdgeAlong(Edge[] loop, Vector3 v, Plane p)
   at Elements.Geometry.Solids.Solid.SweepEdgesBetweenPlanes(Edge[] loop1, Vector3 v, Plane end)
   at Elements.Geometry.Solids.Solid.SweepEdges(Transform[] transforms, Edge[] openEdge)
   at Elements.Geometry.Solids.Solid.SweepFaceAlongCurve(Polygon perimeter, IList`1 holes, IBoundedCurve curve, Double startSetback, Double endSetback, Double profileRotation)
   at Elements.Geometry.Kernel.CreateSweepAlongCurve(Profile profile, BoundedCurve curve, Double startSetback, Double endSetback, Double profileRotation)
   at Elements.Geometry.Solids.Sweep.UpdateGeometry()
   at Elements.Geometry.Solids.Sweep..ctor(Profile profile, BoundedCurve curve, Double startSetback, Double endSetback, Double profileRotation, Boolean isVoid)

To Reproduce

// Works in version 1.6.0, not in 2.0.0

Polygon crossSection = Polygon.Rectangle(0.25, 0.25);

Polyline curve = new(new List<Vector3>
{
        new Vector3(x: 20.0, y: 15.0, z:0.0),
        new Vector3(x: 20.0, y: 15.0, z:1.0),
        new Vector3(x: 20.0, y: 14.5, z:1.5),
        new Vector3(x: 19.5, y: 14.5, z:1.5),
}
);

var sweep = new Elements.Geometry.Solids.Sweep(
    new Profile(crossSection),
    curve,
    startSetback: 1,
    endSetback: 1,
    profileRotation: 0,
    isVoid: false
);

Desktop (please complete the following information):

  • OS: macOS Ventura 13.4
@pederlh
Copy link
Contributor Author

pederlh commented Aug 28, 2023

Updated the MRE with a much simpler cross section polygon (previously Polygon crossSection = new Circle(radius: 0.25).ToPolygon(20);) and a sweep curve with fewer points.

@DmytroMuravskyi
Copy link
Contributor

There is a bug related to setbacks. They are distance based, so with setbacks of 1 and 1 resulting polyline for sweep would end up with only two points: X: 20.0, Y: 15.0, Z:1.0 and X: 20, Y = 14.85, Z = 1.146. First segment is skipped since it's length is exactly 1, last segment is also skipped but because its length is only 0.5, part of middle segment, starting from end will be skipped as well. Is this expected behavior for you?

@pederlh
Copy link
Contributor Author

pederlh commented Sep 4, 2023

Yes, that is exactly what I would expect. Thank you for working on the fix!

@ikeough ikeough added this to the 2.1 milestone Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants