|
![](/i/fill.gif) |
On Sat, 05 Jan 2002 04:33:15 +0100, Tor Olav Kristensen <tor### [at] hotmail com>
wrote:
> I thought that maybe
> the source code below could be of interest
> for you.
What do you think about below ?
I separated rounded endcaps into another function.
#macro f_sphere_sweep_linear_segment(A,B,R)
#local D=(B-A)+0*x;
#local T=transform{
translate -A
Reorient_Trans(vnormalize(D),y)
scale <1,1/vlength(D),1>
}
#local O=-vtransform(0*x,T);
#local Ox=O.x;
#local Oy=O.y+.5;
#local Oz=O.z;
#local V=vtransform(x,T)+O;
#local Xx=V.x;
#local Xy=V.y;
#local Xz=V.z;
#local V=vtransform(y,T)+O;
#local Yx=V.x;
#local Yy=V.y;
#local Yz=V.z;
#local V=vtransform(z,T)+O;
#local Zx=V.x;
#local Zy=V.y;
#local Zz=V.z;
function{
"test.txt"
(abs(
#if(Xy!=0) +Xy*x #end
#if(Yy!=0) +Yy*y #end
#if(Zy!=0) +Zy*z #end
#if(Oy!=0) -Oy #end
)-.5)
|
f_sphere(
#if(Xx!=0) +Xx*x #end
#if(Yx!=0) +Yx*y #end
#if(Zx!=0) +Zx*z #end
#if(Ox!=0) -Ox #end
,0,
#if(Xz!=0) +Xz*x #end
#if(Yz!=0) +Yz*y #end
#if(Zz!=0) +Zz*z #end
#if(Oz!=0) -Oz #end
,
R
)
}
#end
ABX
Post a reply to this message
|
![](/i/fill.gif) |