|
|
You may have figured it out but I'll post this any ways since I just
finished it, let me know if you have any questions.
Given Pts A & C and length D as well as pt P which lies on the desired plane
the macro calculates and returns B1 and B2, the two possible intersection
pts
note: if 2*L< Lac, you will get an error
also you need to initialize pts B1 and B2 for the macro to work
-tgq
//A = pt 1
//C = pt 2
//P = 3rd point on the desired plane
//L = distance from A & C to B
//B1, B2 = two possible points on the desired plane
// predeclare B1 and B2 as anything (i.e. <0,0,0>)
// they will be assigned approprite pts by the macro
#macro TwoPts (A,C,P,L,B1,B2)
#local N=vnormalize(vcross(vcross(C-A,P-A),C-A));
#local D=(A+C)/2;
#local L2=sqrt(L^2-vlength(D-A));
#local B1=D+N*L2;
#local B2=D-N*L2;
#end
//sample scene illustrating the geometry
camera{
location <5,5,-5>
look_at 0
}
light_source{y*100 rgb 1}
#declare A=<0,0,0>;
#declare C=<1,1,1>;
#declare P=<-4,0,2>;
#declare L=2;
#declare B1=<0,0,0>;
#declare B2=<0,0,0>;
TwoPts (A,C,P,L,B1,B2)
sphere{A .1 pigment{rgb<1,0,0>}}
sphere{C .1 pigment{rgb<1,0,0>}}
sphere{P .1 pigment{rgb<0,1,0>}}
sphere{B1 .1 pigment{rgb<1,1,0>}}
sphere{B2 .1 pigment{rgb<1,1,0>}}
plane{
vcross(C-A,P-A) 0
pigment{
object{
union{
difference{
sphere{A L}
sphere{A L*.99}
}
difference{
sphere{C L}
sphere{C L*.99}
}
}
rgb 1, rgb 0
}
}
}
// end sample scene
Post a reply to this message
|
|