First test of CGE

Hello,

I did start a little project just for me. Polyhedra are build by code from a text file with coordinates and faces definition. It’s the beginning but thanks to CGE to offer such a powerful API :slight_smile:

Alexandre

2 Likes

Things to add :

    1. Can get coordinates of vertices when the polyhdron is moved to be able to save this information in a file
    1. When a polyhedron is in rotation, be able to give the same “movement” the next / previous polyhedron when it is shown.

Did not find any solution for the moment … but madly impressed by what it is already possible to do in just few days after CGE discovery :slight_smile:

1 Like

Edges are now TCylinderNode and vertices are TSphereNode, its’ much better to control how there are build and shown / hidden.

It was not easy to find the right rotation to align each cylinder with to real edge … but dot product and cross product of vectors help me :slight_smile:

Luckily I was a math teacher in my first part of my life :slight_smile:

Thank you again for CGE which is incredible.

Habe a good day

Alexandre

2 Likes

Looks cool!

For cylinders and spheres, if you go into “a lot of them” (like thousands), remember there are ways to make them more optimal:

  • You can use “slices” / “stacks” parameters to control how detailed they are. When they are very small, and there are really lots of them, it will be faster to have them less detailed. To do this, change TSphereNode.Slices, TSphereNode.Stacks, TCylinderNode.Slices. Or change their global defaults DefaultTriangulationSlices, DefaultTriangulationStacks .

  • You may disable rendering of TCylinderNode.Top, TCylinderNode.Bottom (if cylinder endings are always hidden inside spheres).

  • Naturally, the “nuclear” way to speed them up will be also using thick points and thick lines for them, so TPointSetNode and TLineSetNode with RenderOptions.LineWidth and RenderOptions.PointSize sufficiently large. This naturally this will look worse than spheres / cylinders :slight_smile:

I don’t know if any of the above advises matter right now, just keep them in mind if you go into larger meshes, like thousands or more vertexes.

Thank you Michalis for your answer.

I have few cylinders/sphres to show but with your anwers I discover again some new classes / methods :slight_smile: Read CGE documentation is always a interesting travel.

Before use TCylinderNode I did use TIndexedLineSetNode to draw the edges but I finally decided to try to use cylinders to : 1) learn a new thing and find the “good” rotation … and 2) have a better look :slight_smile:

Alexandre

1 Like