| 
|  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 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
 Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | "Paulo Mota" <pmo### [at] gmail com> 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 
> 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
>
>
>
As ther is no twisted primitive and no twisting transformation, you 
ether need to use an isosurface as Florian mentioned, or use some 
external modeler to create a mesh of your twisted prism.
You can also do an approximation by stacking many very thin normal 
prisms, each slightly rotated relative to the one under it.
Alain
 Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Alain <aze### [at] qwerty org> wrote:
> You can also do an approximation by stacking many very thin normal 
> prisms, each slightly rotated relative to the one under it.
  Wouldn't a box be more efficient?
-- 
                                                          - Warp Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Dear Florian:
Thank you for your help.
My first attempt was to stack small parallelepipeds rotated by small angles.
Your solution gives a much better rendering.
I am new to pov-ray; so I still have a question: is your object solid? That is,
can it be subject to the difference operator?
Regards
Paulo Mota
> "Paulo Mota" <pmo### [at] gmail com> 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
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | "Paulo Mota" <pmo### [at] gmail com> wrote:
> Dear Florian:
>
> Thank you for your help.
> My first attempt was to stack small parallelepipeds rotated by small angles.
> Your solution gives a much better rendering.
>
> I am new to pov-ray; so I still have a question: is your object solid? That is,
> can it be subject to the difference operator?
>
> Regards
> Paulo Mota
>
Yes, isosurfaces are solids that have a defined in- and outside.
But for being able to use an isosurface inside a CSG operation you have to add
"max_trace" followed by an integer or the keyword "all_intersections" to the
isosurface statement. You can read the documentation for details, if you like.
Regards,
Florian Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | 
> Alain<aze### [at] qwerty org>  wrote:
>> You can also do an approximation by stacking many very thin normal
>> prisms, each slightly rotated relative to the one under it.
>
>    Wouldn't a box be more efficient?
>
It would for a rectangular section. If the section is not rectangular, 
or you have more sides, then using stacked boxes won't do.
Alain Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |