POV-Ray : Newsgroups : povray.general : shear matrix problem : Re: shear matrix problem Server Time
29 Jul 2024 12:20:01 EDT (-0400)
  Re: shear matrix problem  
From: Thomas de Groot
Date: 14 Jul 2011 03:42:12
Message: <4e1e9dd4$1@news.povray.org>
No, the matrix is correct for shearing vertically, which is my 
intention, like from the Insert Menu:
   matrix <1, 0.5, 0, // matrix-shear_x_to_y
           0,  1,  0,
           0,  0,  1,
           0,  0,  0>
Where I am going wrong, I guess is by using Point_At_Trans(), instead of 
Reorient_Trans(). Still, I am not out of the wood :-(

I rewrote my code accordingly and I am sure it is the 0.5 in the matrix 
that should be replaced by a variable based on P1 and P2, but I am 
really at a loss what that should be.

Try this new code which is more towards what I intend to do:

//Start Code
#local P1 = <-1.6, 0.1, 0>;
#local P2 = < 1.7, 1.5, 0>;

#local Point =
sphere {
   <0,0,0>, 0.05
}

object {Point}
object {Point translate P1  pigment {rgb <1,0,0>}}
object {Point translate P2  pigment {rgb <1,1,0>}}

#local Segment =
box {<0.00, 0.00, -0.010>, <1.00, 0.10, 0.010>}

#local a = 0;
#local b = VDist(P1,P2);

union {
   #while (a < b)
     object {Segment
       translate <a, 0, 0>
       #if (even(a))
         pigment {rgb <0,1,0>}
       #else
         pigment {rgb <0,0,1>}
       #end
       #local a=a+1;
     }
   #end
   clipped_by {plane {x, b}}
   matrix <1, 0.5, 0, // matrix-shear_x_to_y
           0,  1,  0,
           0,  0,  1,
           0,  0,  0>
   Reorient_Trans (<P1.x,0,P1.z>, <-P2.x, 0, -P2.z>)
   translate P1
}
//End Code

If you increase or decrease the 0.5 value, you will see the shearing 
increasing or decreasing, while the short sides remain vertical like I 
want. Only, now the problem is to keep the object's far end at the P2 
location :-(

The info about Shear_Trans() and Matrix_Trans() is so succinct (for me) 
that I cannot do anything with it. My math knowledge is clearly to low 
for this.

Thomas

On 13-7-2011 16:34, Roman Reiner wrote:
> 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
>


Post a reply to this message

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