POV-Ray : Newsgroups : povray.newusers : Mirroring coordinates : Re: Mirroring coordinates Server Time
15 May 2024 12:21:48 EDT (-0400)
  Re: Mirroring coordinates  
From: Alain
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

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