一半君的总结纸

听话只听一半君

#20 How can I determine the world space coordinates of NURBS surface edit points?

Determine the U and V values for the edit point. My attempts to do this yielded the following:

Create a surfaceInfo node and connect it to the NURBS surface, then query its ‘.knotsU’ and ‘.knotsV’ attributes:

createNode surfaceInfo;
// Result: surfaceInfo1 //

connectAttr -f nurbsPlane1.worldSpace surfaceInfo1.inputSurface;

getAttr surfaceInfo1.knotsU;
// Result: 0 0 0 0.333333 0.6666667 1 1 1 //

getAttr surfaceInfo1.knotsV;
// Result: 0 0 0 0.25 0.5 0.75 1 1 1 //

This would be from a nurbsPlane with 3 spans in U and 4 spans in V. Ignore the first two 0’s and the last two 1’s (this may or may not be the case for all surfaces). So, for the edit point at the intersection of the second U span and the second V span would be:

U = 0.33333 V = 0.25

Create a pointOnSurface node at these coordinates:

string $posNode = `pointOnSurface -ch on -u 0.3333 -v .25 nurbsSurface1`;

Query the position of the pointOnSurface node:

float $posCoord = `getAttr ( $posNode + ".position" )`;
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: