POV-Ray : Newsgroups : povray.general : Round_Box with multiple Radii Server Time
31 Oct 2024 12:15:17 EDT (-0400)
  Round_Box with multiple Radii (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Rick Measham
Subject: Round_Box with multiple Radii
Date: 30 Aug 2005 23:47:58
Message: <4315286e@news.povray.org>
I want to create a Round Box, but be able to specify Radii for each 
corner (or at least for more than a universal setting). I figure this 
will be an ISO Surface or a mesh (hopefully an ISO surface so it can 
easily be called in a macro..)

Anyone help me out here?

I was thinking I could do it with CSG, but then realised it's not 
possible as the 'sphere's in the corners aren't spheres -- not even 
scaled spheres.

Cheers!
Rick Measham


Post a reply to this message

From: Warp
Subject: Re: Round_Box with multiple Radii
Date: 31 Aug 2005 00:46:12
Message: <43153613@news.povray.org>
Rick Measham <rickm*at%isite.net.au> wrote:
> I want to create a Round Box, but be able to specify Radii for each 
> corner (or at least for more than a universal setting). I figure this 
> will be an ISO Surface or a mesh (hopefully an ISO surface so it can 
> easily be called in a macro..)

  What makes an isosurface more easily callable in a macro than a mesh?

> I was thinking I could do it with CSG, but then realised it's not 
> possible as the 'sphere's in the corners aren't spheres -- not even 
> scaled spheres.

  The problem is not that the corners would not be spherical (I don't
understand why they couldn't be). The problem is that if each corner
has a sphere of different radius, the sides of the box become non-planar.

-- 

                                                          - Warp


Post a reply to this message

From: Florian Brucker
Subject: Re: Round_Box with multiple Radii
Date: 31 Aug 2005 02:30:38
Message: <43154e8e$1@news.povray.org>
>   The problem is not that the corners would not be spherical (I don't
> understand why they couldn't be). The problem is that if each corner
> has a sphere of different radius, the sides of the box become non-planar.

It would be easier if you use only different radii for different edges, 
but I'm not sure if that's what Rick wants...


HTH,
Florian


Post a reply to this message

From: Mike Williams
Subject: Re: Round_Box with multiple Radii
Date: 31 Aug 2005 03:01:53
Message: <oTL2qAAEUVFDFwKb@econym.demon.co.uk>
Wasn't it Rick Measham who wrote:
>I want to create a Round Box, but be able to specify Radii for each 
>corner (or at least for more than a universal setting). I figure this 
>will be an ISO Surface or a mesh (hopefully an ISO surface so it can 
>easily be called in a macro..)

It's possible to create an isosurface that's a linear combination of
f_rounded_box functions with the same box size but different radii.
That's not going to give you total freedom to control the radius at each
corner individually.

The easiest version is where four corners on one end have one radius,
and the four corners on the opposite end have another radius:


#include "functions.inc"
camera { location  <0, 1, -4> look_at <0, 0, 0> angle 25}
light_source {<-100,200,-100> colour rgb 1}

// Outer dimensions of the box
#declare X=0.7;
#declare Y=0.4;
#declare Z=0.7;

// Radius of roundness on the left and right
#declare RL=0.15;
#declare RR=0.05;

isosurface {
  function { 
     f_rounded_box(x,y,z,RL,X,Y,Z) * (X-x) +
     f_rounded_box(x,y,z,RR,X,Y,Z) * (x+X)
   }
   max_gradient 1.5
   contained_by{box {-<X,Y,Z>*1.01,<X,Y,Z>*1.01}}
   pigment {rgb 1}
}

In the above case, all the corners on the left have radius RL and all
those on the right have radius RR.

When we extend this to perform linear combinations along the three axes,
the radius that gets used at the top-left-front corner is some sort of
combination of RL, RT and RF. (I'd expected it to be the average of RL,
RT and RF, but that doesn't seem to be the case.)

  function { 
     f_rounded_box(x,y,z,RL,X,Y,Z) * (X-x) +
     f_rounded_box(x,y,z,RR,X,Y,Z) * (x+X) +
     f_rounded_box(x,y,z,RB,X,Y,Z) * (Y-y) +
     f_rounded_box(x,y,z,RT,X,Y,Z) * (y+Y) +
     f_rounded_box(x,y,z,RF,X,Y,Z) * (Z-z) +
     f_rounded_box(x,y,z,RBK,X,Y,Z) * (z+Z)
   }

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: scott
Subject: Re: Round_Box with multiple Radii
Date: 31 Aug 2005 07:38:28
Message: <431596b4@news.povray.org>
>> I was thinking I could do it with CSG, but then realised it's not
>> possible as the 'sphere's in the corners aren't spheres -- not even
>> scaled spheres.
>
>   The problem is not that the corners would not be spherical (I don't
> understand why they couldn't be).

Well it depends on "how" smooth you want the corners to be.  In some
situations it would be impossible to use a sphere to get a smooth join with
all three rounded edges.

> The problem is that if each corner
> has a sphere of different radius, the sides of the box become
> non-planar.

Which is why you don't use spheres...

See attachment for adding various rounds to a box, the sides stay plane, but
there are all sorts of weird transitions.  FWIW there are many different
transitions to choose from, I guess each offering a different level of
continuity.


Post a reply to this message


Attachments:
Download 'rounds.jpg' (14 KB)

Preview of image 'rounds.jpg'
rounds.jpg


 

From: Rick Measham
Subject: Re: Round_Box with multiple Radii
Date: 31 Aug 2005 20:41:29
Message: <43164e39$1@news.povray.org>
scott wrote:
> Which is why you don't use spheres...

Exactly! Scott, your drawings don't quite exhibit what I want, but 
they're on the way .. you have varying radius on each edge, I'm looking 
for something that has an even radius ALONG each edge, but a different 
radius on each edge.

> See attachment for adding various rounds to a box, the sides stay plane, but
> there are all sorts of weird transitions.  FWIW there are many different
> transitions to choose from, I guess each offering a different level of
> continuity.

I had thought of making the corner just be an intersection of the three 
cylinders, but I wanted a smoother transition :)

Cheers!
Rick Measham


Post a reply to this message

From: Warp
Subject: Re: Round_Box with multiple Radii
Date: 1 Sep 2005 02:12:29
Message: <43169bcd@news.povray.org>
scott <sco### [at] spamcom> wrote:
> Which is why you don't use spheres...

  Then it's impossible to talk about a certain radius of a corner.

-- 

                                                          - Warp


Post a reply to this message

From: scott
Subject: Re: Round_Box with multiple Radii
Date: 1 Sep 2005 07:11:14
Message: <4316e1d2$1@news.povray.org>
Warp wrote:
> scott <sco### [at] spamcom> wrote:
>> Which is why you don't use spheres...
>
>   Then it's impossible to talk about a certain radius of a corner.

Indeed, we talk about radius of the edges, and make up some shape to smooth
the corner.


Post a reply to this message

From: scott
Subject: Re: Round_Box with multiple Radii
Date: 1 Sep 2005 08:22:07
Message: <4316f26f@news.povray.org>
Rick Measham wrote:
> scott wrote:
>> Which is why you don't use spheres...
>
> Exactly! Scott, your drawings don't quite exhibit what I want, but
> they're on the way .. you have varying radius on each edge, I'm
> looking for something that has an even radius ALONG each edge, but a
> different radius on each edge.
>
>> See attachment for adding various rounds to a box, the sides stay
>> plane, but there are all sorts of weird transitions.  FWIW there are
>> many different transitions to choose from, I guess each offering a
>> different level of continuity.
>
> I had thought of making the corner just be an intersection of the
> three cylinders, but I wanted a smoother transition :)

I think you're going to have to do some maths or look up on google for some
corner rounding algorithms.  In my CAD package, it seems to make two
surfaces when making a corner round.  One is joining the largest and
smallest radii edges and looks to be just a torus with minor radius equal to
that of the smallest radii edge round.  Then the other section is touching
the two largest rounds and the torus.  Don't know what shape this is.

Hope this helps.


Post a reply to this message


Attachments:
Download 'Image1.jpg' (16 KB)

Preview of image 'Image1.jpg'
Image1.jpg


 

From: JWV
Subject: Re: Round_Box with multiple Radii
Date: 3 Sep 2005 17:55:00
Message: <431a1bb4$1@news.povray.org>
I have been thinking about it for a while (even before your post), so
tommorrow i will give it a shot. The thing I am trying to attempt is to make
a macro that makes a box, with different (constant) radii on each edge
(corners would be easier though, i'll try that first).

Greetings,

JWV


"Rick Measham" <rickm*at%isite.net.au> wrote in message
news:4315286e@news.povray.org...
> I want to create a Round Box, but be able to specify Radii for each
> corner (or at least for more than a universal setting). I figure this
> will be an ISO Surface or a mesh (hopefully an ISO surface so it can
> easily be called in a macro..)
>
> Anyone help me out here?
>
> I was thinking I could do it with CSG, but then realised it's not
> possible as the 'sphere's in the corners aren't spheres -- not even
> scaled spheres.
>
> Cheers!
> Rick Measham


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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