- Community Home
- :
- User Groups
- :
- Special Interest Groups
- :
- 3D Vision
- :
- Mesh rotation and slicing - A x B optimisations

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Printer Friendly Page

This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.

Highlighted

Solved!
Go to solution

07-17-2017
05:48 AM

Options

- Mark as New
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

For a mesh slicing algorithm, I need to move (and rotate) the vertices of a mesh.

For this I convert each vertex into a 4x4matrix, and then cross product this with my rotation and translation matrix (the slice position and orientation).

All works 100%, but converting the 3 values into an identity matrix +3 values takes 95% of the computation time.... crazy !

I have tried various options, but I am sure there is a faster way.

Any suggestions to make this 4x4 matrix from 3 values faster? (alternatively "A x B" which can accept data with a position vector)

Since I have 10000 vertices (or more), it takes 4-5 seconds for this operation alone, which is clearly unacceptable for real time use.

Solved! Go to Solution.

2 REPLIES

Solution

Accepted by topic author Philippe_RSA

07-17-2017 05:13 AM

07-17-2017
06:42 AM

Options

- Mark as New
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Philippe_RSA,

First, in general, when performance is required, Formula nodes should be avoided. They are slower than LabVIEW primitives and basic functions.

Second, in general, you do not need to convert a (x,y,z) vector into a 4x4 matrix. You only need to add a a 1 at the end (x,y,z,1). This is the reason why the 4x4 matrix for rotation-translation was invented in the first place. You can use LabVIEW matrix VIs with a matrix and a vector.

Third, use For loops with Parallelism enabled. Make sure that all the VIs within the loop are reentrant. You might be able to improve performance by making heavy matrix operations by calling a dll compiled in C++. By playing with those parameters, you should be able to get a significant performance improvement.

In any case, you should not expect to get near the same level of performance than what you get with the rotation of objects within 3D picture controls or most other 3D applications. Those use the graphic cards to manipulate the objects. The vertex rotations are one of the operations that the graphic cards are designed for. They are massively parallel.

Good luck

Re: Mesh rotation and slicing - A x B optimisations

07-17-2017
07:14 AM

Options

- Mark as New
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Changed the code to just add the 1 to the position vector.....

the 95% is now closer to 1% of the processing time.

Thanks Marc, I am back to real-time.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Printer Friendly Page