POV-Ray : Newsgroups : povray.general : help on twisted prims : Re: help on twisted prims Server Time
29 Jul 2024 16:25:45 EDT (-0400)
  Re: help on twisted prims  
From: Florian Siegmund
Date: 8 Jan 2011 09:10:01
Message: <web.4d286f1010b5ffce2bbb5c0@news.povray.org>
"Paulo Mota" <pmo### [at] gmailcom> wrote:
> Can some one help me on the povray code to make the following solid:
> A rectangle defined on the xz plane (with two opposite corners <-h,0,-m> and
> <h,0,m>)
> is sweeped (by a thickness e) and rotated (by an angle a) along the y axis.
>
> Regards,
> Paulo Mota

You could use an isosurface to get what you are looking for...

I wrote a little scene code that does exactly that:

camera {
    location <0.75, 0.5, -1>*7
    up y
    right 4/3*x
    look_at 0
    angle 27
}

light_source {<1, 2.5, -2>*10  color rgb 1}

#declare x_h = 0.75; // half of width
#declare y_e = 1.25; // height
#declare z_m = 0.25; // half of length
#declare r_a = 135;  // rotation angle (degrees)

#declare func_box = function {max (abs (x) - x_h, abs (y - y_e/2) - y_e/2, abs
(z) - z_m)}

#declare r_a_rad_y = radians (r_a)/y_e;
#declare func_twist = function {func_box (x*cos (y*r_a_rad_y) - z*sin
(y*r_a_rad_y), y, x*sin (y*r_a_rad_y) + z*cos (y*r_a_rad_y))}

#declare twisted_box_iso =
isosurface {
    function {func_twist (x, y, z)}
    contained_by {box {-2, 2}}
    max_gradient 3
}

object {
    twisted_box_iso
    pigment {
        wrinkles
        color_map {
            [0  color rgb y]
            [1  color rgb z]
        }
    }
    finish {phong 0.5}
}

plane {
    y, 0
    pigment {checker  color rgb <0.8, 0.2, 0.1>  color rgb <1, 0.3, 0.1>}
    finish {diffuse 0.25  reflection {0.3}}
}

Regards,
Florian


Post a reply to this message

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