POV-Ray : Newsgroups : povray.beta-test : f_rounded_box : f_rounded_box Server Time
31 Jul 2024 06:25:25 EDT (-0400)
  f_rounded_box  
From: Trevor Quayle
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

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