// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // % % // % IsoBCSG Include File - unofficial modification of IsoCSG :-) % // % % // % iso_bcsg.inc - CSG-like operations with isosurface functions % // % with automatic container calculation % // % % // % modified March 2002 % // % by ABX % // % % // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // % % // % Feel free to use this file for your povray work, I encourage % // % you to contact me if you have ideas for improvements. % // % % // % This is an experimental version so syntax and used methods % // % are subject to changes. % // % % // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #ifdef(iso_BCSG_Inc_Temp) // do nothing #else #declare iso_BCSG_Inc_Temp = version; #ifdef(View_POV_Include_Stack) # debug "including iso_csg.inc\n" #end #include "math.inc" #include "transforms.inc" #include "functions.inc" #include "iso_csg.inc" //------------------------------------------------------------- // ---- CSG macros ---------------------------------------- //------------------------------------------------------------- #macro IC_BMerge2(fn_A, ob_A, fn_B, ob_B) // merge 2 objects IC_Merge2(fn_A, fn_B) , merge{ object{ ob_A } object{ ob_B } } #end #macro IC_BMerge3(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C) // merge 3 objects IC_Merge3(fn_A, fn_B, fn_C) , merge{ object{ ob_A } object{ ob_B } object{ ob_C } } #end #macro IC_BMerge4(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C, fn_D, ob_D) // merge 4 objects IC_Merge4(fn_A, fn_B, fn_C, fn_D) , merge{ object{ ob_A } object{ ob_B } object{ ob_C } object{ ob_D } } #end #macro IC_BMerge5(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C, fn_D, ob_D, fn_E, ob_E) // merge 5 objects IC_Merge5(fn_A, fn_B, fn_C, fn_D, fn_E) , merge{ object{ ob_A } object{ ob_B } object{ ob_C } object{ ob_D } object{ ob_E } } #end #macro IC_BIntersection2(fn_A, ob_A, fn_B, ob_B) // intersection between 2 objects IC_Intersection2(fn_A, fn_B) , intersection{ object{ ob_A } object{ ob_B } } #end #macro IC_BIntersection3(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C) // intersection between 3 objects IC_Intersection3(fn_A, fn_B, fn_C) , intersection{ object{ ob_A } object{ ob_B } object{ ob_C } } #end #macro IC_BIntersection4(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C, fn_D, ob_D) // intersection between 4 objects IC_Intersection4(fn_A, fn_B, fn_C, fn_D) , intersection{ object{ ob_A } object{ ob_B } object{ ob_C } object{ ob_D } } #end #macro IC_BIntersection5(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C, fn_D, ob_D, fn_E, ob_E) IC_Intersection5(fn_A, fn_B, fn_C, fn_D, fn_E) , intersection{ object{ ob_A } object{ ob_B } object{ ob_C } object{ ob_D } object{ ob_E } } #end #macro IC_BDifference2(fn_A, ob_A, fn_B, ob_B) // difference between 2 objects IC_Difference2(fn_A, fn_B) , difference{ object{ ob_A } object{ ob_B } } #end #macro IC_BDifference3(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C) // difference between 3 objects IC_Difference3(fn_A, fn_B, fn_C) , difference{ object{ ob_A } object{ ob_B } object{ ob_C } } #end #macro IC_BDifference4(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C, fn_D, ob_D) // difference between 4 objects IC_Difference4(fn_A, fn_B, fn_C, fn_D) , difference{ object{ ob_A } object{ ob_B } object{ ob_C } object{ ob_D } } #end #macro IC_BDifference5(fn_A, ob_A, fn_B, ob_B, fn_C, ob_C, fn_D, ob_D, fn_E, ob_E) IC_Difference5(fn_A, fn_B, fn_C, fn_D, fn_E) , difference{ object{ ob_A } object{ ob_B } object{ ob_C } object{ ob_D } object{ ob_E } } #end //------------------------------------------------------------- // ---- Shape macros -------------------------------------- //------------------------------------------------------------- #macro IC_BPlane (Direction, Distance) IC_Plane (Direction, Distance) , plane { Direction, Distance } #end #macro IC_BSphere (Center, Radius) IC_Sphere (Center, Radius) , sphere{ Center, Radius } #end #macro IC_BBox (Start, End) IC_Box (Start, End) , box{ Start, End } #end #macro IC_BTorus (MaR, MiR) IC_Torus (MaR, MiR) , torus{ MaR, MiR } #end #macro IC_BCylinder (Start, End, Radius) IC_Cylinder (Start, End, Radius) , cylinder{ Start, End, Radius } #end #macro IC_BCone (Start, Radius1, End, Radius2) IC_Cone (Start, Radius1, End, Radius2) , cone{ Start, Radius1, End, Radius2 } #end #macro IC_BSuperellipsoid (EW, NS) IC_Superellipsoid (EW, NS) , superellipsoid{ EW, NS } #end //------------------------------------------------------------- // ---- Transform macros ---------------------------------- //------------------------------------------------------------- #macro IC_BTransform (Fn, Ob, Trans) IC_Transform (Fn, Trans) , object{ Ob transform { Trans } } #end #macro IC_BTranslate (Fn, Ob, Vect) IC_Translate (Fn, Vect) , object{ Ob translate Vect } #end #macro IC_BScale (Fn, Ob, Vect) IC_Scale (Fn, Vect) , object{ Ob scale Vect } #end #macro IC_BMatrix (Fn, Ob, Mtrx) // not equivalent to the matrix transform! IC_Matrix (Fn, Mtrx) , object{ Ob transform{ matrix < Mtrx[0][0] Mtrx[0][1] Mtrx[0][2] Mtrx[1][0] Mtrx[1][1] Mtrx[1][2] Mtrx[2][0] Mtrx[2][1] Mtrx[2][2] 0 0 0 > inverse } } #end #macro IC_BRotateR (Fn, Ob, Vect) // Rotate Radians #local Vect=Vect+<0,0,0>; IC_RotateR (Fn, Vect) , object{ Ob rotate } #end #macro IC_BRotate (Fn, Ob, Vect) // Rotate Degrees IC_Rotate (Fn, Vect) , object{ Ob rotate Vect } #end //------------------------------------------------------------- // ---- Final container extraction macro ------------------ //------------------------------------------------------------- #macro IC_Extents( F , B , Min , Max ) #declare Min = min_extent( B ); #declare Max = max_extent( B ); function{ F(x,y,z) } #end //------------------------------------------------------------- #version iso_BCSG_Inc_Temp; #end