world point position from poly uv's

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 01 January 2008   #1
world point position from poly uv's

Is it possible to get the point position from a uv coord on a poly?

You can do this on a nurbs surface
i.e

pointPosition nurbsCylinder1.uv[1.79693196412904][4.79288262919124];
// Result: -0.811743 0.796932 -0.583178 //

any help appreciated
thanks
devoy
(also posted in dynamics forum)
 
Old 01 January 2008   #2
well just change .uv with .map then it should work:

  pointPosition pSphere1.map[0]
 
 
Old 01 January 2008   #3
using the .map coords doesn't give me what I want...
it does not interpolate across the uv space as the nurbs .uv's do,
and how do I know which uv coord map[$n] corresponds to?

for instance
I have particles with goalU and goalV if my goal object was nurbs I could easily
fing out where the particles were being attracted to by

float $pos[]=`pointPosition nurbs.uv[goalU][goalV]`;

unfortunately I am not using nurbs so I want to find a way of doing the same thing with
a poly object

thanks
 
Old 01 January 2008   #4
oops posted twice

Last edited by devoy : 01 January 2008 at 10:47 PM. Reason: posted twice by mistake
 
Old 01 January 2008   #5
hi

just a quick try i did - with a sphere which is parented to world..

xform -q -ws -t pSphere1.map[253] - returns a value which does give you usable values..

but when the pSphere is under a group, now the command is NOT returning world space values ???

sory this might be fully usable but just wanted to try..
__________________
|| Loka samastaa sukhino bhavantu ||
ash
 
Old 01 January 2008   #6
if I understand correctly, you're trying to find a point ANYWHERE on the poly object. I've made a script in the past that did this sorta (it was for a company so I can't post the script). Buttttt, the script involved some math to find an exact location on a plane, the math is basic algebraic math. Basically finding locations between verts based on percentages.

is/of * x/100 = %

soo basically, I'd find the 4 vert locations of the face the object is currently in. And if you take two vectors of two verts in that face, and subtract each other, you'll have a difference that you can move the object through ----

x1=3
y1=5
z1=7

x2=5
y2=10
z2=10

so the possible movement area between these two verts is

<<(x2-x1), (y2-y1), (z2-z1)>>
<<2,5,3>> --- This is your "Of" value in the equation I wrote above.

so to pull the percentage, this would be an already existing attribute on the particles themself of object itself. For particles, just make another general per particle array.
but lets say the object is 70 % between both of those verts

Soo for this --- is/of * x/100 = %
You'd look for the "Is"

And just plug in your vector you found

X/2 * 70/100 = 1.4
X/5 * 70/100 = 3.5
X/3 * 70/100 = 2.1


So, the vector 70% between point 1 and point 2 is -
<<1.4, 3.5, 2.1>>

You'd write these in scripting like this --

$Is = Of * x /100;
float $X = 2*70 / 100;

Then add the found values for point 1 -

x3=x1+1.4
y3=y1+3.5
z3=z1+2.1

x3=4.4
y3=8.5
z3=9.1


And just do it for your x y and z, but this is a bit of work. SOOOO I dunno if you feel like writing out the math for this.

----------------------

Seeing how polygon objects have UVs, and are set points in space, it's hardder to find specific points on the object. Nurbs are all math, so the mesh uses the logitude and latitude as U and V values, but you know that.


Here is something I wrote up real fast, but pretty much all it does is find the selected UV on the poly object's UV Map and converts it to a vert and finds the point in space of the vert.

string $selUV[]=`ls -sl -flatten`;
 
//Convert selection to Verts
PolySelectConvert 3;
 
string $selected[]=`ls -sl -flatten`;
 
//World Space Point Position
vector $pointPos=`pointPosition $selected[0]`;
print $pointPos;
 
//Select the original UV again
select $selUV[0];




Thats the best I can do without writing a bit larger of a code for you.

But, if you are doing this for a particle system, it's easy to just run through the verts as a goal value, and the particle will like float to the next point, you just need to lower the goal weight. That way the particles will move to the next particle. You can find the next vert to move to by finding the connected edges to the vert and find the verts on one of those edges and the vert that you arn't currently at would be the only other vert listed.

DAMN, that was long

Last edited by trancor : 01 January 2008 at 02:37 AM.
 
Old 01 January 2008   #7
didn't update in the server that I posted anything on this thread ---
 
Old 01 January 2008   #8
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



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 01:08 PM.


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