POV-Ray : Newsgroups : povray.advanced-users : 3D mathematics question : Re: 3D mathematics question Server Time
28 Jul 2024 16:16:55 EDT (-0400)
  Re: 3D mathematics question  
From: ABX
Date: 8 Nov 2004 16:42:49
Message: <vppvo0ljvc5nobs4q75c4fhb63ueaj3l3t@4ax.com>
On Mon, 08 Nov 2004 21:26:38 +0000, Andrew the Orchid <voi### [at] devnull> wrote:
> What I want is a vector *perpendicular* to AB, but still in the same 
> plane as the triangle... :-S

do a cross vector between triangle edges. This makes vector S perpendicular to
triangle. Now, do a cross vector between S and edge AB and you have vector to
AB and again on the plane of trinagle. Is that readable ?

Writing it blindly and without handling special cases:

#macro DoIt(A,B,V1,V2,V3) /* point and triangle */
  #local AB = B-A;
  #local P1 = V2-V1;
  #local P2 = V3-V1;
  #local S = vcross(P1,P2);
  #local P = vcross(S,AB);
  (P)
#end

ABX


Post a reply to this message

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