CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 05-22-2003, 05:17 PM   #1
ktpr
Frequenter
 
Join Date: May 2003
Posts: 183
getting a local x,y,z coord of a vertex

I have two vertices. Is there a way to get the local (or global I guess) coordinates of these two vertices?

thanks for your time
cheers
ktpr
 
Old 05-22-2003, 06:40 PM   #2
TiKiMoN
Bully of Jesters
 
TiKiMoN's Avatar
Dave Stone
Developer
Nuvox
Greenville, USA
 
Join Date: Feb 2002
Posts: 74
Arrow

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.
__________________
:=TiKiMoN
 
Old 05-22-2003, 06:44 PM   #3
larryvm
moving around the world
 
larryvm's Avatar
portfolio
fernando vizoso
TD
el ranchito
Madrid, Spain
 
Join Date: Nov 2002
Posts: 129
Send a message via MSN to larryvm
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]
__________________
larry@larryvizoso3d.com
 
Old 05-22-2003, 07:28 PM   #4
ktpr
Frequenter
 
Join Date: May 2003
Posts: 183
if I understand this correctly you basically move a vertex by 0 and it returns the result, which you capture and use?

cheers
ktpr
 
Old 05-22-2003, 09:08 PM   #5
ktpr
Frequenter
 
Join Date: May 2003
Posts: 183
Post # construct ???

thank you for the replies. they have helped.

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
 
Old 05-22-2003, 09:15 PM   #6
alexx
Yes, I Listen...
 
alexx's Avatar
Technical Director / 3D Artist
 
Join Date: Feb 2002
Posts: 2,202
i strongly recommend using the command xform , which has switches to query world space coordinates from anything..

cheers

alexx
 
Old 05-22-2003, 09:20 PM   #7
TiKiMoN
Bully of Jesters
 
TiKiMoN's Avatar
Dave Stone
Developer
Nuvox
Greenville, USA
 
Join Date: Feb 2002
Posts: 74
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
 
Old 05-22-2003, 09:38 PM   #8
TiKiMoN
Bully of Jesters
 
TiKiMoN's Avatar
Dave Stone
Developer
Nuvox
Greenville, USA
 
Join Date: Feb 2002
Posts: 74
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.
__________________
:=TiKiMoN

Last edited by TiKiMoN : 05-22-2003 at 09:41 PM.
 
Old 05-22-2003, 09:38 PM   #9
ktpr
Frequenter
 
Join Date: May 2003
Posts: 183
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
 
Old 05-22-2003, 09:42 PM   #10
alexx
Yes, I Listen...
 
alexx's Avatar
Technical Director / 3D Artist
 
Join Date: Feb 2002
Posts: 2,202
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
 
Old 05-22-2003, 09:43 PM   #11
ktpr
Frequenter
 
Join Date: May 2003
Posts: 183

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
 
Old 05-22-2003, 09:46 PM   #12
TiKiMoN
Bully of Jesters
 
TiKiMoN's Avatar
Dave Stone
Developer
Nuvox
Greenville, USA
 
Join Date: Feb 2002
Posts: 74
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. anyway, glad it works!
__________________
:=TiKiMoN
 
Old 01-15-2006, 06:00 AM   #13
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:06 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.