POV-Ray : Newsgroups : povray.general : "square" cylinder : Re: "square" cylinder Server Time
30 Jul 2024 02:15:33 EDT (-0400)
  Re: "square" cylinder  
From: Le Forgeron
Date: 7 Dec 2009 16:53:56
Message: <4b1d7974$1@news.povray.org>
Le 07/12/2009 21:17, Chris nous fit lire :
> Hi all,
> 
> I am running into a problem, I was wondering if POV-Ray had a command similar to
> cylinder, but rather than making rounded edges, the edges were at 90 degree
> angles. And the Radius would be the distance from the center of the square to
> the closest corner?

Nope.

But you can probably make a macro for that using box.

Now, you might need an additional number: the rotation along the axis

#macro Chris_cylinder(a,b,r,o)
//assuming b != a
#local leng=vlength(b-a);
#local wid=r/sqrt(2);
 <0,-wid,-wid>,<leng,wid,wid> rotate o*x
rotate vaxis_rotate(x,vcross(x,b-a),vdot(x,vnormalize(b-a)))
translate a
#end

box { Chris_cylinder(<5,10,20>,<4,6,5>,0.6,45) ... }

Now, if it would be a built-in object, the number of sides could be also
an interesting option (yours defaults to 4!)


Post a reply to this message

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