question

Pedro Ortelani avatar image
1 Like"
Pedro Ortelani asked Pedro Ortelani commented

MESH API how to draw curves?

Hello,

I am trying to draw a curve mesh just like the one on the curved conveyor, but can't make it work with the functions I got from the Mesh API example module.

Is there a function on the Mesh API to draw curves?

Thanks!

FlexSim 20.0.3
developmentmesh
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Allister Wilson avatar image
1 Like"
Allister Wilson answered Pedro Ortelani commented

Hi Pedro,

Curves don't really exist in the context of a 3D mesh.
Generally, you approximate the real curve using several flat triangles.

As an example (screenshots taken in the Unity engine), here's a nice smooth sphere :

And here's its actual mesh :

When lit (1st image) you can't see the borders between the triangles because the normals have been smoothed, by taking the average of the normals of all triangles that a vertex is part of, instead of using the actual surface normal of each triangle. In simple terms, this causes lighting calculations to see the surface as curved, rather than as several separate flat triangles.

I'm not familiar with the FlexSim mesh API as seen from C++, so there may be some utility functions which can do some of the work for you, but ultimately you'll need to build a triangle mesh that approximates the real curved surface you're attempting to model.


lit-sphere.png (20.0 KiB)
wire-sphere.png (34.1 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

The curved conveyor is the same way. It is all just triangles whose positions are calculated with code:

1 Like 1 ·
Pedro Ortelani avatar image Pedro Ortelani commented ·

Got it! Thanks for the info!

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.