POV-Ray : Newsgroups : povray.newusers : Mirroring coordinates Server Time
23 Nov 2024 15:05:58 EST (-0500)
  Mirroring coordinates (Message 1 to 5 of 5)  
From: Bald Eagle
Subject: Mirroring coordinates
Date: 31 Jul 2013 16:35:00
Message: <web.51f973f9cc1592c73fc9ebb0@news.povray.org>
Is there a simple straightforward way to "mirror" objects in a plane?

For example, convert <-1, 0, 0,> to <1, 0, 0>?
I'm not yet familiar enough with the voluminous documentation to know what to
look for, or of there's vector function that handles this.


Post a reply to this message

From: Stephen
Subject: Re: Mirroring coordinates
Date: 31 Jul 2013 16:51:53
Message: <51f978e9$1@news.povray.org>
On 31/07/2013 9:30 PM, Bald Eagle wrote:
> Is there a simple straightforward way to "mirror" objects in a plane?
>
> For example, convert <-1, 0, 0,> to <1, 0, 0>?

Have you tried <-1, 0, 0,> * -1 ?

or <-1, 0, 0,> *<-1, 0, 0> ?


-- 
Regards
     Stephen


Post a reply to this message

From: Bald Eagle
Subject: Re: Mirroring coordinates
Date: 31 Jul 2013 17:50:00
Message: <web.51f9867881587f8d73fc9ebb0@news.povray.org>
Indeed, that would be trivial for a point or dozen.

I guess my actual question is:
(a) can this be done to objects, unions, etc.
for example: [fake illustrative code]
object(My_Object) * -1
InvVector (My_Object), Mirror (My_Object) ... you get the idea.

and/or

(b) is there a way process an SDL file to switch from left handed to right
handed world coordinates?

Sorry for the confusion.


Post a reply to this message

From: Alain
Subject: Re: Mirroring coordinates
Date: 31 Jul 2013 19:05:18
Message: <51f9982e$1@news.povray.org>

> Is there a simple straightforward way to "mirror" objects in a plane?
>
> For example, convert <-1, 0, 0,> to <1, 0, 0>?
> I'm not yet familiar enough with the voluminous documentation to know what to
> look for, or of there's vector function that handles this.
>
>

Very easy, just use a scale with a negative value along one of the axis.

scale<-1,1,1> will mirror any object left to right. If the object is 
some distance from the origin, it will also move to the oposite side.

box{<10,1,1><12,3,3> scale <-1,1,1>}
will now reside from -12 to -10 along the x axis.

scale<1,-1,1> will mirror verticaly and scale<1,1,-1> will mirror front 
to back.


scale -1 will inverse your object in all direction.

It's possible to mirror relative to an non-orthogonal plane, but it's 
somewhat more complexe. It can involve some rotation, inverting scalling 
and a reversed rotation to undo the original one. An advanced option 
will use a matrix transform.

box{<1,1,1><2,2,2> rotate 30*z scale<-1,1,1> rotate -30*z}

It's beter to create your object around the origin, apply any scalling 
and rotation, THEN translate it to the desired location.
Otherwise, the scalling and rotation will cause the object to move around.




Alain


Post a reply to this message

From: clipka
Subject: Re: Mirroring coordinates
Date: 1 Aug 2013 02:24:38
Message: <51f9ff26@news.povray.org>
Am 31.07.2013 23:49, schrieb Bald Eagle:

> I guess my actual question is:
> (a) can this be done to objects, unions, etc.
> for example: [fake illustrative code]
> object(My_Object) * -1
> InvVector (My_Object), Mirror (My_Object) ... you get the idea.

Alain already mentioned the use of the scale keyword for that purpose.

> and/or

> (b) is there a way process an SDL file to switch from left handed to right
> handed world coordinates?

Yes: By defining all three of the "up", "right" and "direction" vectors 
in the camera block you get full control over the coordinate system. The 
following will give you a right-handed one:

     right      x*image_width/image_height
     up         y
     direction -z

or:

     right      x
     up         y*image_height/image_width
     direction -z

or:

     right      x*image_width
     up         y*image_height
     direction -z

but also (e.g.):

     right      x*image_width
     up         z*image_height
     direction  y

Note that besides specifying the handedness of the coordinate system 
this also sets the camera's aspect ratio, hence the image_width and 
image_height factors; it also initializes the camera orientation and 
field of view, but you can override those using the look_at and angle 
keywords.


Post a reply to this message

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