POV-Ray : Newsgroups : povray.beta-test : f_rounded_box Server Time
5 Nov 2024 07:19:27 EST (-0500)
  f_rounded_box (Message 1 to 7 of 7)  
From: Trevor Quayle
Subject: f_rounded_box
Date: 7 Sep 2001 09:08:42
Message: <3b98c6da$1@news.povray.org>
Ver.: v3.5 beta 1
O/S: Win2000
Computer: P4 1.4GHz, 256M

I have been trying to use the internal function "f_rounded_box" from
functions.inc to replace a rounded box macro I use but have come across some
problems.  I'm not sure if it's a problem with the function or if I just am
not using it properly (I have tried to read everything in the docs about
them before coming here).

I have included my code, variables need to be changed for the various
problems.

First, the docs claim it's defined in a cube -1 to 1, but when scaling less
than 1, the surface of the rounded box is less than what it should be (i.e.,
a=0.8)

Second, when scaling greater than one, the box seems to be the right size
but if the scale factors are used (which the docs state preserve the corner
radius), the box gets clipped (the box looks like it was bigger than scaled
with rounded edges but then clipped to the right side you may need to run
the code to see what I mean)
try:
a=<1.1,1.1,1.1>, sx=a.x, sy=a.y, sz=a.z, rad=0.75


Third, when scaling non-uniformly, the edge radius gets stretched out of
shape, it doesn't maintain it's circular radius
try:
a=<0.5,0.9,0.9>, sx=a.x, sy=a.y, sz=a.z, rad=0.5
or
a=<0.5,0.9,0.9>, sx=1, sy=1, sz=1, rad=0.5

Sorry if this is not a bug, but just my misunderstanding of the way the
functions work.

-tgq

code:


global_settings{
  assumed_gamma 2.4
  ambient_light 0.50
}

#include "colors.inc"
#include "textures.inc"
#include "functions.inc"

#declare lo = <0,0,4>;
#declare la = <0,0,0>;

camera{
  direction<0,0,1>
  up<0,1,0>
  right<4/3,0,0>
  location lo
  look_at  la
}

light_source{
  <0,0,0>
  color White
  translate lo
}

background {color White}

#declare M1=
material{
  texture{
    pigment{color rgbt<1,0,0,0.75>}
    finish{ambient .5}
  }
}

#declare M2=
material{
  texture{
    pigment{color rgbt<0,0,1,0>}
    finish{ambient .5}
  }
}

#declare a=<0.5,0.9,0.9>;
#declare sx =a.x;
#declare sy =a.y;
#declare sz =a.z;
#declare rad =.5;


#declare o1=
isosurface {function {f_rounded_box(x,y,z,rad,sx,sy,sz)}}

object{
  o1
  scale a
  material{M2}
  translate a
}
box{-a a material{M1} translate a}


Post a reply to this message

From: Gilles Tran
Subject: Re: f_rounded_box
Date: 7 Sep 2001 09:40:36
Message: <3B98CEBA.DCA132FF@inapg.inra.fr>
Trevor Quayle wrote:

> object{
>   o1
>   scale a  <-------

I bet all your problems come from here. You're rescaling the box when it's
already scaled.

G.
--

**********************
http://www.oyonale.com
**********************
Graphic experiments
Pov-ray gallery


Post a reply to this message

From: Trevor Quayle
Subject: Re: f_rounded_box
Date: 7 Sep 2001 10:18:55
Message: <3b98d74f$1@news.povray.org>
You're partially right. It seems ok when the scale is 1 or less (however the
surface still seems smaller than the comparable box even with accuracy 0).
There still seems to be a problem with scales larger than 1 though.

-tgq

"Gilles Tran" <tra### [at] inapginrafr> wrote in message
news:3B98CEBA.DCA132FF@inapg.inra.fr...
> Trevor Quayle wrote:
>
> > object{
> >   o1
> >   scale a  <-------
>
> I bet all your problems come from here. You're rescaling the box when it's
> already scaled.
>
> G.
> --
>
> **********************
> http://www.oyonale.com
> **********************
> Graphic experiments
> Pov-ray gallery
>
>


Post a reply to this message

From: Gilles Tran
Subject: Re: f_rounded_box
Date: 7 Sep 2001 10:39:00
Message: <3B98DC84.878D2E05@inapg.inra.fr>
Trevor Quayle wrote:

> You're partially right. It seems ok when the scale is 1 or less (however the
> surface still seems smaller than the comparable box even with accuracy 0).

This one may be due to the perspective (the transparent box appear larger but
isn't). Try with an orthographic camera.

> There still seems to be a problem with scales larger than 1 though.

I guess it's necessary to use contained_by. I get the problem you describe
without one.

G.
--

**********************
http://www.oyonale.com
**********************
Graphic experiments
Pov-ray gallery


Post a reply to this message

From: Trevor Quayle
Subject: Re: f_rounded_box
Date: 7 Sep 2001 11:09:27
Message: <3b98e327$1@news.povray.org>
Right and right again, so to myself RTFM!
(actually to be fair to myself, the usage of the scale factors and
contained_by command aren't explained fully, i.e., perhaps it should be
specified that the default contained_by object is a box -1 to 1 and that you
should explicitly define a contained_by object)

thanks for clearing up my own misconceptions.

-tgq

"Gilles Tran" <tra### [at] inapginrafr> wrote in message
news:3B98DC84.878D2E05@inapg.inra.fr...
> Trevor Quayle wrote:
>
> > You're partially right. It seems ok when the scale is 1 or less (however
the
> > surface still seems smaller than the comparable box even with accuracy
0).
>
> This one may be due to the perspective (the transparent box appear larger
but
> isn't). Try with an orthographic camera.
>
> > There still seems to be a problem with scales larger than 1 though.
>
> I guess it's necessary to use contained_by. I get the problem you describe
> without one.
>
> G.
> --
>
> **********************
> http://www.oyonale.com
> **********************
> Graphic experiments
> Pov-ray gallery
>
>


Post a reply to this message

From: Gilles Tran
Subject: Re: f_rounded_box
Date: 7 Sep 2001 11:26:30
Message: <3B98E7A7.465D8722@inapg.inra.fr>
Trevor Quayle wrote:

> (actually to be fair to myself, the usage of the scale factors and
> contained_by command aren't explained fully, i.e., perhaps it should be
> specified that the default contained_by object is a box -1 to 1 and that you
> should explicitly define a contained_by object)

Contained_by had always been mandatory with isosurfaces (i.e. Megapov complained
about not finding a contained_by and stopped).
The behaviour is different now and you're right to say that the existence of a
default container should actually be mentioned in the doc.

G.

--

**********************
http://www.oyonale.com
**********************
Graphic experiments
Pov-ray gallery


Post a reply to this message

From: ingo
Subject: Re: f_rounded_box
Date: 7 Sep 2001 11:34:59
Message: <Xns9115B2DDB7FD0seed7@povray.org>
in news:3B98E7A7.465D8722@inapg.inra.fr Gilles Tran wrote:

> The behaviour is different now and you're right to say that the
> existence of a default container should actually be mentioned in
> the doc. 

Same seems to be the case for parametric{}
I'll add it to the docs

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

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