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

Circles with large sweep angle do not render not as expected #7748

Open
XinJack opened this issue Feb 21, 2025 · 4 comments · May be fixed by #7766
Open

Circles with large sweep angle do not render not as expected #7748

XinJack opened this issue Feb 21, 2025 · 4 comments · May be fixed by #7766
Assignees
Labels
bug Something isn't working geometry

Comments

@XinJack
Copy link

XinJack commented Feb 21, 2025

Describe the bug
When I create a circle with a large sweep angle (e.g., 7200 degrees), the circle does not render as expected (as shown in the following image). Maybe we could add restrictions to the Arc3d API to prevent the user from creating such circles or fix the rendering issue. (As far as I know, in MicroStation, we can create such circles and they render correctly.)

Image

To Reproduce
We can use the following code to generate the problematic circle:

Arc3d.create(Point3d.create(0, 0, 0), Vector3d.unitX(), Vector3d.unitY(), AngleSweep.create(Angle.createDegrees(7200)))

@dassaf4
Copy link
Member

dassaf4 commented Feb 21, 2025

Pretty, but we'll fix this. Thanks for pointing it out!

@saeeedtorabi
Copy link
Contributor

I was not able to regenerate this using
Arc3d.create(Point3d.create(0, 0, 0), Vector3d.unitX(), Vector3d.unitY(), AngleSweep.create(Angle.createDegrees(7200)));
or even in a sandbox I created to visualize an arc
https://www.itwinjs.org/sandbox/SaeedTorabi/ArcCreate

However, if I call Arc3d.emitStrokes to stroke the arc and then display the arc in MicroStation, I get a wrong image similar to what was reported:

We think the display code may be calling into core-geometry to stroke the arc, which is how it gets to Arc3d.emitStrokes.

I am working to fix the issue by limiting the angle sweep in emitStrokes.

@XinJack
Copy link
Author

XinJack commented Feb 24, 2025

Should use AngleSweep.create(Angle.createDegrees(...)) to reproduce the problem. The sandbox linked above uses AngleSweep.createStartEndDegrees(...), whose implementation already limits the resulting AngleSweep to 360 degrees if it exceeds that value.

@dassaf4 dassaf4 added the bug Something isn't working label Feb 24, 2025
@saeeedtorabi
Copy link
Contributor

Should use AngleSweep.create(Angle.createDegrees(...)) to reproduce the problem. The sandbox linked above uses AngleSweep.createStartEndDegrees(...), whose implementation already limits the resulting AngleSweep to 360 degrees if it exceeds that value.

Right. I modified the sandbox and now I can regenerate the issue.

We resolved the issue here by limiting the sweep to 360 degrees in Arc3d constructor. It should be available in the next iTwin version but will take some time to be available in the sandbox as they get updated less frequently.

@saeeedtorabi saeeedtorabi linked a pull request Feb 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working geometry
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants