POV-Ray : Newsgroups : povray.text.scene-files : Re: Announce: IsoCSG include file 0.2.1 Server Time
29 Jul 2024 08:17:14 EDT (-0400)
  Re: Announce: IsoCSG include file 0.2.1 (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 15 Mar 2002 05:43:07
Message: <luj39usb6135jfhup6m7kk4s5b8u3557gp@4ax.com>
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

From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 15 Mar 2002 08:01:13
Message: <ger39ucvme0mk53clgkv44p8fmu4ttbelj@4ax.com>
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

From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 15 Mar 2002 08:31:01
Message: <7qt39ukhkjdj5gt1gah4q5k6palf1rma51@4ax.com>

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

From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 22 Mar 2002 04:38:47
Message: <olul9u8hc942jc3as41bkn2pv8v7ve9ful@4ax.com>

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

From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 25 Mar 2002 05:42:01
Message: <7fvt9u0qv5357ile4c5a638ku65dd69c2g@4ax.com>

> 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

From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 2 May 2002 03:21:42
Message: <4mp1du4obelntvstdua4foq43q6n1tjgeu@4ax.com>

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>

> 

> 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

From:
Subject: Re: Announce: IsoCSG include file 0.2.1
Date: 6 May 2002 10:36:24
Message: <gn4dduk71uhbjtoojjbhm6lfn15a60g60i@4ax.com>
On Thu, 02 May 2002 10:17:19 +0200, Christoph Hormann <chr### [at] gmxde>
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

<<< Previous 4 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.