|
![](/i/fill.gif) |
I have developed the following macro for a U-bar. However I want to
develop it further to allow for any other angles on the corners.
UBar( width, height, leftangle, rightangle,
cross-section-radius, corner-radius )
This will allow for Ubars that look like this:
|
| /
| /
| /
\___/
It's easy to get the right angle on everything ... slicing the corner
toruses (torii?) at the right angle and positioning the side bar at the
right angle ... however, I cant work out how to position the side bar.
Any help would be greatly appreciated.
Cheers!
Rick
__SCENE__
#include "colors.inc"
camera {
location <0.0, 0.5, -4.0>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
sky_sphere {
pigment {
gradient y
color_map {
[0.0 rgb <0.6,0.7,1.0>]
[0.7 rgb <0.0,0.1,0.8>]
}
}
}
light_source {
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1> // light's color
translate <-30, 30, -30>
}
// ----------------------------------------
#macro ubar( Bwidth, Bheight, barradius, curveradius)
union {
// Bar on the bottom of the U
cylinder {
<(Bwidth * -0.5) + (barradius) + curveradius,
(barradius), 0>
<(Bwidth * +0.5) - (barradius) - curveradius,
(barradius), 0>
barradius
}
// Left bar
cylinder {
<(Bwidth * -0.5) + (barradius), (barradius) +
curveradius, 0>
<(Bwidth * -0.5) + (barradius), Bheight,
0>
barradius
}
// Left bar
cylinder {
<(Bwidth * +0.5) - (barradius), (barradius) +
curveradius, 0>
<(Bwidth * +0.5) - (barradius), Bheight,
0>
barradius
}
// Lower left curve
intersection {
torus {
curveradius
barradius
rotate <90, 0, 0>
translate < (Bwidth * -0.5) + (barradius) +
curveradius, (barradius) + curveradius, 0>
}
box {
<(Bwidth * -0.5) -0.1,
(barradius) + curveradius, barradius * -1 - 0.1>
<(Bwidth * -0.5) + (barradius) + curveradius,
-0.01, barradius * +1 + 0.1>
}
}
// Lower right curve
intersection {
torus {
curveradius
barradius
rotate <90, 0, 0>
translate < (Bwidth * -0.5) + (barradius) +
curveradius, (barradius) + curveradius, 0>
}
box {
<(Bwidth * -0.5) -0.1,
(barradius) + curveradius, barradius * -1 - 0.1>
<(Bwidth * -0.5) + (barradius) + curveradius,
-0.01, barradius * +1 + 0.1>
}
rotate <0, 180, 0>
}
}
#end
object {
ubar( 2, 1, 0.012, 0.12 )
texture {
pigment { White }
finish { reflection 0.25 }
}
}
Post a reply to this message
|
![](/i/fill.gif) |