Jump to content
CinnamonMetal

vector flows along edge of primitive

Recommended Posts

How do you add a vector for a point that follows the edge of a primitive ? Suppose a point is on an edge, now I want a vector to point along the edge.  If I use set() I'm simply setting a vector for an axis, which I don't want.

 

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

 

You can use the neighbours() function.

int pt = 0;
vector pt_pos = point(0, "P", pt);
int neighbours[] = neighbours(0, pt);
vector neighbour_pos = point(0, "P", neighbours[0]);
vector along_edge = normalize(neighbour_pos - pt_pos);

 

Share this post


Link to post
Share on other sites

And a quick way to visualize that is to assign the result to the normals. (v@N).Untitled-1.jpg.3cf1136ad4508b31f0eba496dff17e62.jpg

Share this post


Link to post
Share on other sites
int vp3 = vertexpoint(0,@vrtList[1]);
int neighbours = (0,vp3);
v@alongEdge = vp1 - vp3;

The attribute vrtList is an array containing the primitive vertices.

When displaying the attribute alongEdge the vector doesn't flow along the vertices, in this case; vertices three to vertices one. Instead the vector is directed out from the third vertices, as it's not following the edge of the primitive ?

I hope this illustration helps.  The red points are vertices; the yellow arrow is the vector that flows along the edge of the primitive which is what I want to achieve between vertices. 

vectorAlongVertices.jpg

Edited by CinnamonMetal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×