POV-Ray : Newsgroups : povray.advanced-users : Math question : Re: Math question Server Time
30 Jul 2024 02:28:36 EDT (-0400)
  Re: Math question  
From: Chris Huff
Date: 10 May 2000 22:28:19
Message: <chrishuff_99-9914E0.21314010052000@news.povray.org>
In article <391A13E8.53BB7F05@hotmail.com>, Pabs <pab### [at] hotmailcom> 
wrote:

> I tried using VDist & the result is always positive because -ve * -ve = 
> +ve

The point direction should not be difficult to figure out...something 
like this maybe(I am tired and this is untested, so be warned):
O = ray origin(vector)
Pt = point on ray(vector)
Dir = ray direction(normalized vector)
Dist = point distance, calculated with VDist(floating point)

DBL cosA = 0;
VECTOR tmp;
VSub(tmp,Pt,O);
VNormalizeEq(tmp);
VDot(cosA, Dir, tmp);

if(cosA<0)
{   Dist *= -1;}


This basically flips the number(positive to negative) if the point and 
the direction are not on the same side of the ray. I think.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

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