POV-Ray : Newsgroups : povray.advanced-users : Embarrasing Trig Question : Re: Embarrasing Trig Question Server Time
29 Jul 2024 18:16:24 EDT (-0400)
  Re: Embarrasing Trig Question  
From: Ron Parker
Date: 28 Jun 2001 15:56:57
Message: <slrn9jn30b.563.ron.parker@fwi.com>
On Thu, 28 Jun 2001 14:24:43 -0500, deanz wrote:
>Can anyone help a trig simpleton bisect an angle in POVRay?
>
>If I have three points in space (A, B & C), how can I
>
>1) Find the angle of ABC

There's stuff you can do with the cross product and the dot product to
do this, but you don't really need it if all you want to do is bisect
the angle.  In case you do need it for some other reason, though, 

atan2(vdot(A-B,C-B),vlength(vcross(A-B,C-B))) 

should give you an answer for non-pathological cases (i.e. those where 
A, B, and C are distinct points.)

>2) Find the point (D) which lies at a point bisecting an arc AC so that
>line DB equals line AB equals line CB ?

B+vlength(C-B)*vnormalize(A/2+C/2-B);

Just like in geometry class: first bisect the line connecting A and C, 
then project that out to the circle.  Note that this assumes that A and
C are the same distance from B.  If they aren't, there's no such solution
(because AB won't equal CB as specified.)

I haven't tested either equation, so there are probably embarrassing 
errors in them.

-- 
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions


Post a reply to this message

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