PDA

View Full Version : surface detection


Jhavna
11-01-2004, 04:19 PM
Hello,
What I want to do is create a MEL script that places a number of poly objects along a user defined plane (which is aligned along x,z, but can have varying y along the surface).
If I were to use a NURBS surface as a reference, then I could evaluate the height of the surface at given points using pointOnSurface (the new objects will be places randomly).
However, how do I then go about determining the correct orientation? I'd like to align the objects along the surface normals, which aren't present in NURBS (if I'm not mistaken).
If I convert to polys afterwards, I still need to know how to get the surface normal at the poisiton of the new object, which isn't necessarily going to be on a vertex. [how would that be done?]

Anyone have any advice for me? Essentially I am looking for a surface detection algo.

Thanks

paulwconnor
11-02-2004, 06:41 AM
Hi,

I'm not sure that you even need a 'real' plane in the scene - unless you want a visual way of defining which plane to align the objects to? You could just base the final MEL algorithm on the abstract equation for a plane.

[ BTW - what do you mean by 'which is aligned along x,z, but can have varying y along the surface'..? It can't be aligned to the x-z plane AND vary in y - maybe I've misunderstood you? ]

So, basically, you need a way of making a number of objects (are they identical?) lie on this plane? How would you want to tell the script which direction for each object should be normal to the plane? Would it always be the object's x-axis, for example?

Cheers,

Jhavna
11-02-2004, 07:57 AM
Hi,
thanks for the reply. Yes, the plnae is to be used to allow the user to define a surface to attach the objects to (they will all be the same).
What I meant by the plane's description is

this (http://www.jhavna.net/share/plane.jpg)

As you can see it kind of defines a hill shape, which is flat to the ground plane, but has avarying heights etc.

The objects will be created by the script, so I will always know which way up is. All objects will be similar, but not identical. I figured out that I can get the normals for each vertex of the plane, but not for the face (or can I?). If I could do that, I could populate the faces quite easily, by treating each face as a plane and populating that with the shapes.

You reckon it'd be better to use API than MEL for this?

goleafsgo
11-03-2004, 07:37 PM
If you have got the position on the plane through the pointOnSurface command then you can also get the normal at that point with the -normal or -normalizedNormal flag on the same command.

Jhavna
11-04-2004, 11:44 AM
Thanks.. I can start development then... :)

CGTalk Moderation
01-19-2006, 06:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.