 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 13 Mar 2002 14:36:39 +0100, Christoph Hormann <chr### [at] gmx de>
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>
|
|
 |
|  |
|  |
|
 |
"W這dzimierz ABX Skiba" wrote:
>
> 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] gmx de>
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] gmx de> 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] gmx de> 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>
|
|
 |
|  |
|  |
|
 |
"W這dzimierz ABX Skiba" wrote:
>
>
> #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] gmx de>
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 14 Mar 2002 14:30:44 +0100, W嚙緻dzimierz ABX Skiba <abx### [at] babilon org>
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>
|
|
 |
|  |
|  |
|
 |
"W這dzimierz ABX Skiba" wrote:
>
> [...]
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 14 Mar 2002 14:30:44 +0100, W嚙緻dzimierz ABX Skiba <abx### [at] babilon org>
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 14 Mar 2002 14:30:44 +0100, W嚙緻dzimierz ABX Skiba <abx### [at] babilon org> wrote:
> Here is proposition of ...
IC_Cylinder_Hole which in fact is shape of intersection of two cylinders
along one axis. Note that this macro has proper inside/outside behaviour and
is compatible with "sharp/rounded" strategy becouse internally use IC_Box.
#macro IC_Cylinder_Hole (Start, End, Radius, Hole)
#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 cylinder"
#end
#local fn_T = function { Reorient_Trans( End-Start , x) }
#local fn_X = IC_Box( <0,Hole,-2*max(Len,Radius,Hole)> ,
<Len,Radius,2*max(Len,Radius,Hole)> );
#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 ) , 0 )
}
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 14:30:44 +0100, W嚙緻dzimierz ABX Skiba <abx### [at] babilon org>
wrote:
> Here is proposition ...
... IC_Sor() macro
My proposition is to add two keywords to library.
#declare IC_Open=yes;
#declare IC_Close=no;
and then using new type of spline I posted in
http://news.povray.org/20p1du0a7ts1bcl84ikoae1ksfnksob9bg%404ax.com
making sor equivalent is pretty simple:
#macro IC_Sor(Array,Open)
#local f_sor=sor_spline(Array);
#if(Open=IC_Close)
IC_Intersection3(
#end
function{f_sphere(x,0,z,f_sor(y))}
#if(Open=IC_Close)
,IC_Plane(y,Array[dimension_size(Array,1)-2].v)
,IC_Plane(-y,-Array[1].v))
#end
#end
#macro IC_BSor(Array,Open)
IC_Sor(Array,Open),
sor{
#local N=dimension_size(Array,1);
N
#local n=0;
#while(n<N)
Array[n]
#local n=n+1;
#end
}
#end
Now I'll start rounded version to preserve linear distance to shape.
I hope it will be possible :-)
ABX
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Christoph Hormann
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 2 May 2002 04:17:21
Message: <3CD0F60F.B1D07B0D@gmx.de>
|
|
 |
|  |
|  |
|
 |
"W這dzimierz ABX Skiba" wrote:
>
> On Thu, 14 Mar 2002 14:30:44 +0100, W這dzimierz ABX Skiba <abx### [at] babilon org>
> wrote:
> > Here is proposition ...
>
> ... IC_Sor() macro
>
> [...]
Nice. I will add it in the next version.
>
> Now I'll start rounded version to preserve linear distance to shape.
> I hope it will be possible :-)
I doubt it. I remember some discussion about calculating a parallel to a spline for
rounding a text object and it seems very problematic. SOR might be feasible though.
Christoph
--
POV-Ray tutorials, IsoWood include,
TransSkin and more: http://www.tu-bs.de/~y0013390/
Last updated 26 Apr. 2002 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 02 May 2002 10:17:19 +0200, Christoph Hormann <chr### [at] gmx de>
wrote:
> I doubt it. I remember some discussion about calculating a parallel to a spline for
> rounding a text object and it seems very problematic. SOR might be feasible though.
I investigated the problem and found solution for future. I have simplified
equations to one calculation for given segment of spline and point
coordinates. Unfortunatelly linear distance to spline is smallest positive
root of 7th order polynomial. It can't be easy calculated in with current set
of functions but I think I'll try to make patch with bridge between functions
and Solve_Polynomial function from polysolv.h. Or perhaps somebody knows
better solution ?
ABX
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |