POV-Ray : Newsgroups : povray.general : curved prism object : Re: curved prism object Server Time
29 Jul 2024 20:21:32 EDT (-0400)
  Re: curved prism object  
From: Alain
Date: 17 Aug 2010 16:40:25
Message: <4c6af3b9$1@news.povray.org>

> Hi,
>
> I can create sharp cornered objects using prism function, such as the case of
> the
> cabinet in the picture.
>
> But creating the front door and the top/bottom panels is problematic for me
> cause I dont know how to "bend/curve" the path for a prism.
>
> the code I use for the case is below
> //top
> cls.WriteLine("union{prism {linear_spline 0,75,7");
> cls.WriteLine("<" + s1x + "," + s1y +">,<" + s2x + "," + s2y +">,<" + s3x +
> "," + s3y +">,<" + s4x + "," + s4y +">,<" + s5x + "," + s5y +">,<" + s6x +
> "," + s6y +">,<" + s1x + "," + s1y +">");
>
> cls.WriteLine(color + "} finish {phong 1 ambient 0.6 reflection 0}}");
> cls.WriteLine("rotate<-0,0,180>  ");
> cls.WriteLine("translate<0," + Height + ",0>}");
>
> Does it have something to do with linear_spline , can you give me a simple
> sample for creating this door and the top panel as prism object or another
> better object?
>
> I can draw this shape from top down view in C# gdi+, but in povray I dont know
> which arguments to feed into which function.
>
>
>
> http://www.kitchendesigned.com/public_download/curved_cabinet.jpg
>
> thank you very much for all your help
>
>
>

You may try with the bezier_spline. With that kind of spline, each 
segment is defined by 4 points. The first and last are the actual start 
and end points, while the second and third are controll points that 
define the direction of the segment at the end points and what you can 
imagine as a stiffness factor that depend on the length of the line from 
the first and second points and third and forth ones.

You can have something like this:

prism{bezier_spline 0,0.1, 20
<0,0>,<0,1>,<0,3>,<0,4>, // straight
<0,4><1,4><3,4><4,4> // straight
<4,4><4,3.5><4,3.5><4,3> // straight
<4,3>,<3.4,2.95>,<0.9,3.5>,<1,0>, // curve
<1,0>,<0,0>,<1,0>,<0,0>  // straight
pigment{rgb 1}
}


Post a reply to this message

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