POV-Ray : Newsgroups : povray.advanced-users : another soved problem for solving : another soved problem for solving Server Time
29 Jul 2024 14:13:46 EDT (-0400)
  another soved problem for solving  
From:
Date: 14 Dec 2001 09:09:43
Message: <dm0k1uopa5r0am2mhbn0iqckqonnkod89d@4ax.com>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.