I was hoping someone might be able provide some tips/insight into what I would like to do for this “method” solution.
I've set up a simple version of what I would like to be able to do in Vex with the attached hip file.
In my Point Wrangler I have two sets of points coming in that make up two seperate lines.
Each point in the wrangler is moved uniquely to a new position and two new lines are drawn.
What I am needing to know how to do is get the point( vector - x,y,z position ) of where the two lines(new) intersect.
I think I am having a bit of difficulty because the only related math I ever studied is basic trigonometry.
In doing a bit of search on this project it seems I need to do a bit of studying in the area of “dot” math, vector normalization, etc.
Some of the links I've looked at seems to suggest I will have to do a combination of using 3 VEX functions:
intersect()
dot()
normal()
Some of the links I've looked at :
http://www.animated-pixels.com/notes-db/2015/9/20/vex-intersect-function [animated-pixels.com]
http://forums.odforce.net/topic/18365-normal-to-angle-how-to/ [forums.odforce.net]
http://forums.odforce.net/topic/18064-how-to-add-implicit-point-normals-in-vex/ [forums.odforce.net]
Perhaps I'm a bit vague on what I would like help on, so I guess for this post I'll try to ask one specific question for a possible answer to start chewing on.
In the first example link the guy is using the vex function intersect:
int hit_prim = intersect(1, @P, -@N, hit_point, hu, hv);
So after readin the docs on this function and what he is saying, am I right in beleiving, that if I get my arguments “right” for this function the point(vector) answer that I am looking for would be represented by the equivalent of what he has for “hit_point” ?
Also, are the two main inputs in his example to get the intersection represented by @P and -@N ?
If so, I think I would have to find a way to use/convert my two sets of vectors to use as arguments similarly.
It seems he is using one vector (@P) which I guess could be represented by one of my set of points, and he is also using what seems to be a normal (-@N) which I am guessing my other set of points could be converted to a normal? and used as that argument input?
Here I'm pasting the code from from my vex wrangler in case anyone doesn't need to open the attached file and can more quicly glean the set up.
int Line_1, Line_2;
int Pt_0_Int, Pt_1_Int, Pt_2_Int, Pt_3_Int;
vector Pt_0_Vec, Pt_1_Vec, Pt_2_Vec, Pt_3_Vec;
// Bring in the points from add node
Pt_0_Vec = point(@OpInput1, "P", 0);
Pt_1_Vec = point(@OpInput1, "P", 1);
Pt_2_Vec = point(@OpInput1, "P", 2);
Pt_3_Vec = point(@OpInput1, "P", 3);
// "translate" each point uniquely
Pt_0_Vec.x += 0.2;
Pt_0_Vec.y += 0.5;
Pt_1_Vec.x += 1;
Pt_1_Vec.y -= 0.5;
Pt_2_Vec.x += 0.6;
Pt_2_Vec.y += 0.7;
Pt_3_Vec.x -= 0.2;
Pt_3_Vec.y -= 0.8;
// Draw the 2 new lines
Line_1 = addprim(0, "polyline" );
Line_2 = addprim(0, "polyline" );
Pt_0_Int = addpoint( 0, Pt_0_Vec);
Pt_1_Int = addpoint( 0, Pt_1_Vec);
Pt_2_Int = addpoint( 0, Pt_2_Vec);
Pt_3_Int = addpoint( 0, Pt_3_Vec);
addvertex( 0, Line_1, Pt_0_Int );
addvertex( 0, Line_1, Pt_1_Int );
addvertex( 0, Line_2, Pt_2_Int );
addvertex( 0, Line_2, Pt_3_Int );
// Next - find the x,y,z vector of the point intersection of the 2 new lines
// ????
Thank you for any help anyone can provide.