Trying to sort out circular arcs at the scene graph level. I've been stepping through the FreeCAD codebase looking to see if I can find some clues on how to do it, but have come up empty. I suspect I'm just looking in the wrong place or for the wrong thing...
Anyway, I can see from the coin3D docs there's no direct support for circular arc generation - it appears all curves must be expressed as splines. Is there any support written to provide circles / circular arcs in coin3D so I don't have to try to sort out approximating them?
circular arcs in coin3d
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
circular arcs in coin3d
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: circular arcs in coin3d
OpenGL cannot do arcs or any curved geometry. It ist all triangles and Line Segments. So that is basically what you need to go for and approximate a circle to line segments. The coin spline classes do the same, and I don't think it would be useful to approximate a circle with a spline to be approximated by lines.
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: circular arcs in coin3d
That was my initial thought as well, but the problem is, every time I have to refresh the scene graph, I have to recompute the coordinates of the discretized arc and update the graph - which means spending a lot of time doing math in Python. Hence my half-hearted hope there was a built-in FreeCAD library call or something similar that could generate an arc, either as a line set or spline in C++.
Otherwise, I can to generate an arc as an edge object, discretize it, and use that to update scenegraph coordinate, but I somehow doubt that's going to be better than optimized Python code...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers