|
|
I answered your question anyway:
The following macro should calculate the intersection if it exists
Note that it does not determine if the line intersects the triangle
defined by your three points. If the line segment doesn't intersect the
plane it will still find the solution
// --------------------------------------
#declare pa = <-1,-1,-1>;
#declare pb = <1,0,1>;
#declare pc = <-1,0,0>;
triangle { pa pb pc pigment { rgbf <1,1,0,0.5> } }
#declare la = <1,1,1>;
#declare lb = <-0.5,-1,-0.2>;
cylinder { la lb 0.01 pigment { rgb x } }
#macro PlaneAndLine(a,b,c,d,e)
// a,b,c are on the plane
// d and e are on the line
#local pn = vnormalize(vcross(a-b,c-b));
#local ld = vnormalize(d-e);
#local test = vdot(ld,pn);
#local ps = <0,0,0>;
#if ( abs(test) < 0.00001 )
#debug "Line does not intersect plane"
#else
#local mu = vdot((a-d),pn)/vdot(ld,pn);
#local ps = d + mu*ld;
#end
ps
#end
#declare ps = PlaneAndLine(pa,pb,pc,la,lb);
sphere { ps 0.05 pigment { rgb y } }
Josh English
eng### [at] spiritonecom
http://www.spiritone.com/~english
Post a reply to this message
|
|