PDA

View Full Version : getting a local x,y,z coord of a vertex


ktpr
05-22-2003, 05:17 PM
I have two vertices. Is there a way to get the local (or global I guess) coordinates of these two vertices? :hmm:

thanks for your time
cheers
ktpr

TiKiMoN
05-22-2003, 06:40 PM
Turn on "Echo All Commands" in the Script Editor, and then select the vertices you want coordinates for. It will show you which vertices they are, and I am sure that from there, you can get their x, y and z coordinates.

larryvm
05-22-2003, 06:44 PM
you can get the local position of one vertex in the mesh node of the poly

the local position is vrts[numvertex]+pnts[numvertex]

vrts is the original local position and pnts is the tweak of this vertex

example
the position in x of the vertex 293 is

pSphere1.vrtx[293]+pSphere1.pntx[293]

ktpr
05-22-2003, 07:28 PM
if I understand this correctly you basically move a vertex by 0 and it returns the result, which you capture and use?

cheers
ktpr

ktpr
05-22-2003, 09:08 PM
thank you for the replies. they have helped.:applause:

In the node reference, for subdiv surfaces, it says there is a node called "vertex", which is a compound type.(file://C:\Program%20Files\AliasWavefront\Maya4.5\docs\en_US\html\Nodes\subdiv.html).

It also says that the array can be accessed using the # construct but gives no example of how to use it. My attempt to get the info gets nothing.

given subdivSphere1:
float $z[] = `getAttr subdivSphere1.vertex`
print ($z[0]); // " " <- no value

I am trying to get the vector coords of a subd point in space, which I can already do with poly vertices.

thank you for your time
cheers
ktpr

alexx
05-22-2003, 09:15 PM
i strongly recommend using the command xform , which has switches to query world space coordinates from anything..

cheers

alexx

TiKiMoN
05-22-2003, 09:20 PM
can you even select "points" on a subdivision surface? since they are evaluated through polygonal proxies, you can't actually select a "point" on the surface unless the detail level is extremely high, I would imagine. am I way off on this...?

TiKiMoN
05-22-2003, 09:38 PM
For any points, use pointPosition -w/-l (point)... the result is an array of 3 float values [float float float]. for example:

I have a polygon sphere called pSphere1.

world coordinates :
pointPosition -w pSphere1.vtx[0];

local coordinates :
pointPosition -l pSphere1.vtx[0];

Still not sure how well that will work for subd surfaces though.

ktpr
05-22-2003, 09:38 PM
alex: thanks. Xform doesn't seem to work on vertices though. Select a sud vert and run "xform -q -r -os -m;" the values are the same for everything.
---

tikimon:
(man I feel like i'm working in the dark because no one knows much about subd. The documentation is hooorrrrible)

Given a subd sphere named "subdivSphere1":

setAttr "subdivSphere1.displayLevel" 1; // where 1 should be desired level
pickWalk -d down;
querySubdiv -a 4; // selects faces.
string $vertex_list[] = `subdListComponentConversion -ff -tv`;
// print string for vertices

All this being said, does anyone understand what the # means in the flag help documentation (file://C:\Program%20Files\AliasWavefront\Maya4.5\docs\en_US\html\Nodes\flagHelp.html). I just need that damned coord of a subd vertex

again thanks
ktpr

alexx
05-22-2003, 09:42 PM
not -os.. that is object space i think (no maya here)

ther is a -ws or something for world space..

i am about 102% sure.. roughly.. i counted twice

cheers

alexx

ktpr
05-22-2003, 09:43 PM
:buttrock:
OMFG tikimon, you are my hero :)

pointPosition -l subdivSphere1.smp[256][67108867];

works like charm now I can finish my poly uv transfer to subd script. Screw that weird # construct.

ahhhh

[edit - actually thanks goes to everyone who replied to this thread :)]

cheers
ktpr

TiKiMoN
05-22-2003, 09:46 PM
sweeeeeeeeeeeet. in an effort to make myself look less intelligent than it appeared before, I just browsed through the MEL documentation until I found that command. :p anyway, glad it works! :)

CGTalk Moderation
01-15-2006, 05:00 AM
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.