|
|
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
|
|
|
|
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'
|
|