POV-Ray : Newsgroups : povray.advanced-users : Left & Right ? : Re: Left & Right ? Server Time
26 Jun 2024 09:18:26 EDT (-0400)
  Re: Left & Right ?  
From: Le Forgeron
Date: 14 Aug 2012 02:02:30
Message: <5029e9f6$1@news.povray.org>
Le 14/08/2012 04:30, Leroy a écrit :
> Hay,
> 
>  What is the easiest(fastest) way to calculate if a point is left or
> right from your position? Given just two vectors the one your at and the
> one you want to check. While using <0,0,0> & your position vector for
> the direction your 'looking at'.
> 
>           A
>         /
> 0---at-
>         \
>           B

Is that 2D or 3D ?

V1: vector/point you are looking at from origin.
V2: vector/relative position of a point X from origin

in 3D:
 You are missing at least another vector to define the "up".
 If your vector V1 was not a direction you are looking at, but the
oriented normal of the splitting plane, you would have enough data (and
could use the solution of 2D). Vector N is the dot product of V1 and Up.

in 2D:
 I assume you are at <0,0>, and you are looking at V1, left or right for
X is best computed as the sign of the cross product.

And yes, there is a plane in which left/right has no meaning, the
symmetry plane.

-- 
A good Manager will take you
through the forest, no mater what.
A Leader will take time to climb on a
Tree and say 'This is the wrong forest'.


Post a reply to this message

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