Hi,
I'm working in a PointWrangle and attempting to create a point at a position based on the X and Y relative position of two other points.
See image below.
How do I take the x,y,z of point 0 and point 1 and create a position for point 2 that's a percentage of the x and y?
I'm guessing there may be some vector math involved, but I'm not a math guy.
Here is how I'm creating the two points which is working well.
The x,y,z values here are ‘hard coded’ but in my final working node, they will not be. I need to figure this out by referencing the points.
int pnt0 = addpoint(0,{0,0,0});
int pnt1 = addpoint(0,{1,1,0});
int prim0 = addprim(0,“polyline”);
int vert0 = addvertex(0,prim0,pnt0);
int vert1 = addvertex(0,prim0,pnt1);
Any help would be appreciated.
Jim
Position a point relative to two other points?
1970 1 0- reelinspirations
- Member
- 177 posts
- Joined: Nov. 2015
- Offline
- tamte
- Member
- 8583 posts
- Joined: July 2007
- Online
just from the top of my head, hopefully works
if P0 and P1 are positions of your points
then
or for per component blends
if P0 and P1 are positions of your points
then
float blend = chf("blend") // 0-1 blend ratio between P0 and P1 @P = lerp(P0, P1, blend);
or for per component blends
vector blend = chv("blend") // 0-1 xyz blend ratios between P0 and P1 @P.x = lerp(P0.x, P1.x, blend.x); @P.y = lerp(P0.y, P1.y, blend.y); @P.z = lerp(P0.z, P1.z, blend.z);
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links