GLVisualize - primitives

Hello,

which primitives are there in GLVisualize?
I found spheres and lines, but is there also a cylinder primitive?
I would like to port some code from cgkit (Python) to Julia. They have
a lot of primitives:
http://cgkit.sourceforge.net/doc2/worldobjects.html

Any comments welcome.

Uwe

1 Like

Hi Uwe,
these are the currently supported primitives:
https://github.com/JuliaGeometry/GeometryTypes.jl/

Them being support only means, that they have a type representing their structure, and that functions are defined on them to build up a triangle mesh.
In GeometryTypes, that means for them to be decomposable. I should have this in the developer docs.
Let me take the chance to add this:
https://github.com/JuliaGeometry/GeometryTypes.jl/blob/master/README.md#displaying-primitives

Best,
Simon

1 Like

Thanks for the links!

I did not find any cylinder primitive. What would be the best way to implement a shaded cylinder?

Uwe

Yes, it’s not implemented yet.
You’ll need to add a Cylinder type and implement decompose for points and faces as described. PRs for GeometryTypes would be much appreciated :slight_smile:

Then this should work:

_view(visualize(GLNormalMesh(Cylinder(...))))

You will see that it will look a bit strange, since the normals are generated in a silly way. So you should also implement decompose for the Normal type.

As a stop gap solution, you could just find a cylinder mesh in form of e.g. an .obj, load it with FileIO and just scale it to your desired size :wink:

I opened an issue and suggest to continue the discussion there:
https://github.com/JuliaGeometry/GeometryTypes.jl/issues/71