|
|
Thanks to everyone who responded! :) I was digging thru my bookshelf
looking for my Java book and I stumbled across my old algebra book. Inside
were listed a few different ways to solve the intersection of a pair of
linear equations. I turned that into a macro, and it works! (believe me,
no one was more surprised than I!). For the curious (or bored), here's the
macro:
#macro LineIntersect( v1Start, v1End, v2Start, v2End)
//-------------------------------------------------------------------
// returns a vector with the point that represents the intersection
// of a pair of lines... assumes Z is zero and that both lines are
// neither parallel, superimposed, or vertical...
//-------------------------------------------------------------------
#local v1 = v1End - v1Start;
#local rise1 = v1.y;
#local run1 = v1.x;
#local k1 = v1Start.y;
#local h1 = v1Start.x;
#local v2 = v2End - v2Start;
#local rise2 = v2.y;
#local run2 = v2.x;
#local k2 = v2Start.y;
#local h2 = v2Start.x;
#local run3 = run2 / run1;
#local myX = (((run2*k2) - (rise2*h2)) - (run2*((run1*k1) - (rise1*h1))/
run1)) / ((run2*rise1/run1) - rise2);
#local myY = ((run1*k1) - (rise1*h1) + (rise1*myX)) / run1;
<myX, myY, 0>
#end
--------------
dan
http://hometown.aol.com/goofygrafx
Post a reply to this message
|
|