POV-Ray : Newsgroups : povray.general : shear matrix problem : shear matrix problem Server Time
29 Jul 2024 12:20:17 EDT (-0400)
  shear matrix problem  
From: Thomas de Groot
Date: 13 Jul 2011 08:21:28
Message: <4e1d8dc8$1@news.povray.org>
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.