|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 13 Mar 2002 14:36:39 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> I fixed a few problems since i posted the first version in p.b.s-f. Also
> wrote some documentation and an add-on for the Povray 3.5 insert menu.
>
> http://www.tu-bs.de/~y0013390/pov/ic/index.html
Here is proposition of IC_Box macro with function returning linear distance to
the box shape.
#macro IC_Box( Start , End )
#local Start=Start+<0,0,0>;
#local End=End+<0,0,0>;
#local Cx=max(Start.x, End.x);
#local Cy=max(Start.y, End.y);
#local Cz=max(Start.z, End.z);
#local Dx=min(Start.x, End.x);
#local Dy=min(Start.y, End.y);
#local Dz=min(Start.z, End.z);
#local Inside=function{pattern{object{box{ Start , End }}}};
function(x, y, z){
select(
Inside(x,y,z),
0,
f_r(min(x-Dx,max(x-Cx,0)),min(y-Dy,max(y-Cy,0)),min(z-Dz,max(z-Cz,0))),
max(x-Cx, y-Cy, z-Cz, Dx-x, Dy-y, Dz-z)
)
}
#end
ABX
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 14 Mar 2002 09:06:20
Message: <3C90AE5C.92DFE7CA@gmx.de>
|
|
|
| |
| |
|
|
>
> Here is proposition of IC_Box macro with function returning linear distance to
> the box shape.
>
Nice, now you just need the same for cylinders and cones and fix the scale
macro to maintain the linear distance (i'm not sure if that's possible)
and it will be a perfect distance function for all 'merge' CSGs...
BTW, wouldn't the f_rounded_box() function be faster in this case?
Christoph
--
POV-Ray tutorials, IsoWood include,
TransSkin and more: http://www.tu-bs.de/~y0013390/
Last updated 13 Mar. 2002 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 14 Mar 2002 15:06:20 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> Nice, now you just need the same for cylinders and cones
Currently I'm changing cylinder. Cone will be next :-)
> and fix the scale
> macro to maintain the linear distance (i'm not sure if that's possible)
It is only possible for <a,a,a> scale I think.
> and it will be a perfect distance function for all 'merge' CSGs...
That's what was my intention.
> BTW, wouldn't the f_rounded_box() function be faster in this case?
I tried this f_rounded_box solution at first but I'm not sure it returns
linear distances after scaling so I did it myself.
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 14 Mar 2002 15:06:20 +0100, Christoph Hormann <chr### [at] gmxde> wrote:
> now you just need the same for cylinders
#macro IC_Cylinder (Start, End, Radius)
#local Center = <0,0,0>+(Start+End)/2;
#local Cx=Center.x;
#local Cy=Center.y;
#local Cz=Center.z;
#local Len=vlength(End-Center);
#if (Len=0)
#error "iso_csg.inc: Error: zero height cylinder"
#end
#local fn_T=function { Reorient_Trans(End-Center, x) }
#local fn_X=
function(x, y){
select(x,max(x,y),select(y,max(x,y),f_r(x,y,0)))
}
#local fn_Y=
function(x, y, z){
fn_X( abs(fn_T(x, y, z).x)-Len, f_r(0,fn_T(x, y, z).y,fn_T(x, y, z).z)-Radius)
}
function(x, y, z){
(fn_Y((x-Cx),(y-Cy),(z-Cz)))
}
#end
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 14 Mar 2002 15:06:20 +0100, Christoph Hormann <chr### [at] gmxde> wrote:
> Nice, now you just need the same for cones
#macro IC_Cone (Start, Radius1, End, Radius2)
#switch(select(Radius1-Radius2,-1,0,1))
#case(0)
IC_Cylinder (Start, End, Radius1)
#break
#case(-1)
#local temp=Start;
#local Start=End;
#local End=temp;
#local temp=Radius1;
#local Radius1=Radius2;
#local Radius2=temp;
#else
#local Start=Start+<0,0,0>;
#local Cx=Start.x;
#local Cy=Start.y;
#local Cz=Start.z;
#local Len=vlength(End-Start);
#if (Len=0)
#error "iso_csg.inc: Error: zero height cone"
#end
#local fn_T=function { Reorient_Trans(End-Start, x) }
#local Edge=vnormalize(<Len,Radius1-Radius2,0>);
#local Ex=Edge.x;
#local Ey=Edge.y;
#local fn_X=
function(x, y){
select(
x,
select(
y-Radius1,
-x, // under bottom
f_r(x,y-Radius1,0) // bottom rounded edge below
bootom plane
),
select(
x*Ex-Ey*(y-Radius1),
f_r(x,y-Radius1,0), // bottom rounded edge above
bootom plane
select(
x*Ey+y*Ex-Radius1*Ex,
max(-x,x-Len,x*Ey+y*Ex-Radius1*Ex), // inside and above top cone
select(
x*Ex-Ey*y-(Ex*Len-Ey*Radius2),
x*Ey+y*Ex-Radius1*Ex, // outside edge
select(
y-Radius2,
x-Len, // above top
f_r(x-Len,y-Radius2,0) // top rounded edge
)
)
)
)
)
}
#local fn_Y=
function(x, y, z){
fn_X( fn_T(x, y, z).x, f_r(0,fn_T(x, y, z).y,fn_T(x, y, z).z))
}
function(x, y, z){
(fn_Y((x-Cx),(y-Cy),(z-Cz)))
}
#end
#end
ABX
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 15 Mar 2002 07:43:39
Message: <3C91EC7C.8364088@gmx.de>
|
|
|
| |
| |
|
|
>
>
> #macro IC_Cone (Start, Radius1, End, Radius2)
> #switch(select(Radius1-Radius2,-1,0,1))
> [...]
Wow, those selects can really confuse...
I think both these and the 'B' versions should be in separate include
files since they are purely optional.
I have not tried yet, but i suppose using f_rounded_box() is faster than
your version while the cylinder/cone macros are better than a manual
translation of the rounding macros from 'shapes.inc' with radius 0.
I will also add a 'compensated' version of scale to maintain the linear
distance as good as possible (correcting with the average of the scales
with non isotropic scaling).
Christoph
--
POV-Ray tutorials, IsoWood include,
TransSkin and more: http://www.tu-bs.de/~y0013390/
Last updated 13 Mar. 2002 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Fri, 15 Mar 2002 13:43:40 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:
> Wow, those selects can really confuse...
Yes. Perhaps You, Tor or someother fan of functions will find simpler version
but it was simples I found. But all rounded versions are only slightly slower
than yours sharp shapes.
> I think both these and the 'B' versions should be in separate include
> files since they are purely optional.
Yes, currently I have 3 file on my machine
iso_csg - your
iso_rcsg - rounded version
iso_bcsg - bounding layer
iso_bcsg doesn't contain #include of #iso_csg or #iso_bcsg so it works with
both (depending what was included by user)
> I have not tried yet, but i suppose using f_rounded_box() is faster than
> your version
I suppose. Internall codec works much faster than VM code as f_r() shows. But
I only affraid about characteristic outside of surface with threshold 0 - does
it saves linear distance ?
> while the cylinder/cone macros are better than a manual
> translation of the rounding macros from 'shapes.inc' with radius 0
You can look into p.b.i at sample image.
> I will also add a 'compensated' version of scale to maintain the linear
> distance as good as possible (correcting with the average of the scales
> with non isotropic scaling).
Great.
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
wrote:
> Here is proposition of ...
#macro IC_Inverse(Fn)
function{-Fn(x,y,z)}
#end
ABX
Post a reply to this message
|
|
| |
| |
|
|
From: Christoph Hormann
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 15 Mar 2002 09:41:27
Message: <3C920815.8F29C292@gmx.de>
|
|
|
| |
| |
|
|
>
> [...]
> I suppose. Internall codec works much faster than VM code as f_r() shows. But
> I only affraid about characteristic outside of surface with threshold 0 - does
> it saves linear distance ?
>
I think so.
Christoph
--
POV-Ray tutorials, IsoWood include,
TransSkin and more: http://www.tu-bs.de/~y0013390/
Last updated 13 Mar. 2002 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
wrote:
> Here is proposition of ...
#macro IC_Threshold ( F , Threshold )
function{ F(x,y,z) - Threshold }
#end
threshold is not a part of csg but this macro can be usefull when you want
combine isosurfaces with different thresholds
ANX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|