POV-Ray : Newsgroups : povray.newusers : Matrix, shear Server Time
28 Dec 2024 09:13:05 EST (-0500)
  Matrix, shear (Message 1 to 2 of 2)  
From: Stephen
Subject: Matrix, shear
Date: 23 Nov 2001 15:02:52
Message: <3bfeab6c@news.povray.org>
I want to have a set of macros that will matrix-shear an object a set
amount.
I would like one to be for angle(degrees) and one for rise-run(as if
measured with a ruler).
What I have so far is this:

#version 3.1;
#default {texture{pigment{color<.8,.1,.1,0,0>}}}
global_settings {assumed_gamma 1.0}
background {color <1 1 1>}
camera {location <1,.5,-2> look_at<1,.5,.5> right
x*image_width/image_height}

light_source {<0,0,-10> color <1,1,1>}

#macro My_x_angle_matrix (My_x_angle)
 #declare Mymatrix =
 transform{
   matrix
     <1,0,0,
      tan(radians(My_x_angle)),1,0,
      0,0,1,
      0,0,0>
  }
  Mymatrix
#end // end macro
box{0 1 texture{} transform My_x_angle_matrix(45)}

#macro X_shear (Shear_x_rise,Shear_x_run)
  #declare My_shearmatrix =
  transform{
    matrix
     <1,0,0,
      (Shear_x_run/Shear_x_rise),1,0,
      0,0,1,
      0,0,0>
  }
  My_shearmatrix
#end // end macro
box{<1,0,0>,<2,1,1> pigment{color<.1,.8,.1,0,0>} transform X_shear(1,1)}

So far it's only for the x direction.
This seems to work, is there a better way of doing it?


Post a reply to this message

From: Warp
Subject: Re: Matrix, shear
Date: 23 Nov 2001 17:04:24
Message: <3bfec7e7@news.povray.org>
You may want to check the Shear_Trans() macro in the standard POV-Ray 3.5
include file 'transforms.inc'.

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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