|
![](/i/fill.gif) |
I wrote very simple macro for my problem but I think it is another problem for
Tor. I used new trace() but I know he likes analitic solutions. The problem is:
split one angle of triangle according to given ratio and find point on opposite
edge.
Here is my solution:
#version 3.5;
#include "math.inc"
#macro Ray_Cross_Plane(P1,P2,P3,L1,L2)
#local Normal=vcross(P2-P1,P3-P1);
#local Plane=plane{Normal 0 translate P1}
trace(Plane,L1,vnormalize(L2-L1),Normal)
#end
#macro Split_Angle(PA,PO,PB,Ratio)
#local VA=PA-PO;
#local VB=PB-PO;
#local A=VAngleD(VA,VB);
#local N=vcross(VA,VB);
#local P=vaxis_rotate(VA,N,Ratio*A)+PO;
Ray_Cross_Plane(PO,P,PO+N,PA,PB)
#end
triangle{ x , 0 , Split_Angle(x,0,y,.1) pigment{color red 1} }
triangle{ y , 0 , Split_Angle(x,0,y,.1) pigment{color green 1} }
ABX
Post a reply to this message
|
![](/i/fill.gif) |