POV-Ray : Newsgroups : povray.advanced-users : Left & Right ? Server Time
23 Nov 2024 20:41:38 EST (-0500)
  Left & Right ? (Message 1 to 5 of 5)  
From: Leroy
Subject: Left & Right ?
Date: 13 Aug 2012 22:30:18
Message: <5029b83a@news.povray.org>
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


Post a reply to this message

From: Le Forgeron
Subject: Re: Left & Right ?
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

From: Leroy
Subject: Re: Left & Right ?
Date: 14 Aug 2012 12:12:55
Message: <502a7907@news.povray.org>
Le_Forgeron wrote:
> 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 ?
Yes :)
I got into the habit of working out problems like this in 2d the 
expanding the solution to 3D. For most things 2D acts like a plane in 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".
  Your Right! Another habit of using Y as 'up' everywhere.
>  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.
> 
  Lets see, I have played around with normals and planes. Its a point 
perpendicular to a plane at <0,0,0>,it defines a plane in POV. I have no 
idea what the 'splitting plane' is!  I think you mean the plane dividing 
left and right. The dot product of (V1,Up) is a float!? I don't 
understand 'Vector N'.

> 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.
This probably is the answer I was thinking of when I asked the question!
> 
> And yes, there is a plane in which left/right has no meaning, the
> symmetry plane.
Symmetry Plane!? I'll have to google that.

Thank for your help.
Have Fun!


Post a reply to this message

From: Le Forgeron
Subject: Re: Left & Right ?
Date: 14 Aug 2012 15:39:34
Message: <502aa976@news.povray.org>
Le 14/08/2012 18:12, Leroy nous fit lire :
> Le_Forgeron wrote:
>> 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 ?
> Yes :)
> I got into the habit of working out problems like this in 2d the
> expanding the solution to 3D. For most things 2D acts like a plane in 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".
>  Your Right! Another habit of using Y as 'up' everywhere.
>>  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.
>>
>  Lets see, I have played around with normals and planes. Its a point
> perpendicular to a plane at <0,0,0>,it defines a plane in POV. I have no
> idea what the 'splitting plane' is!  I think you mean the plane dividing
> left and right.
Correct.

> The dot product of (V1,Up) is a float!? I don't
> understand 'Vector N'.

My bad. it is the cross product of N := V1 x Up

I have inversed the whole naming (not native English)
> 
>> 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.
> This probably is the answer I was thinking of when I asked the question!

You want to know the projection of V2 on N. (only the sign) of the dot
product N . V2

So compute (V1 x Up) . V2
(or whatever order you want. V2 . ( Up x V1 ), there is 2 additional
permutations, also valid (but the resulting sign might change, so stick
to one formula once chosen))

x : cross product (give a vector)
. : dot product (give  a scalar)

The sign is a local convention, there is no way to define left & right
on transmission with an alien of a remote universe.


Post a reply to this message

From: Leroy
Subject: Re: Left & Right ?
Date: 16 Aug 2012 12:51:49
Message: <502d2525@news.povray.org>
> My bad. it is the cross product of N := V1 x Up
> 
> I have inversed the whole naming (not native English)

No problem! I do it all the time and English IS my native language.
This makes more sense. I've might have caught it myself if I know more 
about vectors.


Thanks, The rest of you post answers my question fully.

Have Fun!


Post a reply to this message

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