POV-Ray : Newsgroups : povray.text.tutorials : Rounding-off box/cylinder macros Server Time
23 Nov 2024 21:11:57 EST (-0500)
  Rounding-off box/cylinder macros (Message 1 to 10 of 10)  
From: Larry Fontaine
Subject: Rounding-off box/cylinder macros
Date: 13 Oct 1999 19:23:40
Message: <380514B9.1B724F23@isd.net>
#macro roundbox (X1,Y1,Z1,X2,Y2,Z2,R)
merge {
   cylinder { <X1+R,Y1+R,Z1+R>,<X1+R,Y1+R,Z2-R>,R }
   cylinder { <X1+R,Y1+R,Z1+R>,<X1+R,Y2-R,Z1+R>,R }
   cylinder { <X1+R,Y1+R,Z1+R>,<X2-R,Y1+R,Z1+R>,R }
   cylinder { <X2-R,Y1+R,Z1+R>,<X2-R,Y1+R,Z2-R>,R }
   cylinder { <X1+R,Y1+R,Z2-R>,<X2-R,Y1+R,Z2-R>,R }
   cylinder { <X2-R,Y1+R,Z1+R>,<X2-R,Y2-R,Z1+R>,R }
   cylinder { <X1+R,Y1+R,Z2-R>,<X1+R,Y2-R,Z2-R>,R }
   cylinder { <X2-R,Y1+R,Z2-R>,<X2-R,Y2-R,Z2-R>,R }
   cylinder { <X1+R,Y2-R,Z1+R>,<X1+R,Y2-R,Z2-R>,R }
   cylinder { <X1+R,Y2-R,Z1+R>,<X2-R,Y2-R,Z1+R>,R }
   cylinder { <X2-R,Y2-R,Z1+R>,<X2-R,Y2-R,Z2-R>,R }
   cylinder { <X1+R,Y2-R,Z2-R>,<X2-R,Y2-R,Z2-R>,R }
   sphere { <X1+R,Y1+R,Z1+R>,R }
   sphere { <X1+R,Y1+R,Z2-R>,R }
   sphere { <X1+R,Y2-R,Z1+R>,R }
   sphere { <X1+R,Y2-R,Z2-R>,R }
   sphere { <X2-R,Y1+R,Z1+R>,R }
   sphere { <X2-R,Y1+R,Z2-R>,R }
   sphere { <X2-R,Y2-R,Z1+R>,R }
   sphere { <X2-R,Y2-R,Z2-R>,R }
   box { <X1,Y1+R,Z1+R>,<X2,Y2-R,Z2-R> }
   box { <X1+R,Y1,Z1+R>,<X2-R,Y2,Z2-R> }
   box { <X1+R,Y1+R,Z1>,<X2-R,Y2-R,Z2> }
   bounded_by { box { <X1,Y1,Z1>,<X2,Y2,Z2> } }
} #end

#macro roundcylinder (H,R1,R2)
merge {
   cylinder { <0,0,0>,<0,H,0>,R1-R2 }
   cylinder { <0,R2,0>,<0,H-R2,0>,R1 }
   torus { R1-R2,R2 translate <0,R2,0> }
   torus { R1-R2,R2 translate <0,H-R2,0> }
   bounded_by { cylinder { <0,0,0>,<0,H,0>,R1 } }
} #end


Post a reply to this message

From: Alan Kong
Subject: Re: Rounding-off box/cylinder macros
Date: 14 Oct 1999 09:11:12
Message: <KXUFODP=DwTI+7vL3wvw==LODl4P@4ax.com>
On Wed, 13 Oct 1999 18:24:41 -0500, Larry Fontaine <lfo### [at] isdnet> wrote:

>#macro roundbox [..]

  Hi, David. Does this macro have an advantage over using POV-Ray's
superellipsoid primitive object?

-- 
Alan
http://www.povray.org - Home of the Persistence of Vision Ray Tracer


Post a reply to this message

From: Nieminen Juha
Subject: Re: Rounding-off box/cylinder macros
Date: 14 Oct 1999 10:23:06
Message: <3805e74a@news.povray.org>
Alan Kong <ako### [at] pacbellno-spamnet> wrote:
:   Hi, David. Does this macro have an advantage over using POV-Ray's
: superellipsoid primitive object?

  Speed?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: Rounding-off box/cylinder macros
