-
Hello, I want to achieve an effect where, as the mouse moves on the screen, the nearest corresponding point on the model can always be found, similar to the effect in the iTwin.js examples. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
TransitionSpiral is just another sub-class of CurvePrimitive, as is Arc3d, LineSegment3d, etc. Use GeometryStreamIterator to get all curve geometry as a CurvePrimitive and call the closestPoint method. You don't need to create the CurvePrimitive sub-classes like LineSegment3d/Arc3d directly yourself, the iterator already did that for you and returned them as the base geometry class for curves, surfaces, and solids: GeometryQuery. You can use GeometryQuery.geometryCategory to test if the geometry is represented by a CurvePrimitive. Then use CurvePrimitive.curvePrimitiveType to test for specific sub-classes and use instanceof if you need to want/need to call class specific methods. If you just need to call closestPoint, you don't need to care whether it's a line, arc, or spiral... Hopefully I understood your question... |
Beta Was this translation helpful? Give feedback.
TransitionSpiral is just another sub-class of CurvePrimitive, as is Arc3d, LineSegment3d, etc. Use GeometryStreamIterator to get all curve geometry as a CurvePrimitive and call the closestPoint method.
You don't need to create the CurvePrimitive sub-classes like LineSegment3d/Arc3d directly yourself, the iterator already did that for you and returned them as the base geometry class for curves, surfaces, and solids: GeometryQuery.
You can use GeometryQuery.geometryCategory to test if the geometry is represented by a CurvePrimitive. Then use CurvePrimitive.curvePrimitiveType to test for specific sub-classes and use instanceof if you need to want/need to call class specific methods.
If you j…