POV-Ray : Newsgroups : povray.general : shear matrix problem : Re: shear matrix problem Server Time
29 Jul 2024 12:26:19 EDT (-0400)
  Re: shear matrix problem  
From: Roman Reiner
Date: 13 Jul 2011 10:35:01
Message: <web.4e1dad017fd51405257ce790@news.povray.org>
I'm not quite sure what you are doing, so i can't tell you what you are doing
wrong.
My guess is, that you need to transpose the upper 3x3 portion of your matrix,
that is, use

matrix <1, 0, 0,
       (P1.y-P2.y), 1, 0,
       0, 0, 1,
       0, 0, 0>

instead.

You could also try the Shear_Trans() and/or Matrix_Trans() macros in
transforms.inc instead, which are probably easier to use.

Regards Roman



Thomas de Groot <tDOTdegrootATinterDOTnlDOTnet> wrote:
> I confess that I do not really understand the working of a matrix.
> Consider the following piece of code:
>
> //start code
> #declare P1 = <-1.6, 0.0, 0>;
> #declare P2 = < 1.6, 0.8,  0>;
>
> #local Point =
> sphere {
>    <0,0,0>, 0.05
> }
>
> object {Point translate P1  pigment {rgb <1,0,0>}}
> object {Point translate P2  pigment {rgb <1,1,0>}}
>
> #declare Segment =
> box {<-0.10, 0.00, -0.010>, <0.00, 1.00, 0.010>}
>
> #local a = 0;
> #local b = VDist(P1,P2);
>
> union {
>    #while (a <= b)
>      object {Segment
>        translate <0, a, 0>
>        #if (even(a))
>          pigment {rgb <0,1,0>}
>        #else
>          pigment {rgb <0,0,1>}
>        #end
>        #local a=a+1;
>      }
>    #end
>    clipped_by {plane {y, b}}
>    matrix <1, (P1.y-P2.y), 0, // matrix-shear_x_to_y
>            0, 1, 0,
>            0, 0, 1,
>            0, 0, 0>
>    Point_At_Trans(P2-P1)
>    translate P1
> }
> //end code
>
> What I want is that the short sides of the Segment always remain
> vertical whatever the positions of P1 or P2. What am I doing wrong?
>
> Thanks for any help,
>
> Thomas


Post a reply to this message

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