From c8b9eb58930ba24351d6e8a35477eb4f54703434 Mon Sep 17 00:00:00 2001 From: Ron Wein Date: Tue, 1 Aug 2006 12:48:10 +0000 Subject: [PATCH] Fixed all include files and updated the examples. --- .gitattributes | 7 + .../doc_tex/Envelope_3/fig/ex_tri_le.eps | 493 ++++++++++++ .../doc_tex/Envelope_3/fig/ex_tri_le.fig | 19 + .../doc_tex/Envelope_3/fig/ex_tri_ue.eps | 503 ++++++++++++ .../doc_tex/Envelope_3/fig/ex_tri_ue.fig | 25 + .../doc_tex/Envelope_3/fig/ex_triangles.eps | 118 +++ .../doc_tex/Envelope_3/fig/ex_triangles.fig | 21 + .../Envelope_3/ex_envelope_spheres.cpp | 101 +++ .../Envelope_3/ex_envelope_triangles.cpp | 88 +++ Envelope_3/examples/Envelope_3/ex_spheres.cpp | 77 -- .../examples/Envelope_3/ex_triangles.cpp | 53 -- .../examples/Envelope_3/make_xy_mon.cpp | 743 ------------------ Envelope_3/examples/Envelope_3/spheres.dat | 101 +++ .../include/CGAL/Env_triangle_traits_3.h | 4 + .../CGAL}/Envelope_3/Env_overlay_2.h | 49 +- .../Envelope_divide_and_conquer_3.h | 2 +- .../CGAL/Envelope_3/Envelope_pm_dcel.h | 18 +- .../CGAL/Envelope_3/Partial_vd_visitor.h | 46 +- .../Partial_vertical_decomposition_2.h | 71 +- Envelope_3/include/CGAL/envelope_3.h | 30 +- 20 files changed, 1531 insertions(+), 1038 deletions(-) create mode 100644 Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.eps create mode 100644 Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.fig create mode 100644 Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.eps create mode 100644 Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.fig create mode 100644 Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.eps create mode 100644 Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.fig create mode 100644 Envelope_3/examples/Envelope_3/ex_envelope_spheres.cpp create mode 100644 Envelope_3/examples/Envelope_3/ex_envelope_triangles.cpp delete mode 100644 Envelope_3/examples/Envelope_3/ex_spheres.cpp delete mode 100644 Envelope_3/examples/Envelope_3/ex_triangles.cpp delete mode 100644 Envelope_3/examples/Envelope_3/make_xy_mon.cpp create mode 100644 Envelope_3/examples/Envelope_3/spheres.dat rename Envelope_3/{test => include/CGAL}/Envelope_3/Env_overlay_2.h (81%) diff --git a/.gitattributes b/.gitattributes index 42d80b53195..15e081f9e5b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -431,6 +431,13 @@ Developers_manual/doc_tex/Developers_manual/fig/use_real.eps -text svneol=unset# Developers_manual/doc_tex/Developers_manual/fig/use_real.gif -text svneol=unset#image/gif Developers_manual/doc_tex/Developers_manual/fig/use_real.pdf -text svneol=unset#application/pdf Envelope_2/examples/Envelope_2/ex_envelope_segments.cpp -text +Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.eps -text svneol=unset#application/postscript +Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.fig -text svneol=unset#application/octet-stream +Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.eps -text svneol=unset#application/postscript +Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.fig -text svneol=unset#application/octet-stream +Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.eps -text svneol=unset#application/postscript +Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.fig -text svneol=unset#application/octet-stream +Envelope_3/examples/Envelope_3/spheres.dat -text Generator/demo/Generator/help/index.html svneol=native#text/html Generator/doc_tex/Generator/Segment_generator_prog1.gif -text svneol=unset#image/gif Generator/doc_tex/Generator/Segment_generator_prog1.pdf -text svneol=unset#application/pdf diff --git a/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.eps b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.eps new file mode 100644 index 00000000000..58c91dae05d --- /dev/null +++ b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.eps @@ -0,0 +1,493 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: ex_tri_le.fig +%%Creator: fig2dev Version 3.2 Patchlevel 5-alpha5 +%%CreationDate: Tue Aug 1 15:20:25 2006 +%%For: wein@cgal (Ron Wein,,09-576985,) +%%BoundingBox: 0 0 257 257 +%Magnification: 1.0000 +%%EndComments +/MyAppDict 100 dict dup begin def +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +newpath 0 257 moveto 0 0 lineto 257 0 lineto 257 257 lineto closepath clip newpath +-381.9 411.8 translate +1 -1 scale + +% This junk string is used by the show operators +/PATsstr 1 string def +/PATawidthshow { % cx cy cchar rx ry string + % Loop over each character in the string + { % cx cy cchar rx ry char + % Show the character + dup % cx cy cchar rx ry char char + PATsstr dup 0 4 -1 roll put % cx cy cchar rx ry char (char) + false charpath % cx cy cchar rx ry char + /clip load PATdraw + % Move past the character (charpath modified the + % current point) + currentpoint % cx cy cchar rx ry char x y + newpath + moveto % cx cy cchar rx ry char + % Reposition by cx,cy if the character in the string is cchar + 3 index eq { % cx cy cchar rx ry + 4 index 4 index rmoveto + } if + % Reposition all characters by rx ry + 2 copy rmoveto % cx cy cchar rx ry + } forall + pop pop pop pop pop % - + currentpoint + newpath + moveto +} bind def +/PATcg { + 7 dict dup begin + /lw currentlinewidth def + /lc currentlinecap def + /lj currentlinejoin def + /ml currentmiterlimit def + /ds [ currentdash ] def + /cc [ currentrgbcolor ] def + /cm matrix currentmatrix def + end +} bind def +% PATdraw - calculates the boundaries of the object and +% fills it with the current pattern +/PATdraw { % proc + save exch + PATpcalc % proc nw nh px py + 5 -1 roll exec % nw nh px py + newpath + PATfill % - + restore +} bind def +% PATfill - performs the tiling for the shape +/PATfill { % nw nh px py PATfill - + PATDict /CurrentPattern get dup begin + setfont + % Set the coordinate system to Pattern Space + PatternGState PATsg + % Set the color for uncolored pattezns + PaintType 2 eq { PATDict /PColor get PATsc } if + % Create the string for showing + 3 index string % nw nh px py str + % Loop for each of the pattern sources + 0 1 Multi 1 sub { % nw nh px py str source + % Move to the starting location + 3 index 3 index % nw nh px py str source px py + moveto % nw nh px py str source + % For multiple sources, set the appropriate color + Multi 1 ne { dup PC exch get PATsc } if + % Set the appropriate string for the source + 0 1 7 index 1 sub { 2 index exch 2 index put } for pop + % Loop over the number of vertical cells + 3 index % nw nh px py str nh + { % nw nh px py str + currentpoint % nw nh px py str cx cy + 2 index oldshow % nw nh px py str cx cy + YStep add moveto % nw nh px py str + } repeat % nw nh px py str + } for + 5 { pop } repeat + end +} bind def + +% PATkshow - kshow with the current pattezn +/PATkshow { % proc string + exch bind % string proc + 1 index 0 get % string proc char + % Loop over all but the last character in the string + 0 1 4 index length 2 sub { + % string proc char idx + % Find the n+1th character in the string + 3 index exch 1 add get % string proc char char+1 + exch 2 copy % strinq proc char+1 char char+1 char + % Now show the nth character + PATsstr dup 0 4 -1 roll put % string proc chr+1 chr chr+1 (chr) + false charpath % string proc char+1 char char+1 + /clip load PATdraw + % Move past the character (charpath modified the current point) + currentpoint newpath moveto + % Execute the user proc (should consume char and char+1) + mark 3 1 roll % string proc char+1 mark char char+1 + 4 index exec % string proc char+1 mark... + cleartomark % string proc char+1 + } for + % Now display the last character + PATsstr dup 0 4 -1 roll put % string proc (char+1) + false charpath % string proc + /clip load PATdraw + neewath + pop pop % - +} bind def +% PATmp - the makepattern equivalent +/PATmp { % patdict patmtx PATmp patinstance + exch dup length 7 add % We will add 6 new entries plus 1 FID + dict copy % Create a new dictionary + begin + % Matrix to install when painting the pattern + TilingType PATtcalc + /PatternGState PATcg def + PatternGState /cm 3 -1 roll put + % Check for multi pattern sources (Level 1 fast color patterns) + currentdict /Multi known not { /Multi 1 def } if + % Font dictionary definitions + /FontType 3 def + % Create a dummy encoding vector + /Encoding 256 array def + 3 string 0 1 255 { + Encoding exch dup 3 index cvs cvn put } for pop + /FontMatrix matrix def + /FontBBox BBox def + /BuildChar { + mark 3 1 roll % mark dict char + exch begin + Multi 1 ne {PaintData exch get}{pop} ifelse % mark [paintdata] + PaintType 2 eq Multi 1 ne or + { XStep 0 FontBBox aload pop setcachedevice } + { XStep 0 setcharwidth } ifelse + currentdict % mark [paintdata] dict + /PaintProc load % mark [paintdata] dict paintproc + end + gsave + false PATredef exec true PATredef + grestore + cleartomark % - + } bind def + currentdict + end % newdict + /foo exch % /foo newlict + definefont % newfont +} bind def +% PATpcalc - calculates the starting point and width/height +% of the tile fill for the shape +/PATpcalc { % - PATpcalc nw nh px py + PATDict /CurrentPattern get begin + gsave + % Set up the coordinate system to Pattern Space + % and lock down pattern + PatternGState /cm get setmatrix + BBox aload pop pop pop translate + % Determine the bounding box of the shape + pathbbox % llx lly urx ury + grestore + % Determine (nw, nh) the # of cells to paint width and height + PatHeight div ceiling % llx lly urx qh + 4 1 roll % qh llx lly urx + PatWidth div ceiling % qh llx lly qw + 4 1 roll % qw qh llx lly + PatHeight div floor % qw qh llx ph + 4 1 roll % ph qw qh llx + PatWidth div floor % ph qw qh pw + 4 1 roll % pw ph qw qh + 2 index sub cvi abs % pw ph qs qh-ph + exch 3 index sub cvi abs exch % pw ph nw=qw-pw nh=qh-ph + % Determine the starting point of the pattern fill + %(px, py) + 4 2 roll % nw nh pw ph + PatHeight mul % nw nh pw py + exch % nw nh py pw + PatWidth mul exch % nw nh px py + end +} bind def + +% Save the original routines so that we can use them later on +/oldfill /fill load def +/oldeofill /eofill load def +/oldstroke /stroke load def +/oldshow /show load def +/oldashow /ashow load def +/oldwidthshow /widthshow load def +/oldawidthshow /awidthshow load def +/oldkshow /kshow load def + +% These defs are necessary so that subsequent procs don't bind in +% the originals +/fill { oldfill } bind def +/eofill { oldeofill } bind def +/stroke { oldstroke } bind def +/show { oldshow } bind def +/ashow { oldashow } bind def +/widthshow { oldwidthshow } bind def +/awidthshow { oldawidthshow } bind def +/kshow { oldkshow } bind def +/PATredef { + MyAppDict begin + { + /fill { /clip load PATdraw newpath } bind def + /eofill { /eoclip load PATdraw newpath } bind def + /stroke { PATstroke } bind def + /show { 0 0 null 0 0 6 -1 roll PATawidthshow } bind def + /ashow { 0 0 null 6 3 roll PATawidthshow } + bind def + /widthshow { 0 0 3 -1 roll PATawidthshow } + bind def + /awidthshow { PATawidthshow } bind def + /kshow { PATkshow } bind def + } { + /fill { oldfill } bind def + /eofill { oldeofill } bind def + /stroke { oldstroke } bind def + /show { oldshow } bind def + /ashow { oldashow } bind def + /widthshow { oldwidthshow } bind def + /awidthshow { oldawidthshow } bind def + /kshow { oldkshow } bind def + } ifelse + end +} bind def +false PATredef +% Conditionally define setcmykcolor if not available +/setcmykcolor where { pop } { + /setcmykcolor { + 1 sub 4 1 roll + 3 { + 3 index add neg dup 0 lt { pop 0 } if 3 1 roll + } repeat + setrgbcolor - pop + } bind def +} ifelse +/PATsc { % colorarray + aload length % c1 ... cn length + dup 1 eq { pop setgray } { 3 eq { setrgbcolor } { setcmykcolor + } ifelse } ifelse +} bind def +/PATsg { % dict + begin + lw setlinewidth + lc setlinecap + lj setlinejoin + ml setmiterlimit + ds aload pop setdash + cc aload pop setrgbcolor + cm setmatrix + end +} bind def + +/PATDict 3 dict def +/PATsp { + true PATredef + PATDict begin + /CurrentPattern exch def + % If it's an uncolored pattern, save the color + CurrentPattern /PaintType get 2 eq { + /PColor exch def + } if + /CColor [ currentrgbcolor ] def + end +} bind def +% PATstroke - stroke with the current pattern +/PATstroke { + countdictstack + save + mark + { + currentpoint strokepath moveto + PATpcalc % proc nw nh px py + clip newpath PATfill + } stopped { + (*** PATstroke Warning: Path is too complex, stroking + with gray) = + cleartomark + restore + countdictstack exch sub dup 0 gt + { { end } repeat } { pop } ifelse + gsave 0.5 setgray oldstroke grestore + } { pop restore pop } ifelse + newpath +} bind def +/PATtcalc { % modmtx tilingtype PATtcalc tilematrix + % Note: tiling types 2 and 3 are not supported + gsave + exch concat % tilingtype + matrix currentmatrix exch % cmtx tilingtype + % Tiling type 1 and 3: constant spacing + 2 ne { + % Distort the pattern so that it occupies + % an integral number of device pixels + dup 4 get exch dup 5 get exch % tx ty cmtx + XStep 0 dtransform + round exch round exch % tx ty cmtx dx.x dx.y + XStep div exch XStep div exch % tx ty cmtx a b + 0 YStep dtransform + round exch round exch % tx ty cmtx a b dy.x dy.y + YStep div exch YStep div exch % tx ty cmtx a b c d + 7 -3 roll astore % { a b c d tx ty } + } if + grestore +} bind def +/PATusp { + false PATredef + PATDict begin + CColor PATsc + end +} bind def + +% left45 +11 dict begin +/PaintType 1 def +/PatternType 1 def +/TilingType 1 def +/BBox [0 0 1 1] def +/XStep 1 def +/YStep 1 def +/PatWidth 1 def +/PatHeight 1 def +/Multi 2 def +/PaintData [ + { clippath } bind + { 20 20 true [ 20 0 0 -20 0 20 ] + {<8020004010002008001004000802000401000200 + 8001004000802000401080200040100020080010 + 0400080200040100020080010040008020004010>} + imagemask } bind +] def +/PaintProc { + pop + exec fill +} def +currentdict +end +/P4 exch def + +% right45 +11 dict begin +/PaintType 1 def +/PatternType 1 def +/TilingType 1 def +/BBox [0 0 1 1] def +/XStep 1 def +/YStep 1 def +/PatWidth 1 def +/PatHeight 1 def +/Multi 2 def +/PaintData [ + { clippath } bind + { 20 20 true [ 20 0 0 -20 0 20 ] + {<0040100080200100400200800401000802001004 + 0020080040100080200000401000802001004002 + 0080040100080200100400200800401000802000>} + imagemask } bind +] def +/PaintProc { + pop + exec fill +} def +currentdict +end +/P5 exch def + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def + +$F2psBegin +10 setmiterlimit +0 slj 0 slc + 0.06299 0.06299 sc +% +% Fig objects follow +% +% +% here starts figure with depth 50 +% Polyline +0 slj +0 slc +7.500 slw +n 6750 5850 m 8100 5040 l 8100 3960 l 6750 3150 l + cp gs /PC [[1.00 1.00 1.00] [1.00 0.00 0.00]] def +15.00 15.00 sc P5 [16 0 0 -16 450.00 210.00] PATmp PATsp ef gr PATusp gs col4 s gr +% Polyline +n 9450 5850 m 8100 5040 l 8100 3960 l 9450 3150 l + cp gs /PC [[1.00 1.00 1.00] [0.00 0.00 1.00]] def +15.00 15.00 sc P4 [16 0 0 -16 540.00 210.00] PATmp PATsp ef gr PATusp gs col1 s gr +% here ends figure; +% +% here starts figure with depth 40 +% Polyline +0 slj +0 slc +30.000 slw +n 6750 5850 m 8100 5040 l 8100 3960 l 6750 3150 l + cp gs col0 s gr +% Polyline +n 9450 5850 m 8100 5040 l 8100 3960 l 9450 3150 l + cp gs col0 s gr +% Polyline +7.500 slw +n 6075 2475 m 10125 2475 l 10125 6525 l 6075 6525 l + cp gs col0 s gr +% here ends figure; +$F2psEnd +rs +end +showpage +%%Trailer +%EOF diff --git a/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.fig b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.fig new file mode 100644 index 00000000000..5c3e7cbec38 --- /dev/null +++ b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_le.fig @@ -0,0 +1,19 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +2 3 0 3 0 7 40 -1 -1 0.000 0 0 -1 0 0 5 + 6750 5850 8100 5040 8100 3960 6750 3150 6750 5850 +2 3 0 3 0 7 40 -1 -1 0.000 0 0 -1 0 0 5 + 9450 5850 8100 5040 8100 3960 9450 3150 9450 5850 +2 3 0 1 4 7 50 -1 45 0.000 0 0 -1 0 0 5 + 6750 5850 8100 5040 8100 3960 6750 3150 6750 5850 +2 3 0 1 1 7 50 -1 44 0.000 0 0 -1 0 0 5 + 9450 5850 8100 5040 8100 3960 9450 3150 9450 5850 +2 2 0 1 0 7 40 -1 -1 0.000 0 0 -1 0 0 5 + 6075 2475 10125 2475 10125 6525 6075 6525 6075 2475 diff --git a/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.eps b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.eps new file mode 100644 index 00000000000..4386e827620 --- /dev/null +++ b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.eps @@ -0,0 +1,503 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: ex_tri_ue.fig +%%Creator: fig2dev Version 3.2 Patchlevel 5-alpha5 +%%CreationDate: Tue Aug 1 15:20:34 2006 +%%For: wein@cgal (Ron Wein,,09-576985,) +%%BoundingBox: 0 0 257 257 +%Magnification: 1.0000 +%%EndComments +/MyAppDict 100 dict dup begin def +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +newpath 0 257 moveto 0 0 lineto 257 0 lineto 257 257 lineto closepath clip newpath +-126.8 411.8 translate +1 -1 scale + +% This junk string is used by the show operators +/PATsstr 1 string def +/PATawidthshow { % cx cy cchar rx ry string + % Loop over each character in the string + { % cx cy cchar rx ry char + % Show the character + dup % cx cy cchar rx ry char char + PATsstr dup 0 4 -1 roll put % cx cy cchar rx ry char (char) + false charpath % cx cy cchar rx ry char + /clip load PATdraw + % Move past the character (charpath modified the + % current point) + currentpoint % cx cy cchar rx ry char x y + newpath + moveto % cx cy cchar rx ry char + % Reposition by cx,cy if the character in the string is cchar + 3 index eq { % cx cy cchar rx ry + 4 index 4 index rmoveto + } if + % Reposition all characters by rx ry + 2 copy rmoveto % cx cy cchar rx ry + } forall + pop pop pop pop pop % - + currentpoint + newpath + moveto +} bind def +/PATcg { + 7 dict dup begin + /lw currentlinewidth def + /lc currentlinecap def + /lj currentlinejoin def + /ml currentmiterlimit def + /ds [ currentdash ] def + /cc [ currentrgbcolor ] def + /cm matrix currentmatrix def + end +} bind def +% PATdraw - calculates the boundaries of the object and +% fills it with the current pattern +/PATdraw { % proc + save exch + PATpcalc % proc nw nh px py + 5 -1 roll exec % nw nh px py + newpath + PATfill % - + restore +} bind def +% PATfill - performs the tiling for the shape +/PATfill { % nw nh px py PATfill - + PATDict /CurrentPattern get dup begin + setfont + % Set the coordinate system to Pattern Space + PatternGState PATsg + % Set the color for uncolored pattezns + PaintType 2 eq { PATDict /PColor get PATsc } if + % Create the string for showing + 3 index string % nw nh px py str + % Loop for each of the pattern sources + 0 1 Multi 1 sub { % nw nh px py str source + % Move to the starting location + 3 index 3 index % nw nh px py str source px py + moveto % nw nh px py str source + % For multiple sources, set the appropriate color + Multi 1 ne { dup PC exch get PATsc } if + % Set the appropriate string for the source + 0 1 7 index 1 sub { 2 index exch 2 index put } for pop + % Loop over the number of vertical cells + 3 index % nw nh px py str nh + { % nw nh px py str + currentpoint % nw nh px py str cx cy + 2 index oldshow % nw nh px py str cx cy + YStep add moveto % nw nh px py str + } repeat % nw nh px py str + } for + 5 { pop } repeat + end +} bind def + +% PATkshow - kshow with the current pattezn +/PATkshow { % proc string + exch bind % string proc + 1 index 0 get % string proc char + % Loop over all but the last character in the string + 0 1 4 index length 2 sub { + % string proc char idx + % Find the n+1th character in the string + 3 index exch 1 add get % string proc char char+1 + exch 2 copy % strinq proc char+1 char char+1 char + % Now show the nth character + PATsstr dup 0 4 -1 roll put % string proc chr+1 chr chr+1 (chr) + false charpath % string proc char+1 char char+1 + /clip load PATdraw + % Move past the character (charpath modified the current point) + currentpoint newpath moveto + % Execute the user proc (should consume char and char+1) + mark 3 1 roll % string proc char+1 mark char char+1 + 4 index exec % string proc char+1 mark... + cleartomark % string proc char+1 + } for + % Now display the last character + PATsstr dup 0 4 -1 roll put % string proc (char+1) + false charpath % string proc + /clip load PATdraw + neewath + pop pop % - +} bind def +% PATmp - the makepattern equivalent +/PATmp { % patdict patmtx PATmp patinstance + exch dup length 7 add % We will add 6 new entries plus 1 FID + dict copy % Create a new dictionary + begin + % Matrix to install when painting the pattern + TilingType PATtcalc + /PatternGState PATcg def + PatternGState /cm 3 -1 roll put + % Check for multi pattern sources (Level 1 fast color patterns) + currentdict /Multi known not { /Multi 1 def } if + % Font dictionary definitions + /FontType 3 def + % Create a dummy encoding vector + /Encoding 256 array def + 3 string 0 1 255 { + Encoding exch dup 3 index cvs cvn put } for pop + /FontMatrix matrix def + /FontBBox BBox def + /BuildChar { + mark 3 1 roll % mark dict char + exch begin + Multi 1 ne {PaintData exch get}{pop} ifelse % mark [paintdata] + PaintType 2 eq Multi 1 ne or + { XStep 0 FontBBox aload pop setcachedevice } + { XStep 0 setcharwidth } ifelse + currentdict % mark [paintdata] dict + /PaintProc load % mark [paintdata] dict paintproc + end + gsave + false PATredef exec true PATredef + grestore + cleartomark % - + } bind def + currentdict + end % newdict + /foo exch % /foo newlict + definefont % newfont +} bind def +% PATpcalc - calculates the starting point and width/height +% of the tile fill for the shape +/PATpcalc { % - PATpcalc nw nh px py + PATDict /CurrentPattern get begin + gsave + % Set up the coordinate system to Pattern Space + % and lock down pattern + PatternGState /cm get setmatrix + BBox aload pop pop pop translate + % Determine the bounding box of the shape + pathbbox % llx lly urx ury + grestore + % Determine (nw, nh) the # of cells to paint width and height + PatHeight div ceiling % llx lly urx qh + 4 1 roll % qh llx lly urx + PatWidth div ceiling % qh llx lly qw + 4 1 roll % qw qh llx lly + PatHeight div floor % qw qh llx ph + 4 1 roll % ph qw qh llx + PatWidth div floor % ph qw qh pw + 4 1 roll % pw ph qw qh + 2 index sub cvi abs % pw ph qs qh-ph + exch 3 index sub cvi abs exch % pw ph nw=qw-pw nh=qh-ph + % Determine the starting point of the pattern fill + %(px, py) + 4 2 roll % nw nh pw ph + PatHeight mul % nw nh pw py + exch % nw nh py pw + PatWidth mul exch % nw nh px py + end +} bind def + +% Save the original routines so that we can use them later on +/oldfill /fill load def +/oldeofill /eofill load def +/oldstroke /stroke load def +/oldshow /show load def +/oldashow /ashow load def +/oldwidthshow /widthshow load def +/oldawidthshow /awidthshow load def +/oldkshow /kshow load def + +% These defs are necessary so that subsequent procs don't bind in +% the originals +/fill { oldfill } bind def +/eofill { oldeofill } bind def +/stroke { oldstroke } bind def +/show { oldshow } bind def +/ashow { oldashow } bind def +/widthshow { oldwidthshow } bind def +/awidthshow { oldawidthshow } bind def +/kshow { oldkshow } bind def +/PATredef { + MyAppDict begin + { + /fill { /clip load PATdraw newpath } bind def + /eofill { /eoclip load PATdraw newpath } bind def + /stroke { PATstroke } bind def + /show { 0 0 null 0 0 6 -1 roll PATawidthshow } bind def + /ashow { 0 0 null 6 3 roll PATawidthshow } + bind def + /widthshow { 0 0 3 -1 roll PATawidthshow } + bind def + /awidthshow { PATawidthshow } bind def + /kshow { PATkshow } bind def + } { + /fill { oldfill } bind def + /eofill { oldeofill } bind def + /stroke { oldstroke } bind def + /show { oldshow } bind def + /ashow { oldashow } bind def + /widthshow { oldwidthshow } bind def + /awidthshow { oldawidthshow } bind def + /kshow { oldkshow } bind def + } ifelse + end +} bind def +false PATredef +% Conditionally define setcmykcolor if not available +/setcmykcolor where { pop } { + /setcmykcolor { + 1 sub 4 1 roll + 3 { + 3 index add neg dup 0 lt { pop 0 } if 3 1 roll + } repeat + setrgbcolor - pop + } bind def +} ifelse +/PATsc { % colorarray + aload length % c1 ... cn length + dup 1 eq { pop setgray } { 3 eq { setrgbcolor } { setcmykcolor + } ifelse } ifelse +} bind def +/PATsg { % dict + begin + lw setlinewidth + lc setlinecap + lj setlinejoin + ml setmiterlimit + ds aload pop setdash + cc aload pop setrgbcolor + cm setmatrix + end +} bind def + +/PATDict 3 dict def +/PATsp { + true PATredef + PATDict begin + /CurrentPattern exch def + % If it's an uncolored pattern, save the color + CurrentPattern /PaintType get 2 eq { + /PColor exch def + } if + /CColor [ currentrgbcolor ] def + end +} bind def +% PATstroke - stroke with the current pattern +/PATstroke { + countdictstack + save + mark + { + currentpoint strokepath moveto + PATpcalc % proc nw nh px py + clip newpath PATfill + } stopped { + (*** PATstroke Warning: Path is too complex, stroking + with gray) = + cleartomark + restore + countdictstack exch sub dup 0 gt + { { end } repeat } { pop } ifelse + gsave 0.5 setgray oldstroke grestore + } { pop restore pop } ifelse + newpath +} bind def +/PATtcalc { % modmtx tilingtype PATtcalc tilematrix + % Note: tiling types 2 and 3 are not supported + gsave + exch concat % tilingtype + matrix currentmatrix exch % cmtx tilingtype + % Tiling type 1 and 3: constant spacing + 2 ne { + % Distort the pattern so that it occupies + % an integral number of device pixels + dup 4 get exch dup 5 get exch % tx ty cmtx + XStep 0 dtransform + round exch round exch % tx ty cmtx dx.x dx.y + XStep div exch XStep div exch % tx ty cmtx a b + 0 YStep dtransform + round exch round exch % tx ty cmtx a b dy.x dy.y + YStep div exch YStep div exch % tx ty cmtx a b c d + 7 -3 roll astore % { a b c d tx ty } + } if + grestore +} bind def +/PATusp { + false PATredef + PATDict begin + CColor PATsc + end +} bind def + +% left45 +11 dict begin +/PaintType 1 def +/PatternType 1 def +/TilingType 1 def +/BBox [0 0 1 1] def +/XStep 1 def +/YStep 1 def +/PatWidth 1 def +/PatHeight 1 def +/Multi 2 def +/PaintData [ + { clippath } bind + { 20 20 true [ 20 0 0 -20 0 20 ] + {<8020004010002008001004000802000401000200 + 8001004000802000401080200040100020080010 + 0400080200040100020080010040008020004010>} + imagemask } bind +] def +/PaintProc { + pop + exec fill +} def +currentdict +end +/P4 exch def + +% right45 +11 dict begin +/PaintType 1 def +/PatternType 1 def +/TilingType 1 def +/BBox [0 0 1 1] def +/XStep 1 def +/YStep 1 def +/PatWidth 1 def +/PatHeight 1 def +/Multi 2 def +/PaintData [ + { clippath } bind + { 20 20 true [ 20 0 0 -20 0 20 ] + {<0040100080200100400200800401000802001004 + 0020080040100080200000401000802001004002 + 0080040100080200100400200800401000802000>} + imagemask } bind +] def +/PaintProc { + pop + exec fill +} def +currentdict +end +/P5 exch def + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def + +$F2psBegin +10 setmiterlimit +0 slj 0 slc + 0.06299 0.06299 sc +% +% Fig objects follow +% +% +% here starts figure with depth 50 +% Polyline +0 slj +0 slc +7.500 slw +n 5400 5850 m 4050 5040 l 4950 4500 l 4050 3960 l 5400 3150 l + cp gs /PC [[1.00 1.00 1.00] [0.00 0.00 1.00]] def +15.00 15.00 sc P4 [16 0 0 -16 270.00 210.00] PATmp PATsp ef gr PATusp gs col1 s gr +% Polyline +n 4050 5040 m 4950 4500 l 4050 3960 l + cp gs /PC [[1.00 1.00 1.00] [1.00 0.00 0.00]] def +15.00 15.00 sc P5 [16 0 0 -16 270.00 264.00] PATmp PATsp ef gr PATusp gs col4 s gr +% Polyline +n 4050 5040 m 3150 4500 l 4050 3960 l + cp gs /PC [[1.00 1.00 1.00] [0.00 0.00 1.00]] def +15.00 15.00 sc P4 [16 0 0 -16 210.00 264.00] PATmp PATsp ef gr PATusp gs col1 s gr +% Polyline +n 2700 5850 m 4050 5040 l 3150 4500 l 4050 3960 l 2700 3150 l + cp gs /PC [[1.00 1.00 1.00] [1.00 0.00 0.00]] def +15.00 15.00 sc P5 [16 0 0 -16 180.00 210.00] PATmp PATsp ef gr PATusp gs col4 s gr +% Polyline +n 2025 2475 m 6075 2475 l 6075 6525 l 2025 6525 l + cp gs col0 s gr +% here ends figure; +% +% here starts figure with depth 40 +% Polyline +0 slj +0 slc +30.000 slw +n 2700 5850 m 4950 4500 l 2700 3150 l + cp gs col0 s gr +% Polyline +n 5400 5850 m 3150 4500 l 5400 3150 l + cp gs col0 s gr +% Polyline +n 4050 5040 m + 4050 3960 l gs col0 s gr +% here ends figure; +$F2psEnd +rs +end +showpage +%%Trailer +%EOF diff --git a/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.fig b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.fig new file mode 100644 index 00000000000..c60cc32e5f9 --- /dev/null +++ b/Envelope_3/doc_tex/Envelope_3/fig/ex_tri_ue.fig @@ -0,0 +1,25 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +2 3 0 1 1 7 50 -1 44 0.000 0 0 -1 0 0 6 + 5400 5850 4050 5040 4950 4500 4050 3960 5400 3150 5400 5850 +2 3 0 1 4 7 50 -1 45 0.000 0 0 -1 0 0 4 + 4050 5040 4950 4500 4050 3960 4050 5040 +2 3 0 1 1 7 50 -1 44 0.000 0 0 -1 0 0 4 + 4050 5040 3150 4500 4050 3960 4050 5040 +2 3 0 1 4 7 50 -1 45 0.000 0 0 -1 0 0 6 + 2700 5850 4050 5040 3150 4500 4050 3960 2700 3150 2700 5850 +2 3 0 3 0 7 40 -1 -1 0.000 0 0 -1 0 0 4 + 2700 5850 4950 4500 2700 3150 2700 5850 +2 3 0 3 0 7 40 -1 -1 0.000 0 0 -1 0 0 4 + 5400 5850 3150 4500 5400 3150 5400 5850 +2 1 0 3 0 7 40 -1 -1 0.000 0 0 -1 0 0 2 + 4050 5040 4050 3960 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 2025 2475 6075 2475 6075 6525 2025 6525 2025 2475 diff --git a/Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.eps b/Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.eps new file mode 100644 index 00000000000..d597c7c2cdd --- /dev/null +++ b/Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.eps @@ -0,0 +1,118 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: ex_triangles.fig +%%Creator: fig2dev Version 3.2 Patchlevel 5-alpha5 +%%CreationDate: Tue Aug 1 15:20:11 2006 +%%For: wein@cgal (Ron Wein,,09-576985,) +%%BoundingBox: 0 0 291 257 +%Magnification: 1.0000 +%%EndComments +/$F2psDict 200 dict def +$F2psDict begin +$F2psDict /mtrx matrix put +/col-1 {0 setgray} bind def +/col0 {0.000 0.000 0.000 srgb} bind def +/col1 {0.000 0.000 1.000 srgb} bind def +/col2 {0.000 1.000 0.000 srgb} bind def +/col3 {0.000 1.000 1.000 srgb} bind def +/col4 {1.000 0.000 0.000 srgb} bind def +/col5 {1.000 0.000 1.000 srgb} bind def +/col6 {1.000 1.000 0.000 srgb} bind def +/col7 {1.000 1.000 1.000 srgb} bind def +/col8 {0.000 0.000 0.560 srgb} bind def +/col9 {0.000 0.000 0.690 srgb} bind def +/col10 {0.000 0.000 0.820 srgb} bind def +/col11 {0.530 0.810 1.000 srgb} bind def +/col12 {0.000 0.560 0.000 srgb} bind def +/col13 {0.000 0.690 0.000 srgb} bind def +/col14 {0.000 0.820 0.000 srgb} bind def +/col15 {0.000 0.560 0.560 srgb} bind def +/col16 {0.000 0.690 0.690 srgb} bind def +/col17 {0.000 0.820 0.820 srgb} bind def +/col18 {0.560 0.000 0.000 srgb} bind def +/col19 {0.690 0.000 0.000 srgb} bind def +/col20 {0.820 0.000 0.000 srgb} bind def +/col21 {0.560 0.000 0.560 srgb} bind def +/col22 {0.690 0.000 0.690 srgb} bind def +/col23 {0.820 0.000 0.820 srgb} bind def +/col24 {0.500 0.190 0.000 srgb} bind def +/col25 {0.630 0.250 0.000 srgb} bind def +/col26 {0.750 0.380 0.000 srgb} bind def +/col27 {1.000 0.500 0.500 srgb} bind def +/col28 {1.000 0.630 0.630 srgb} bind def +/col29 {1.000 0.750 0.750 srgb} bind def +/col30 {1.000 0.880 0.880 srgb} bind def +/col31 {1.000 0.840 0.000 srgb} bind def + +end +save +newpath 0 257 moveto 0 0 lineto 291 0 lineto 291 257 lineto closepath clip newpath +-112.6 411.8 translate +1 -1 scale + +/cp {closepath} bind def +/ef {eofill} bind def +/gr {grestore} bind def +/gs {gsave} bind def +/sa {save} bind def +/rs {restore} bind def +/l {lineto} bind def +/m {moveto} bind def +/rm {rmoveto} bind def +/n {newpath} bind def +/s {stroke} bind def +/sh {show} bind def +/slc {setlinecap} bind def +/slj {setlinejoin} bind def +/slw {setlinewidth} bind def +/srgb {setrgbcolor} bind def +/rot {rotate} bind def +/sc {scale} bind def +/sd {setdash} bind def +/ff {findfont} bind def +/sf {setfont} bind def +/scf {scalefont} bind def +/sw {stringwidth} bind def +/tr {translate} bind def +/tnt {dup dup currentrgbcolor + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add + 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} + bind def +/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul + 4 -2 roll mul srgb} bind def +/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def +/$F2psEnd {$F2psEnteredState restore end} def + +$F2psBegin +10 setmiterlimit +0 slj 0 slc + 0.06299 0.06299 sc +% +% Fig objects follow +% +% +% here starts figure with depth 40 +% Polyline +0 slj +0 slc +7.500 slw +n 4083 3712 m 4083 4832 l 3503 3412 l + cp gs col1 1.00 shd ef gr gs col0 s gr +% Polyline +n 4425 5667 m 4085 4827 l 4455 3917 l 6055 4767 l + cp gs col1 1.00 shd ef gr gs col0 s gr +% Polyline +n 4079 3712 m 4079 4832 l 4659 3412 l + cp gs col4 1.00 shd ef gr gs col0 s gr +% Polyline +n 3737 5667 m 4077 4827 l 3707 3917 l 2107 4767 l + cp gs col4 1.00 shd ef gr gs col0 s gr +% Polyline +n 1800 6525 m 6390 6525 l 6390 2475 l 1800 2475 l + cp gs col0 s gr +% here ends figure; +$F2psEnd +rs +showpage +%%Trailer +%EOF diff --git a/Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.fig b/Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.fig new file mode 100644 index 00000000000..5cfcfabaf4b --- /dev/null +++ b/Envelope_3/doc_tex/Envelope_3/fig/ex_triangles.fig @@ -0,0 +1,21 @@ +#FIG 3.2 Produced by xfig version 3.2.5-alpha5 +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +6 2070 3375 6075 5670 +2 3 0 1 0 1 40 -1 20 0.000 0 0 -1 0 0 4 + 4083 3712 4083 4832 3503 3412 4083 3712 +2 3 0 1 0 1 40 -1 20 0.000 0 0 -1 0 0 5 + 4425 5667 4085 4827 4455 3917 6055 4767 4425 5667 +2 3 0 1 0 4 40 -1 20 0.000 0 0 -1 0 0 4 + 4079 3712 4079 4832 4659 3412 4079 3712 +2 3 0 1 0 4 40 -1 20 0.000 0 0 -1 0 0 5 + 3737 5667 4077 4827 3707 3917 2107 4767 3737 5667 +-6 +2 2 0 1 0 7 40 -1 -1 0.000 0 0 -1 0 0 5 + 1800 6525 6390 6525 6390 2475 1800 2475 1800 6525 diff --git a/Envelope_3/examples/Envelope_3/ex_envelope_spheres.cpp b/Envelope_3/examples/Envelope_3/ex_envelope_spheres.cpp new file mode 100644 index 00000000000..8da142327fc --- /dev/null +++ b/Envelope_3/examples/Envelope_3/ex_envelope_spheres.cpp @@ -0,0 +1,101 @@ +//! \file examples/Envelope_3/ex_envelope_spheres.cpp +// Constructing the lower envelope of a set of spheres read from a file. +#include + +#ifndef CGAL_USE_CORE +#include +int main () +{ + std::cout << "Sorry, this example needs CORE ..." << std::endl; + return (0); +} +#else + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::CORE_algebraic_number_traits Nt_traits; +typedef Nt_traits::Rational Rational; +typedef Nt_traits::Algebraic Algebraic; +typedef CGAL::Cartesian Rat_kernel; +typedef Rat_kernel::Point_3 Rat_point_3; +typedef CGAL::Cartesian Alg_kernel; + +typedef CGAL::Arr_conic_traits_2 Conic_traits_2; + +typedef CGAL::Env_sphere_traits_3 Traits_3; +typedef Traits_3::Surface_3 Sphere_3; +typedef CGAL::Envelope_diagram_2 Envelope_diagram_2; + +int main (int argc, char **argv) +{ + // Get the name of the input file from the command line, or use the default + // fan_grids.dat file if no command-line parameters are given. + char *filename = "spheres.dat"; + + if (argc > 1) + filename = argv[1]; + + // Open the input file. + std::ifstream in_file (filename); + + if (! in_file.is_open()) + { + std::cerr << "Failed to open " << filename << " ..." << std::endl; + return (1); + } + + // Read the spheres from the file. + // The input file format should be (all coordinate values are integers): + // // number of spheres. + // // center and squared radious of sphere #1. + // // center and squared radious of sphere #2. + // : : : : + // // center and squared radious of sphere #n. + int n; + std::list spheres; + int x, y, z, sqr_r; + int i; + + in_file >> n; + for (i = 0; i < n; i++) + { + in_file >> x >> y >> z >> sqr_r; + + spheres.push_back (Sphere_3 (Rat_point_3 (x, y, z), + Rational (sqr_r))); + } + in_file.close(); + + // Compute the lower envelope. + Envelope_diagram_2 min_diag; + CGAL::Timer timer; + + std::cout << "Constructing the lower envelope of " + << n << " spheres." << std::endl; + + timer.start(); + CGAL::lower_envelope_3 (spheres.begin(), spheres.end(), + min_diag); + timer.stop(); + + // Print the dimensions of the minimization diagram. + std::cout << "V = " << min_diag.number_of_vertices() + << ", E = " << min_diag.number_of_edges() + << ", F = " << min_diag.number_of_faces() << std::endl; + + std::cout << "Construction took " << timer.time() + << " seconds." << std::endl; + + return (0); +} + +#endif diff --git a/Envelope_3/examples/Envelope_3/ex_envelope_triangles.cpp b/Envelope_3/examples/Envelope_3/ex_envelope_triangles.cpp new file mode 100644 index 00000000000..65307011d51 --- /dev/null +++ b/Envelope_3/examples/Envelope_3/ex_envelope_triangles.cpp @@ -0,0 +1,88 @@ +//! \file examples/Envelope_3/ex_envelope_triangles.cpp +// Constructing the lower and the upper envelope of a set of triangles. + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Gmpq Number_type; +typedef CGAL::Cartesian Kernel; +typedef CGAL::Env_triangle_traits_3 Traits_3; +typedef Kernel::Point_3 Point_3; +typedef Traits_3::Surface_3 Triangle_3; +typedef CGAL::Envelope_diagram_2 Envelope_diagram_2; + +/* Auxiliary function - print the faces of the given envelope diagram. */ +void print_diagram_faces (const Envelope_diagram_2& diag) +{ + // Go over all arrangement faces. + Envelope_diagram_2::Face_const_iterator fit; + Envelope_diagram_2::Ccb_halfedge_const_circulator ccb; + Envelope_diagram_2::Surface_const_iterator sit; + + for (fit = diag.faces_begin(); fit != diag.faces_end(); ++fit) + { + // Print the face boundary. + if (fit->is_unbounded()) + { + std::cout << "[Unbounded face]"; + } + else + { + // Print the vertices along the outer boundary of the face. + ccb = fit->outer_ccb(); + std::cout << '(' << ccb->source()->point() << ')'; + do + { + std::cout << " (" << ccb->target()->point() << ')'; + ++ccb; + } while (ccb != fit->outer_ccb()); + } + + // Print the triangles that induce the envelope on this face. + std::cout << " --> " << fit->number_of_surfaces() + << " triangles:" << std::endl; + + for (sit = fit->surfaces_begin(); sit != fit->surfaces_end(); ++sit) + std::cout << " " << *sit << std::endl; + } + + return; +} + +/* The main program: */ +int main () +{ + // Construct the input triangles. + std::list triangles; + + triangles.push_back (Triangle_3 (Point_3 (0, 0, 0), + Point_3 (0, 6, 0), + Point_3 (5, 3, 4))); + triangles.push_back (Triangle_3 (Point_3 (6, 0, 0), + Point_3 (6, 6, 0), + Point_3 (1, 3, 4))); + + // Compute and print the minimization diagram. + Envelope_diagram_2 min_diag; + + CGAL::lower_envelope_3 (triangles.begin(), triangles.end(), + min_diag); + + std::cout << std::endl << "The minimization diagram:" << std::endl; + print_diagram_faces (min_diag); + + // Compute and print the maximization diagram. + Envelope_diagram_2 max_diag; + + CGAL::upper_envelope_3 (triangles.begin(), triangles.end(), + max_diag); + + std::cout << std::endl << "The maximization diagram:" << std::endl; + print_diagram_faces (max_diag); + + return (0); +} diff --git a/Envelope_3/examples/Envelope_3/ex_spheres.cpp b/Envelope_3/examples/Envelope_3/ex_spheres.cpp deleted file mode 100644 index e1ce3366186..00000000000 --- a/Envelope_3/examples/Envelope_3/ex_spheres.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include - -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef Rat_kernel::Point_3 Rat_point_3; -typedef CGAL::Cartesian Alg_kernel; - -typedef CGAL::Arr_conic_traits_2 Traits_2; - -typedef CGAL::Envelope_spheres_traits_3 Traits; -typedef CGAL::Envelope_caching_traits_3 Traits_3; - -typedef Traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3; -typedef Traits_3::Curve_2 Arr_curve_2; -typedef Traits_3::Point_2 Arr_point_2; - -typedef CGAL::Envelope_pm_dcel Dcel; - -typedef CGAL::Arrangement_2 Arrangement_2; - -typedef CGAL::Envelope_divide_and_conquer_3 - Envelope_alg; - -using std::cout; -using std::endl; - -int main(int argc, char **argv) -{ - Traits_3 traits; - Envelope_alg envelope_algorithm(&traits); - std::vector surfaces; - - int spheres_num; - std::cin >> spheres_num; - Rat_point_3 a; - Rational sr; - for(int i=0; i> a >> sr; - Xy_monotone_surface_3 p_surface(a, sr); - surfaces.push_back(p_surface); - } - cout << "deal with " << surfaces.size() << " spheres" << endl; - - CGAL::Timer timer; - Arrangement_2 result(&traits); - timer.start(); - envelope_algorithm.construct_lu_envelope(surfaces.begin(), - surfaces.end(), result); - timer.stop(); - cout << "construct envelope took " << timer.time() << " seconds" << endl; - cout << "after lower envelope construction result has " << endl << - result.number_of_vertices() << " vertices" << endl << - result.number_of_edges() << " edges" << endl << - result.number_of_faces() << " faces" << endl; - - return 0; -} diff --git a/Envelope_3/examples/Envelope_3/ex_triangles.cpp b/Envelope_3/examples/Envelope_3/ex_triangles.cpp deleted file mode 100644 index 9cd5d4106e2..00000000000 --- a/Envelope_3/examples/Envelope_3/ex_triangles.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include - -#include -#include - - -#include -#include - -typedef CGAL::Gmpq NT; -typedef CGAL::Cartesian Kernel; -typedef Kernel::Point_3 Point_3; - -typedef CGAL::Envelope_triangles_traits_3 Traits_3; -typedef Traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3; -typedef CGAL::Envelope_diagram_2 Envelope_diagram_2; - -using std::cout; -using std::endl; - -int main(int argc, char **argv) -{ - std::vector triangles; - - int triangles_num; - std::cin >> triangles_num; - std::cout << "number of triangles to read: " << triangles_num << std::endl; - Point_3 a,b,c; - for(int i=0; i> a >> b >> c; - Xy_monotone_surface_3 p_triangle(a,b,c); - triangles.push_back(p_triangle); - } - cout << "deal with " << triangles.size() << " triangles" << endl; - - CGAL::Timer timer; - Envelope_diagram_2 result; - timer.start(); - CGAL::lower_envelope_3(triangles.begin(), triangles.end(), result); - timer.stop(); - cout << "construct envelope took " << timer.time() << " seconds" << endl; - - cout << "after lower envelope construction result has " << endl << - result.number_of_vertices() << " vertices" << endl << - result.number_of_halfedges() << " halfedges (" << - result.number_of_edges() << " edges)" << endl << - result.number_of_faces() << " faces" << endl; - - return 0; -} diff --git a/Envelope_3/examples/Envelope_3/make_xy_mon.cpp b/Envelope_3/examples/Envelope_3/make_xy_mon.cpp deleted file mode 100644 index 6929c1dab6d..00000000000 --- a/Envelope_3/examples/Envelope_3/make_xy_mon.cpp +++ /dev/null @@ -1,743 +0,0 @@ - -#include -#include -#include -#include -#include -#include - - - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - -////typedef double NT; -typedef CGAL::Quotient NT; -typedef CGAL::Simple_cartesian Kernel; -//typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -typedef Kernel::RT RT; -typedef Kernel::Point_3 Point_3; -typedef Kernel::Point_2 Point_2; -typedef Kernel::Plane_3 Plane_3; -typedef Kernel::Line_2 Line_2; -typedef Kernel::Segment_2 Segment_2; -typedef Kernel::Iso_rectangle_2 Iso_rectangle_2; - -typedef CGAL::Polyhedron_3 Polyhedron; -typedef Polyhedron::Halfedge_const_handle Halfedge_const_handle; -typedef Polyhedron::Facet_const_iterator Facet_const_iterator; -typedef Polyhedron::Halfedge_around_facet_const_circulator - Halfedge_around_facet_const_circulator; - -typedef Kernel::Oriented_side_2 Oriented_side_2; -typedef Kernel::Construct_line_2 Construct_line_2; -typedef Kernel::Construct_projected_xy_point_2 - Construct_projected_xy_point_2; -typedef Kernel::Construct_plane_3 Construct_plane_3; -typedef CGAL::Arr_segment_traits_2 Traits_2; -typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; -typedef CGAL::Arrangement_2 Arrangement_2; -typedef CGAL::Arr_accessor Arr_accessor; -typedef Arrangement_2::Vertex_handle Vertex_handle; -typedef Arrangement_2::Halfedge_handle Arr_halfedge; - -void my_failure_function (const char *type, - const char *expression, - const char *file, - int line, - const char *explanation) -{ - std::cout< XY_surfaces_list; - - std::queue m_queue; - CGAL::Unique_hash_map m_status_map; - CGAL::Unique_hash_map m_edges_map; - -public: - - void operator()(const Polyhedron& p, XY_surfaces_list& xy_surfaces) - { - m_status_map = - CGAL::Unique_hash_map(false, p.size_of_facets()); - - m_edges_map = CGAL::Unique_hash_map(Arr_halfedge()); - - for (Facet_const_iterator f = p.facets_begin(); f != p.facets_end(); ++f) - { - if (! m_status_map[f]) - bfs(f, xy_surfaces); - } - } - - void bfs(Facet_const_iterator f, XY_surfaces_list& xy_surfaces) - { - m_edges_map.clear(); // clear the previous data of the edges map - - m_status_map[f] = true; - if(is_vertical(f)) - return; - - bool is_back_face = is_back_facet(f); - //std::cout<<"bfs!!!\n"; - Arrangement_2* arr = new Arrangement_2; - xy_surfaces.push_back(arr); - m_queue.push(f); - while(!m_queue.empty()) - { - f = m_queue.front(); - m_queue.pop(); - - // add f to current xy_surface - bool _was_added = add_facet_to_arr(*arr, f, is_back_face); - if(!_was_added) - continue; - Halfedge_around_facet_const_circulator haf = f->facet_begin(); - Halfedge_around_facet_const_circulator curr = haf; - do - { - if(curr->opposite()->is_border()) - { - ++curr; - continue; - } - Facet_const_iterator neighbour_f = curr->opposite()->face(); - - bool& is_done = m_status_map[neighbour_f]; - if (!is_done) - { - if(is_vertical(neighbour_f)) - { - is_done = true; - } - else - if(are_xy_mon(curr)) - { - is_done = true; - m_queue.push(neighbour_f); - } - } - - ++curr; - } while(curr != haf); - } - } - - bool is_vertical(Facet_const_iterator f) - { - CGAL_assertion(f->facet_degree() > 2); - Halfedge_const_handle he = f->halfedge(); - const Point_3& p1 = he->vertex()->point(); - const Point_3& p2 = he->next()->vertex()->point(); - const Point_3& p3 = he->next()->next()->vertex()->point(); - Kernel k; - return (k.collinear_2_object()(project_xy(p1), - project_xy(p2), - project_xy(p3))); - } - bool are_xy_mon(Halfedge_const_handle he) - { - /* - * t - * *|* - * * | * - * * ^| * - * * || * - * p1 * he|| * p2 - * * f1|| f2 * - * * || * - * * | * - * * | * - * *|* - * s - */ - - CGAL_assertion(!is_vertical(he->face()) && - !is_vertical(he->opposite()->face())); - - const Point_2& p1 = project_xy(he->next()->vertex()->point()); - const Point_2& p2 = project_xy(he->opposite()->next()->vertex()->point()); - - Kernel k; - - CGAL_assertion(m_edges_map[he] != Arr_halfedge()); - const Line_2 & l = m_edges_map[he]->curve().line(); - - CGAL::Oriented_side os1 = k.oriented_side_2_object()(l, p1); - CGAL::Oriented_side os2 = k.oriented_side_2_object()(l, p2); - - CGAL_assertion(os1 != CGAL::ON_ORIENTED_BOUNDARY && - os2 != CGAL::ON_ORIENTED_BOUNDARY); - - return (os1 != os2); - } - - // when we add a new facet to the xy-surface, we have to check that the - // projected edges of the faces doesn't intersect the projected boundary - // of the xy-surface (just cheking adjacent facet is not good enough) - // Halfedge_const_handle he : shared halfegde between the current - // xy-monotone surface and facet f, such that, he->opposite()->face() == f - bool does_projected_facet_intersect_boundary(Facet_const_iterator f, - bool is_back_face) - { - //std::cout<<"does_projected_facet_intersect_boundary ...\n"; - t_boundary.start(); - // find that shared halfedge - Halfedge_const_handle he; - Arr_halfedge arr_he; - Halfedge_around_facet_const_circulator haf = f->facet_begin(); - Halfedge_around_facet_const_circulator curr = haf; - do - { - if((arr_he = m_edges_map[curr->opposite()]) != Arr_halfedge()) - { - he = curr->opposite(); - break; - } - curr++; - }while(curr != haf); - - if(arr_he == Arr_halfedge()) - { - // when we add he first facet of the xy-monotone surface, thare aren't - // any arrangement edges we dont need to check for intersection - // with the boundary. - t_boundary.stop(); - return false; - } - - if(is_back_face) - arr_he = arr_he->twin(); - - CGAL_assertion(he->opposite()->face() == f); - CGAL_assertion(! arr_he->twin()->face()->is_unbounded()); - - Arr_halfedge curr_he; - - Halfedge_const_handle shared_he = he->opposite(); - Halfedge_const_handle curr_facet_he; - - Kernel k; - - /*int c =0; - for(curr_he = arr_he->next(); curr_he!=arr_he; curr_he=curr_he->next(), c++) - ; - std::cout<<"There are : " << c << " edges at the boundary\n";*/ - for(curr_he = arr_he->next(); curr_he!=arr_he; curr_he=curr_he->next()) - { - for(curr_facet_he = shared_he->next(); curr_facet_he!=shared_he; curr_facet_he=curr_facet_he->next()) - { - if(m_edges_map[curr_facet_he->opposite()] != Arr_halfedge()) - continue; - - bool _cont = false; - Halfedge_const_handle hh = curr_facet_he; - do - { - Arr_halfedge temp_he = m_edges_map[hh]; - if(temp_he == Arr_halfedge()) - { - temp_he = m_edges_map[hh->opposite()]; - if(temp_he != Arr_halfedge()) - temp_he = temp_he->twin(); - else - { - hh = hh->next()->opposite(); - continue; - } - } - if(temp_he->target() == curr_he->source() || - temp_he->target() == curr_he->target()) - { - //std::cout<<"_cont(1) !!!\n"; - _cont = true; - break; - } - hh = hh->next()->opposite(); - }while(hh != curr_facet_he); - - if(_cont) - continue; - - //_cont = false; - Halfedge_const_handle opp_curr_facet_he = curr_facet_he->opposite(); - hh = opp_curr_facet_he; - do - { - Arr_halfedge temp_he = m_edges_map[hh]; - if(temp_he == Arr_halfedge()) - { - temp_he = m_edges_map[hh->opposite()]; - if(temp_he != Arr_halfedge()) - temp_he = temp_he->twin(); - else - { - hh = hh->next()->opposite(); - continue; - } - } - if(temp_he->target() == curr_he->source() || - temp_he->target() == curr_he->target()) - { - //std::cout<<"_cont(1) !!!\n"; - _cont = true; - break; - } - hh = hh->next()->opposite(); - }while(hh != opp_curr_facet_he); - - if(_cont) - continue; - - Segment_2 seg(project_xy(curr_facet_he->opposite()->vertex()->point()), - project_xy(curr_facet_he->vertex()->point())); - t_do_x.start(); - bool do_x = k.do_intersect_2_object()(static_cast(curr_he->curve()), seg); - t_do_x.stop(); - if(do_x) - { - /*Halfedge_around_facet_const_circulator haf = f->facet_begin(); - Halfedge_around_facet_const_circulator curr = haf; - do - { - std::cout<< curr->opposite()->vertex()->point() <<" --> " << curr->vertex()->point()<<"\n"; - curr++; - }while(curr != haf); - - std::ofstream file("boundary.arr"); - if(!file.is_open()) - { - std::cout<<"failed to open file!!!\n"; - abort(); - } - Arr_halfedge hh = arr_he; - do - { - file << hh->curve() << std::endl; - hh = hh->next(); - }while(hh!=arr_he); - std::cout<<"bug: " << curr_facet_he->opposite()->vertex()->point() <<" --> " << curr_facet_he->vertex()->point()<<"\n"; - std::cout<<"bug2: " << curr_he->curve() << "\n"; - std::cout<<"is_back_facet? " << is_back_facet(f)<<"\n"; - t_boundary.stop(); - std::cout<<"return (true)\n";*/ - t_boundary.stop(); - return true; - } - } - } - - - t_boundary.stop(); - return false; - } - - /*Iso_rectangle_2 construct_iso_rectangle_from_facet(Halfedge_const_handle he) - { - Kernel k; - - Halfedge_const_handle curr_facet_he = he; - Point_2 left, right, bottom, top; - - left = right = bottom = top = curr_facet_he->target()->point(); - curr_facet_he = curr_facet_he->next(); - do - { - const Point_2& pt = curr_facet_he->target()->point(); - if(k.compare_x_2_object(pt, left) == CGAL::SMALLER) - left = pt; - else - if(k.compare_x_2_object(pt, right) == CGAL::LARGER) - right = pt; - - if(k.compare_y_2_object(pt, bottom) == CGAL::SMALLER) - bottom = pt; - else - if(k.compare_y_2_object(pt, top) == CGAL::LARGER) - top = pt; - - curr_facet_he = curr_facet_he->next(); - }while(curr_facet_he != he); - - - return (Iso_rectangle_2 rect(left, right, bottom, top)); - }*/ - /*Point_2 project_xy (const Point_3& p) - { - Kernel k; - Plane_3 xy_plane = k.construct_plane_3_object()(RT(0), RT(0), RT(1), RT(0)); - return (k.construct_projected_xy_point_2_object()(xy_plane, p)); - }*/ - - Point_2 project_xy (const Point_3& p) - { - return (Point_2(p.x(), p.y())); - } - - bool is_back_facet(Facet_const_iterator f) - { - Kernel k; - Plane_3 supp_plane = - k.construct_plane_3_object()(f->halfedge()->vertex()->point(), - f->halfedge()->next()->vertex()->point(), - f->halfedge()->next()->next()->vertex()->point()); - - return (supp_plane.c() > 0); - } - - bool add_facet_to_arr(Arrangement_2& arr, Facet_const_iterator f, bool is_back) - { - //std::cout<<"add_facet_to_arr!!!\n"; - if(does_projected_facet_intersect_boundary(f, is_back)) - { - //std::cout<<"found intersection of current facet with boundary!!!\n"; - m_status_map[f] = false; - return false; - } - //static int i=1; - Halfedge_around_facet_const_circulator haf = f->facet_begin(); - Halfedge_around_facet_const_circulator curr = haf; - do - { - std::cout<< curr->opposite()->vertex()->point() <<" --> " << curr->vertex()->point()<<"\n"; - curr++; - }while(curr != haf); - std::cout<<"*******************************\n"; - - haf = f->facet_begin(); - curr = haf; - - do - { - Halfedge_const_handle he = curr; - - /*std::cout<<"current polyhedron edge: " << he->opposite()->vertex()->point() <<" --> " << curr->vertex()->point()<<"\n"; - std::cout<<"is_back? : " << is_back << "\n";*/ - // look for that polyhedron's halfedge at the edges map - Arr_halfedge arr_he = m_edges_map[he->opposite()]; - CGAL_assertion(m_edges_map[he] == Arr_halfedge()); - Arr_halfedge prev_he; - - if(arr_he == Arr_halfedge()) - { - // this edge was not inserted to the arrangement yet - - const Point_2& s = project_xy(curr->opposite()->vertex()->point()); - const Point_2& t = project_xy(curr->vertex()->point()); - - X_monotone_curve_2 cv(s, t); - - Arr_halfedge next_he = find_halfedge_before_cw(he, is_back); - if(prev_he == Arr_halfedge()) - prev_he = find_halfedge_before_cw(he->opposite(), is_back); - - bool next_exist = (next_he!=Arr_halfedge()); - bool prev_exist = (prev_he!=Arr_halfedge()); - - //CGAL::Comparison_result res = k.compare_xy_2_object()(s, t); - CGAL::Comparison_result res = cv.is_directed_right() ? CGAL::SMALLER : CGAL::LARGER; - - if(!next_exist && !prev_exist) - { - Arr_accessor arr_accessor(arr); - Vertex_handle v1 = arr_accessor.create_vertex(s); - Vertex_handle v2 = arr_accessor.create_vertex(t); - prev_he = - arr_accessor.insert_in_face_interior_ex(cv, - arr.unbounded_face(), - v1, v2, res); - - //std::cout<<"("<direction() != res) - prev_he = prev_he->twin(); - } - else - if(!next_exist && prev_exist) - { - if(res == CGAL::SMALLER) - { - //std::cout<<"("<direction() != res) - prev_he = prev_he->twin(); - } - else - { - //std::cout<<"("<direction() != res) - prev_he = prev_he->twin(); - } - } - else - if(next_exist && !prev_exist) - { - if(res == CGAL::SMALLER) - { - //std::cout<<"("<direction() != res) - prev_he = prev_he->twin(); - } - else - { - //std::cout<<"("<direction() != res) - prev_he = prev_he->twin(); - } - } - else - { - /*std::cout<<"("<source()->point()<<" --> "<< prev_he->target()->point()<<"\n"; - std::cout<<"next_he: " <source()->point()<<" --> "<< next_he->target()->point()<<"\n";*/ - //TODO: can be done much more efficient using the Arr_accessor !! - bool new_face = false; - Arr_accessor arr_accessor(arr); - if(is_back && !is_opp_face_get_closed(he) || !is_back && is_opp_face_get_closed(he)) - prev_he = arr_accessor.insert_at_vertices_ex(cv, prev_he, next_he, res, new_face); - /*if(is_back && is_curr_facet_get_closed(he) || !is_back && !is_curr_facet_get_closed(he)) - prev_he = arr_accessor.insert_at_vertices_ex(cv, prev_he, next_he, res, new_face);*/ - else - { - if(res == CGAL::SMALLER) - prev_he = arr_accessor.insert_at_vertices_ex(cv, next_he, prev_he, CGAL::LARGER, new_face); - else - prev_he = arr_accessor.insert_at_vertices_ex(cv, next_he, prev_he, CGAL::SMALLER, new_face); - } - if(prev_he->direction() != res) - prev_he = prev_he->twin(); - /*prev_he = arr.insert_at_vertices(cv, prev_he, next_he); - if(prev_he->direction() != res) - prev_he = prev_he->twin();*/ - } - //map 'he' of the polyhderon to 'prev_he' - - std::ofstream arr_file("temp.arr"); - if(!arr_file.is_open()) - { - std::cout<<"cannot open file !!!\n"; - exit(-1); - } - arr_file << arr; - if(!CGAL::is_valid(arr)) - abort(); - m_edges_map[he] = prev_he; - } - else - { - prev_he = arr_he->twin(); - } - - CGAL_assertion(prev_he->source()->point() == - project_xy(he->opposite()->vertex()->point())); - CGAL_assertion(prev_he->target()->point() == - project_xy(he->vertex()->point())); - - - ++curr; - } while(curr != haf); - - return true; - } - - bool is_opp_face_get_closed(Halfedge_const_handle he) - { - Halfedge_const_handle first = he->opposite(); - for(first = first->next(); first != he->opposite(); first = first->next()) - { - if(m_edges_map[first->opposite()] == Arr_halfedge()) - return false; - } - return true; - } - - bool is_curr_facet_get_closed(Halfedge_const_handle he) - { - Halfedge_const_handle first = he->next(); - for(; first != he; first = first->next()) - { - if(m_edges_map[first] == Arr_halfedge() || - m_edges_map[first->opposite()] == Arr_halfedge()) - return false; - } - return true; - - } - - Arr_halfedge find_halfedge_before_cw(Halfedge_const_handle he, bool is_back_face) - { - // iterate the halfedges around the target vertex of 'he' counter-clockwise - // and find the first halfedge that was inserterd to the arrangement. - Halfedge_const_handle curr; - if(is_back_face) - curr = he->prev_on_vertex(); - else - curr = he->next_on_vertex(); - do - { - Arr_halfedge res = m_edges_map[curr]; - if(res != Arr_halfedge()) - return res; - - res = m_edges_map[curr->opposite()]; - if(res != Arr_halfedge()) - return res->twin(); - - if(is_back_face) - curr = curr->prev_on_vertex(); - else - curr = curr->next_on_vertex(); - } while(curr != he); - - return Arr_halfedge(); - } - -}; - -Point_2 project_xy (const Point_3& p) -{ - return (Point_2(p.x(), p.y())); -} - -bool test_xy_mon(std::vector& surf) -{ - CGAL::Unique_hash_map edges_hash(false); - typedef CGAL::Arr_segment_traits_2 Traits; - typedef Traits::Curve_2 Curve_2; - std::list curves; - for(unsigned int i=0; i< surf.size(); ++i) - { - Facet_const_iterator curr_f = surf[i]; - Halfedge_around_facet_const_circulator haf = curr_f->facet_begin(); - Halfedge_around_facet_const_circulator curr = haf; - do - { - Halfedge_const_handle he = curr; - if(!edges_hash[he] && !edges_hash[he->opposite()]) - { - Curve_2 cv(project_xy(he->vertex()->point()), - project_xy(he->opposite()->vertex()->point())); - curves.push_back(cv); - edges_hash[he] = edges_hash[he->opposite()] = true; - } - - ++curr; - }while(curr != haf); - } - - bool do_x = CGAL::do_curves_intersect(curves.begin(), curves.end()); - return (!do_x); -} -int main(int argc, char** argv) -{ - CGAL::set_warning_handler(my_failure_function); - //CGAL::set_error_behaviour (CGAL::CONTINUE); - - if(argc<2) - { - std::cout<<"Missing off file\n"; - return (-1); - } - - std::ifstream off_file(argv[1]); - if(!off_file.is_open()) - { - std::cout<<"Failed to open file\n"; - return (-1); - } - - CGAL::Timer t; - Polyhedron p; - //off_file >> p; - // reads a polyhedron from `in' and appends it to P. - t.start(); - CGAL::scan_OFF(off_file, p, true); - t.stop(); - - if ( (off_file.rdstate() & std::ios::badbit ) != 0 ) - std::cerr << "Error opening "< +#endif + CGAL_BEGIN_NAMESPACE template class Env_triangle_3; diff --git a/Envelope_3/test/Envelope_3/Env_overlay_2.h b/Envelope_3/include/CGAL/Envelope_3/Env_overlay_2.h similarity index 81% rename from Envelope_3/test/Envelope_3/Env_overlay_2.h rename to Envelope_3/include/CGAL/Envelope_3/Env_overlay_2.h index e9f28dab5d4..fe729548d42 100644 --- a/Envelope_3/test/Envelope_3/Env_overlay_2.h +++ b/Envelope_3/include/CGAL/Envelope_3/Env_overlay_2.h @@ -21,12 +21,10 @@ #define ENVELOPE_OVERLAY_2_H #include -#include +#include #include -//#define CGAL_DEBUG_ENVELOPE_OVERLAY_2 - CGAL_BEGIN_NAMESPACE template curve() << endl; - cout << "In overlay: print isolated vertices of md1" << endl; - for(Vertex_iterator vi = md1.vertices_begin(); - vi != md1.vertices_end(); ++vi) - if (vi->is_isolated()) - cout << vi->point() << endl; - cout << "In overlay: print edges of md2" << endl; - for(Halfedge_iterator hi = md2.halfedges_begin(); - hi != md2.halfedges_end(); ++hi, ++hi) - cout << hi->curve() << endl; - cout << "In overlay: print isolated vertices of md2" << endl; - for(Vertex_iterator vi = md2.vertices_begin(); - vi != md2.vertices_end(); ++vi) - if (vi->is_isolated()) - cout << vi->point() << endl; - cout << "In overlay: print faces of md1" << endl; - print_faces(md1); - cout << "In overlay: print faces of md2" << endl; - print_faces(md2); - - #endif - Overlay_functor overlay_func(md1, md2, result); overlay(md1, md2, result, overlay_func); - - #ifdef CGAL_DEBUG_ENVELOPE_OVERLAY_2 - cout << endl; - cout << "In overlay: print faces at the end" << endl; - print_faces(result); - #endif - - #ifdef CGAL_DEBUG_ENVELOPE_OVERLAY_2 - cout << "In overlay: print vertices at the end" << endl; - print_vertices(result); - - cout << "In overlay: print edges at the end" << endl; - print_edges(result); - #endif - + post_test_assertions(result); } public: + + /* void print_face(Face_handle fh) { std::cout << (fh->is_unbounded() ? "unbounded" : "bounded"); @@ -207,6 +167,7 @@ public: } std::cout << std::endl; } + */ void post_test_assertions(Minimization_diagram_2& md) { diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h index 6f0a866c432..03f6c92f4a2 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_divide_and_conquer_3.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h b/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h index 8dd3a231c70..bf36495e132 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h +++ b/Envelope_3/include/CGAL/Envelope_3/Envelope_pm_dcel.h @@ -82,7 +82,23 @@ public: { m_decision = dec; } - + + /*! User-friendly interface: */ + size_t number_of_surfaces () const + { + return (m_data.size()); + } + + Data_const_iterator surfaces_begin () const + { + return (m_data.begin()); + } + + Data_const_iterator surfaces_end () const + { + return (m_data.end()); + } + /*! * Get the number of data objects associated with the face. */ diff --git a/Envelope_3/include/CGAL/Envelope_3/Partial_vd_visitor.h b/Envelope_3/include/CGAL/Envelope_3/Partial_vd_visitor.h index e8e29b9eca6..3268596eecf 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Partial_vd_visitor.h +++ b/Envelope_3/include/CGAL/Envelope_3/Partial_vd_visitor.h @@ -24,9 +24,6 @@ #include #include -#include - - CGAL_BEGIN_NAMESPACE template< class Traits_, class Arrangement_, class OutputIterator> @@ -66,9 +63,6 @@ public: //(above_on_event is true iff 'above' subcurve is on the event bool after_handle_event(Event* event, SL_iterator above, bool above_on_event) { - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "in after_handle_event " << event->get_point() << std::endl; - #endif // we should never have above_on_event = true since we sweep an existing // arrangement CGAL_assertion(!above_on_event); @@ -105,20 +99,11 @@ public: { // should change the previous pair - is sees the current event point // instead of the previous above curve - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "found a point pair: " << m_last_event->get_point() - << " and " << event->get_point() << std::endl; - #endif Vertex_const_handle pvh = m_last_event->get_point().get_vertex_handle(); if (event_should_shoot_down || m_last_should_shoot_up) - *m_out++ = std::make_pair(CGAL::make_object(pvh), CGAL::make_object(vh)); - else - { - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "point pair doesn't follow partial vd rules" - << std::endl; - #endif - } + *m_out++ = std::make_pair(CGAL::make_object(pvh), + CGAL::make_object(vh)); + previous_event_see_current = true; } else @@ -126,23 +111,13 @@ public: // keep the previous pair, if existed if (m_last_above != NULL) { - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "found a pair: " << m_last_event->get_point() - << " and " << m_last_above->get_last_curve() << std::endl; - #endif Halfedge_const_handle phe = m_last_above->get_last_curve().get_halfedge_handle(); Vertex_const_handle pvh = m_last_event->get_point().get_vertex_handle(); CGAL_assertion(m_arr.get_traits()->equal_2_object()(m_last_event->get_point(), pvh->point())); if (m_last_should_shoot_up) - *m_out++ = std::make_pair(CGAL::make_object(pvh), CGAL::make_object(phe)); - else - { - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "pair doesn't follow partial vd rules" - << std::endl; - #endif - } + *m_out++ = std::make_pair(CGAL::make_object(pvh), + CGAL::make_object(phe)); } } } @@ -182,10 +157,6 @@ public: // the status line // it is also not an endpoint, since in this case, we would have // previous_event_see_current = true - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "found a pair: " << event->get_point() - << " and " << (*below)->get_last_curve() << std::endl; - #endif CGAL_assertion(m_arr.get_traits()->equal_2_object()(event->get_point(), vh->point())); @@ -199,13 +170,6 @@ public: Halfedge_const_handle he = (*below)->get_last_curve().get_halfedge_handle(); if (event_should_shoot_down) *m_out++ = std::make_pair(CGAL::make_object(vh), CGAL::make_object(he)); - else - { - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "pair doesn't follow partial vd rules" - << std::endl; - #endif - } } } } diff --git a/Envelope_3/include/CGAL/Envelope_3/Partial_vertical_decomposition_2.h b/Envelope_3/include/CGAL/Envelope_3/Partial_vertical_decomposition_2.h index af5332712b7..583bc05b15e 100644 --- a/Envelope_3/include/CGAL/Envelope_3/Partial_vertical_decomposition_2.h +++ b/Envelope_3/include/CGAL/Envelope_3/Partial_vertical_decomposition_2.h @@ -20,15 +20,12 @@ #ifndef CGAL_PARTIAL_VERTICAL_DECOMPOSITION_2_H #define CGAL_PARTIAL_VERTICAL_DECOMPOSITION_2_H -//#define CGAL_DEBUG_PARTIAL_VD - #include #include #include -#include -#include +#include +#include #include -#include #include #include @@ -84,19 +81,7 @@ public: // Do a partial vertical decomposition on existing arrangement "arr" void operator()(Arrangement& arr) - { - #ifdef CGAL_DEBUG_PARTIAL_VD - cout << "before partial vd: print edges of arr" << endl; - for(Halfedge_const_iterator hi = arr.halfedges_begin(); - hi != arr.halfedges_end(); ++hi, ++hi) - cout << hi->curve() << endl; - cout << "before partial vd: print isolated vertices of arr" << endl; - for(Vertex_const_iterator vi = arr.vertices_begin(); - vi != arr.vertices_end(); ++vi) - if (vi->is_isolated()) - cout << vi->point() << endl; - #endif - + { // Go over all arrangement edges. std::vector xcurves_vec; xcurves_vec.resize(arr.number_of_edges()); @@ -131,22 +116,14 @@ public: Visitor visitor (arr, std::back_inserter(vd_pairs)); Sweep_line sweep_line (&visitor); - sweep_timer.start(); sweep_line.sweep(xcurves_vec.begin(), xcurves_vec.end(), iso_points.begin(), iso_points.end()); - sweep_timer.stop(); - add_timer.start(); _add_vertical_edges(arr, vd_pairs); - add_timer.stop(); - - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "finish partial vd" << std::endl; - print_times(); - #endif } + protected: // add the vertical edges (that were determined by the sweep) to the // arrangement @@ -184,20 +161,10 @@ protected: { if (should_add_vertical_edge(arr.non_const_handle(v1), arr.non_const_handle(v2))) { - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "got vertex-vertex pair: " << v1->point() - << " and " << v2->point() << std::endl; - #endif - insert_timer.start(); - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "before insert at vertices: " << v1->point() << " , " - << v2->point() << std::endl; - #endif arr.insert_at_vertices( arr.get_traits()->construct_vertical_2_object()(v1->point(), v2->point()), arr.non_const_handle(v1), arr.non_const_handle(v2)); - insert_timer.stop(); } continue; } @@ -223,10 +190,6 @@ protected: if (!should_add_vertical_edge(v, orig_split_he)) continue; - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "got vertex-halfedge pair: " << v->point() - << " and " << orig_split_he->curve() << std::endl; - #endif // split split_he and connect the split point with v if (map_orig_to_rightmost.is_defined(orig_split_he)) // we should split the rightmost halfedge instead @@ -247,10 +210,6 @@ protected: split_p = arr.get_traits()->vertical_ray_shoot_2 (v->point(), split_he->curve()); Base_X_monotone_curve_2 a,b; - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "before edge_split, curve=" << split_he->curve() - << std::endl << " point= " << split_p << std::endl; - #endif arr.get_traits()->split_2_object()(split_he->curve(), split_p, a, b); split_he = arr.split_edge(split_he, a, b); // split always returns the halfedge with source = original source @@ -265,17 +224,10 @@ protected: prev_split_v = split_v; // insert the vertical edge - insert_timer.start(); - #ifdef CGAL_DEBUG_PARTIAL_VD - std::cout << "before insert at vertices: " << v->point() << " , " - << split_p << std::endl; - #endif arr.insert_at_vertices( arr.get_traits()->construct_vertical_2_object()(v->point(), split_p), v, split_v); - insert_timer.stop(); -// insert_x_monotone(arr, Base_X_monotone_curve_2(v->point(), split_p)); } vd_pairs.clear(); } @@ -283,25 +235,12 @@ protected: bool should_add_vertical_edge(Vertex_handle v1, Vertex_handle v2) { return true; -// return (!v1->get_is_intersection() || !v2->get_is_intersection()); } + bool should_add_vertical_edge(Vertex_handle v, Halfedge_handle he) { return true; -// return (!v->get_is_intersection()); } - void print_times() - { - std::cout << "Partial vd times: " << std::endl; - std::cout << "sweep: " << sweep_timer.time() << " seconds" << std::endl; - std::cout << "add vertical edges: " << add_timer.time() << " seconds" << std::endl; - std::cout << "insert edges: " << insert_timer.time() << " seconds" << std::endl; - } - -protected: - mutable Timer sweep_timer; - mutable Timer add_timer; - mutable Timer insert_timer; }; diff --git a/Envelope_3/include/CGAL/envelope_3.h b/Envelope_3/include/CGAL/envelope_3.h index 88c6de8943f..c6386004f46 100644 --- a/Envelope_3/include/CGAL/envelope_3.h +++ b/Envelope_3/include/CGAL/envelope_3.h @@ -37,16 +37,22 @@ template class Envelope_diagram_2 : typename Envelope_caching_traits_3::Xy_monotone_surface_3> > { public: - typedef Traits_ Traits_3; + typedef Traits_ Traits_3; protected: - typedef Envelope_caching_traits_3 Cache_traits_3; + typedef Envelope_caching_traits_3 Cache_traits_3; public: typedef typename Cache_traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3; - typedef Arrangement_2 > Base; + +protected: + typedef Envelope_pm_dcel Env_dcel; + +public: + typedef Envelope_diagram_2 Self; + typedef Arrangement_2 Base; + typedef typename Env_dcel::Dcel_data_const_iterator Surface_const_iterator; /*! Default constructor. */ Envelope_diagram_2() : @@ -69,15 +75,15 @@ public: */ template void lower_envelope_3 (InputIterator begin, InputIterator end, - Envelope_diagram_2& min_diagram) + Envelope_diagram_2& min_diagram) { typedef Traits Traits_3; - typedef Envelope_caching_traits_3 Cache_Traits_3; + typedef Envelope_caching_traits_3 Cache_traits_3; typedef typename Envelope_diagram_2::Base Base_arr_2; typedef Envelope_divide_and_conquer_3 Envelope_algorithm; - Traits_3 *traits = min_diagram->get_traits(); + Cache_traits_3 *traits = min_diagram.get_traits(); traits->set_lower(); Envelope_algorithm env_alg (traits); @@ -94,17 +100,17 @@ void lower_envelope_3 (InputIterator begin, InputIterator end, * \param max_diag Output: The maximization diagram. * \pre The value-type of InputIterator is Traits::Surface_3. */ -template +template void upper_envelope_3 (InputIterator begin, InputIterator end, - Envelope_diagram_2& max_diagram) + Envelope_diagram_2& max_diagram) { typedef Traits Traits_3; - typedef Envelope_caching_traits_3 Cache_Traits_3; + typedef Envelope_caching_traits_3 Cache_traits_3; typedef typename Envelope_diagram_2::Base Base_arr_2; typedef Envelope_divide_and_conquer_3 Envelope_algorithm; - Traits_3 *traits = max_diagram->get_traits(); + Cache_traits_3 *traits = max_diagram.get_traits(); traits->set_upper(); Envelope_algorithm env_alg (traits);