|
![](/i/fill.gif) |
I've been meaning to report this problem forever. The other problem that I
had noticed with Round_Box is that if the radius is exactly half the length
of one of the edges, you get "Parse Error: Degenerate cylinder, base point =
apex point". For example:
#include "shapes.inc"
Round_Box_Union (<5,0,0>, <10,15,5>, 2.5)
FWIW, here's my corrected version of the Round_Box macro in shapes.inc,
which fixes both problems.
// -----BEGIN-----
#macro Round_Box(A, B, EdgeRadius, UseMerge)
#local AA = <min(A.x, B.x), min(A.y, B.y), min(A.z, B.z)> + EdgeRadius;
#local BB = <max(A.x, B.x), max(A.y, B.y), max(A.z, B.z)> - EdgeRadius;
#local LBF = AA;
#local RBF = < BB.x, AA.y, AA.z>;
#local RBB = < BB.x, AA.y, BB.z>;
#local LBB = < AA.x, AA.y, BB.z>;
#local LTF = < AA.x, BB.y, AA.z>;
#local RTF = < BB.x, BB.y, AA.z>;
#local RTB = BB;
#local LTB = < AA.x, BB.y, BB.z>;
#if(UseMerge)
merge {
#else
union {
#end
sphere {LBF, EdgeRadius}
sphere {RBF, EdgeRadius}
sphere {RBB, EdgeRadius}
sphere {LBB, EdgeRadius}
sphere {LTF, EdgeRadius}
sphere {RTF, EdgeRadius}
sphere {RTB, EdgeRadius}
sphere {LTB, EdgeRadius}
#if (AA.x != BB.x)
cylinder {LBF, RBF, EdgeRadius}
cylinder {RBF, RBB, EdgeRadius}
cylinder {RBB, LBB, EdgeRadius}
cylinder {LBB, LBF, EdgeRadius}
#end
#if (AA.y != BB.y)
cylinder {LBF, LTF, EdgeRadius}
cylinder {RBF, RTF, EdgeRadius}
cylinder {RBB, RTB, EdgeRadius}
cylinder {LBB, LTB, EdgeRadius}
#end
#if (AA.z != BB.z)
cylinder {LTF, RTF, EdgeRadius}
cylinder {RTF, RTB, EdgeRadius}
cylinder {RTB, LTB, EdgeRadius}
cylinder {LTB, LTF, EdgeRadius}
#end
box {AA-EdgeRadius*x, BB+EdgeRadius*x}
box {AA-EdgeRadius*y, BB+EdgeRadius*y}
box {AA-EdgeRadius*z, BB+EdgeRadius*z}
}
#end
// -----END-----
Anders
Post a reply to this message
|
![](/i/fill.gif) |