POV-Ray : Newsgroups : povray.general : Transformations help : Re: Transformations help Server Time
31 Jul 2024 08:27:08 EDT (-0400)
  Re: Transformations help  
From: Penelope20k
Date: 19 Jun 2007 04:29:43
Message: <467793f7$1@news.povray.org>
I will subjest you to change the way you create your box
Cause you use not the appropriate variables for orient your wall.
(you cant orient your wall by not using the section parameters ..)



Hence

if you condider your defining your wall as

point A .. the point in the middle of the depht of your wall (corner bottom
left)
point B  .. the point on the middle of depht of wall (corner up right)

then your wall will be in that direction and shear in the Y direction

hence

CREATE_WALL (point A, point B, Lenght, Depth)  , the height is not require
cause = yb-ya

hence

box {0, lenght*x+depth*z+height*y}
will create thet right dimension wall

translate  z*depth/2 ...will places it at good origine for orient it

Angle between x and AB is define by
Vangle(y, <xb,yb,zb>-<xa,ya,za>) will give you the angle

hence rotate y * Vangle(y, <xb,yb,zb>-<xa,ya,za>) * pi/180 ..will place your
wall
translate <xa,ya,za> will place it













news:web.467736f6ab9c0994f850a8b00@news.povray.org...
> In the following scene I am trying to create a macro that builds a wall
> between two points. I am having trouble with the transformations. You'll
> see that it works for the current input points, but doesn't work for all
> points. I was wondering if anyone might help with getting the
> transformations right. Thanks!
>
>
>
> #include "math.inc"
> #include "colors.inc"
> #include "transforms.inc"
>
> #ifndef (Included)
>  #declare Vect1 = vrotate(<20,-20,20>, <0,0,0,>);
>  #declare Vect2 = vrotate(<-10,10,-10>, <0,0,0,>);
>
>  camera
>  {
>   up y
>   right x * image_width / image_height
>   location <0, 0, 0,> + vrotate(<0,0,-1,>,<15,-15,0,>) * 64
>   look_at <0, 0, 0,>
>  }
>
>  camera
>  {
>   orthographic
>   sky y
>   up y * 64 * image_height / image_width
>   right x * 64
>   location vrotate(-z,<0,0,0,>) * 128
>   look_at 0
>  }
>
>  sky_sphere {
>    pigment {
>      gradient y
>      color_map {
>        [0.0 rgb <0.6,0.7,1.0>]
>        [0.7 rgb <0.0,0.1,0.8>]
>      }
>    }
>  }
>
>  light_source
>  {
>   <3000, 6000, -7000>
>   rgb 1
>   parallel
>  }
> #end
>
> // ----------------------------------------
> #macro StretchyWall(Point1, Point2, Width, Height)
>  union
>  {
>   intersection
>   {
>    plane
>    {
>     y,0
>     rotate x * 85
>     translate z * Width/2
>    }
>
>    plane
>    {
>     y,0
>     rotate x * -85
>     translate z * -Width/2
>    }
>
>    box {<-1/2,0,-Width/2,>, <1/2,Height,Width/2,>}
>   }
>
>   #local Vector = Point1 - Point2;
>   scale x * vlength(Vector)
>
>   // Here's where I need help
>   Shear_Trans(x, vrotate(y,<0,0,-(90-VAngleD(Vector,y))>), z)
>   rotate z * (90 - VAngleD(y,Vector))
>   rotate y * VRotationD(x,<Vector.x,0,Vector.z,>,y)
>
>   translate ((Point1 + Point2)/2)
>  }
> #end
>
> // ----------------------------------------
> #ifndef (Included)
>
>  sphere
>  {
>   Vect1, 1
>   pigment {color Red}
>  }
>
>  sphere
>  {
>   Vect2, 1
>   pigment {color Red}
>  }
>
>
>  object
>  {
>   StretchyWall(Vect1, Vect2, 4, 8)
>   pigment {color White}
>  }
>
>  #declare Axis_Markers = union
>  {
>   sphere
>   {
>    0,0.005
>    pigment{color rgb <0,0,0,>}
>   }
>   cylinder
>   {
>    0,x,0.005
>    pigment{color rgb <1,0,0,>}
>   }
>   cylinder
>   {
>    0,y,0.005
>    pigment{color rgb <0,1,0,>}
>   }
>   cylinder
>   {
>    0,z,0.005
>    pigment{color rgb <0,0,1,>}
>   }
>  }
>
>  object
>  {
>   Axis_Markers
>   scale 32
>  }
> #end
>
>
>


Post a reply to this message

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