Jump to content
Sign in to follow this  
pelos

how to add a point between 2 points in vex

Recommended Posts

I have a point {0,0,0}  and another one in {1,0,0}  how can I add one or more points (equidistant) between this 2 points?  I know I can use addpoint({.5, 0,0})  but how can I get the new position?  should I delete the first P with the second? or there is an function for that?

 

thanks =)

Share this post


Link to post
Share on other sites
Posted (edited)

First find the vector from point one to point two and then divide by two:
newpointpos = ( vector two - vector one ) * 0.5

So with two add nodes and a wrangle it would look something like this:
PAB3q1v.png

Regards
Bonsak

Edited by bonsak

Share this post


Link to post
Share on other sites

that's what I was missing the division!  lol  thanks!!!I was hitting my head against the wall this time.

thanks!

Share this post


Link to post
Share on other sites

this is strange I am know the math should be right, but it seems vex evaluation from 0,0,0?  why is that? I even put a slider so I can see the point moving from point A to point B  but  it does it from 0,0,0?

is that suppose to be like that?

between_points.hip

Share this post


Link to post
Share on other sites
Posted (edited)

just use lerp

lerp(A,B,0.5);

means linearly interpolate b/n A and B with 'percentage' as 0.5 (ie. half way)

Yes from Origin is correct, you simply missed the part that you have to add the 1st point as 'offset'.

To me lerp is far simpler

Edited by Noobini

Share this post


Link to post
Share on other sites

aja,  need to move the first point from the origin =)

 

vector one = point(0, "P", 0);
vector two = point(1, "P", 0);
vector newpoint = (two-one)*ch("perc");

addpoint(geoself(), newpoint+one);

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
Sign in to follow this  

×