Jump to content

3d picture control Normal vector


Trin

Recommended Posts

HI Lavas,

i want to know if there is any method to determin the normal vector for any specific point on a 3d object?! Actually i dont need to show it on the front panel, ijust need to save the normal vector data.

Looking forward for hearing anything

Link to comment

I don't understand the context...

All the normal data for the mesh is the data you provide during mesh inititialization (one normal vector either per vertex or per face). You may also use respective property to get Normal Array. It is not possible for standard objects like sphere or cone.

If you have per vertex binding and you want to determine normal of point which lays between vertices, you have to make a weighted sum of normals form 3 (for triangles) or 4 (for quads) closest vertices.

You have to remember that when the object is rotated or not uniformly scaled, norwar vectors should be transformed as well.

Link to comment

Thanks for your reply, may be i should put it in this way, what i really mean is a funtion/method of 3d picture control to calculate normal vector.

attach is a simple vi that load a wrl file and should calculate normal vector of the marked point inside "mouse down" event handler.

Cheers

P.s: i cannot load a wrl file, there is an Error says You aren't permitted to upload this kind of fileblink.gif

cube4b.vi

Link to comment

Ok. As I said it is only possible when object hit with mouse is a mesh (you can check with trying to downcast reference of object's drawable to mesh class and checking for an error). You are loading an external file, so you cannot be sure that it contains normal data (normals cause that objects look smoother). Lets assume that it does not contain such data and you have to calculate it from face orientation. So you have to find a face clicked with mouse. PickPoint method gives you only 3D coordinates not related to geometry. Use "Vertex Array" and "Indices" properties of the mesh to get information about faces of clicked object and than search for the face which contain point you acquired with PickPoint. When you find is calculation normal is as simple as calculating cross product of two vectors, but searching for the face is not so simple. PickPoint does this behind the scenes, but unfortunately it doesn't provide this information.

There are a lot of methods to find a face: from relatively simple and slow to complex and fast. The simplest is searching faces one by one checking whether it contain a point (also few methods for that). What to use is dependent on complexity of your geometry, frequency of performing the search and any additional information you know about the geometry.

Link to comment

Thanks vugi, as usual you gave a great hints.

well, i should say that i checked my wrl code, and it has the normal vector data.my question is how i can relate the mouse coord to wrl for determining in which face it is?is there any sample VI that i can get some ideas from it.

Also, how i can get a reference to a 3D scene Mesh, which has a Normal array, as far as i understand the 3D scene mesh has a property node that make it possible to read the normal vector.

The only VI that i can get some idea is the http://decibel.ni.com/content/docs/DOC-2059 i am trying to reverse the codes to get some ideas, but on the other hand it is somehow complicated and i am a newbie in Labview.

Thanks for any help,

Link to comment

Also, how i can get a reference to a 3D scene Mesh, which has a Normal array, as far as i understand the 3D scene mesh has a property node that make it possible to read the normal vector.

Here is a method:

post-7450-127624361356.png

You have to check Draw Mode (triangles or quads) in order to know hoe to interpret Indices (refer to mesh example in LV). It's also good to check Normal Binding Mode (whether normals are defined per vertex, per face or not binded at all).

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.