Date: 15 Oct 1999 17:11:44
Message: <38079845.EE4BFE62@pacbell.net>
Alan Kong wrote:
> 
> On Wed, 13 Oct 1999 18:24:41 -0500, Larry Fontaine <lfo### [at] isdnet> wrote:
> 
> >#macro roundbox [..]
> 
>   Hi, David. Does this macro have an advantage over using POV-Ray's
> superellipsoid primitive object?

  One advantage is that the superellipsoid object in many of it's
manifestations is not entirely flat on it's faces where this rounded
box macro produces flat faced rounded boxes.

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Ken
Subject: Re: Rounding-off box/cylinder macros
Date: 15 Oct 1999 17:13:45
Message: <380798BB.3D364F0@pacbell.net>
A better question than the one that Alan posted is why you posted
this here instead of in one of the scene files groups ?

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Peter Popov
Subject: Re: Rounding-off box/cylinder macros
Date: 15 Oct 1999 17:40:49
Message: <DBoHOP4kP1vBqtXqvAU3e6EJA3FQ@4ax.com>
On Thu, 14 Oct 1999 06:12:00 -0700, Alan Kong
<ako### [at] pacbellNO-SPAMnet> wrote:

>On Wed, 13 Oct 1999 18:24:41 -0500, Larry Fontaine <lfo### [at] isdnet> wrote:
>
>>#macro roundbox [..]
>
>  Hi, David. Does this macro have an advantage over using POV-Ray's
>superellipsoid primitive object?

They are not interchangeable. 

The superellipsoid, by definition, can not have perfectly flat sides
and its fillets are not circular. It is also somewhat slower unless
transparent (because David's macro is using merge). Last thing is,
superellipsoids lack precise dimensional control. They are marginally
bounded by a box { -1, 1 } but precise scaling and positioning
requires trial and error.

A rounded_box has flat sides and circular fillets, renders faster
(unless transparent) and is faster at CSG (if unioned and not merged)
but consumes more memory. Its flat sides sometimes give flooding
highlights which can be avoided by using a superellipsoid (I had this
problem with my washer picture). Lastly, a rounded_box has a constant
circular edge fillet regardless of scale. 


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Alan Kong
Subject: Re: Rounding-off box/cylinder macros
Date: 15 Oct 1999 20:59:26
Message: <480HOOPsR2wJYeBSSzEvQtMJXX9Y@4ax.com>
On Sat, 16 Oct 1999 00:39:47 +0300, Peter Popov <pet### [at] usanet> wrote:

>A rounded_box has[..]

  Thanks very much for these definitive answers, Peter, Warp, and Ken.

  I used to make my own rounded boxes and cylinders but they were one-off
scenes and not as useful as a macro. I'll be sure to keep David's roundbox
macro handy.

-- 
Alan - ako### [at] povrayorg - a k o n g <at> p o v r a y <dot> o r g
http://www.povray.org - Home of the Persistence of Vision Ray Tracer


Post a reply to this message

From: Larry Fontaine
Subject: Re: Rounding-off box/cylinder macros
Date: 17 Oct 1999 19:11:19
Message: <380A57C7.555B5051@isd.net>
I don't know. I suppose it teaches a method of doing rounded boxes. I
figured most people already had a roundbox macro, what with VanSickle's and
all the other people who have previously posted theirs, so it wasn't really
necessary to post it in s-f.

Ken wrote:

> A better question than the one that Alan posted is why you posted
> this here instead of in one of the scene files groups ?
>
> --
> Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
> http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Steve
Subject: Re: Rounding-off box/cylinder macros
Date: 27 Oct 1999 05:27:39
Message: <381664A2.2E69DE55@ndirect.co.uk>
David, I don't understand what the R does in the rounded box
macro and the H in the cylinder macro.


-- 
Cheers
Steve              email mailto:sjl### [at] ndirectcouk

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.ndirect.co.uk/~sjlen/

or  http://start.at/zero-pps


Post a reply to this message

From: Ken
Subject: Re: Rounding-off box/cylinder macros
Date: 27 Oct 1999 05:31:36
Message: <3816C5AD.B24F8891@pacbell.net>
Steve wrote:
> 
> David, I don't understand what the R does in the rounded box
> macro and the H in the cylinder macro.
> 
> --
> Cheers
> Steve              email mailto:sjl### [at] ndirectcouk

If I am not mistaken you will find they mean:

R = radius of the edges of the box

H = the height of the cylinder you want to create

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

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