|
|
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
|
|