Fixed all include files and updated the examples.

This commit is contained in:
Ron Wein 2006-08-01 12:48:10 +00:00
parent dbccc9c582
commit c8b9eb5893
20 changed files with 1531 additions and 1038 deletions

7
.gitattributes vendored
View File

@ -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.gif -text svneol=unset#image/gif
Developers_manual/doc_tex/Developers_manual/fig/use_real.pdf -text svneol=unset#application/pdf 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_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/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.gif -text svneol=unset#image/gif
Generator/doc_tex/Generator/Segment_generator_prog1.pdf -text svneol=unset#application/pdf Generator/doc_tex/Generator/Segment_generator_prog1.pdf -text svneol=unset#application/pdf

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <CGAL/basic.h>
#ifndef CGAL_USE_CORE
#include <iostream>
int main ()
{
std::cout << "Sorry, this example needs CORE ..." << std::endl;
return (0);
}
#else
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Env_sphere_traits_3.h>
#include <CGAL/envelope_3.h>
#include <CGAL/Timer.h>
#include <iostream>
#include <list>
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
typedef Nt_traits::Rational Rational;
typedef Nt_traits::Algebraic Algebraic;
typedef CGAL::Cartesian<Rational> Rat_kernel;
typedef Rat_kernel::Point_3 Rat_point_3;
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef CGAL::Arr_conic_traits_2<Rat_kernel,
Alg_kernel,
Nt_traits> Conic_traits_2;
typedef CGAL::Env_sphere_traits_3<Conic_traits_2> Traits_3;
typedef Traits_3::Surface_3 Sphere_3;
typedef CGAL::Envelope_diagram_2<Traits_3> 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):
// <n> // number of spheres.
// <x_1> <y_1> <x_1> <R_1> // center and squared radious of sphere #1.
// <x_2> <y_2> <x_2> <R_2> // center and squared radious of sphere #2.
// : : : :
// <x_n> <y_n> <x_n> <R_n> // center and squared radious of sphere #n.
int n;
std::list<Sphere_3> 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

View File

@ -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 <CGAL/Gmpq.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Env_triangle_traits_3.h>
#include <CGAL/envelope_3.h>
#include <iostream>
#include <list>
typedef CGAL::Gmpq Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Env_triangle_traits_3<Kernel> Traits_3;
typedef Kernel::Point_3 Point_3;
typedef Traits_3::Surface_3 Triangle_3;
typedef CGAL::Envelope_diagram_2<Traits_3> 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<Triangle_3> 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);
}

View File

@ -1,77 +0,0 @@
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Timer.h>
#include <CGAL/Envelope_divide_and_conquer_3.h>
#include <CGAL/Envelope_spheres_traits_3.h>
#include <CGAL/Envelope_pm_dcel.h>
#include <CGAL/Envelope_caching_traits_3.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Overlay_2.h>
#include <iostream>
#include <vector>
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
typedef Nt_traits::Rational Rational;
typedef Nt_traits::Algebraic Algebraic;
typedef CGAL::Cartesian<Rational> Rat_kernel;
typedef Rat_kernel::Point_3 Rat_point_3;
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef CGAL::Arr_conic_traits_2<Rat_kernel,
Alg_kernel,
Nt_traits> Traits_2;
typedef CGAL::Envelope_spheres_traits_3<Traits_2> Traits;
typedef CGAL::Envelope_caching_traits_3<Traits> 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<Traits_3, Xy_monotone_surface_3> Dcel;
typedef CGAL::Arrangement_2<Traits_3, Dcel> Arrangement_2;
typedef CGAL::Envelope_divide_and_conquer_3<Traits_3, Arrangement_2>
Envelope_alg;
using std::cout;
using std::endl;
int main(int argc, char **argv)
{
Traits_3 traits;
Envelope_alg envelope_algorithm(&traits);
std::vector<Xy_monotone_surface_3> surfaces;
int spheres_num;
std::cin >> spheres_num;
Rat_point_3 a;
Rational sr;
for(int i=0; i<spheres_num; ++i)
{
std::cin >> 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;
}

View File

@ -1,53 +0,0 @@
#include <CGAL/Cartesian.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Timer.h>
#include <CGAL/envelope_3.h>
#include <CGAL/Envelope_triangles_traits_3.h>
#include <iostream>
#include <vector>
typedef CGAL::Gmpq NT;
typedef CGAL::Cartesian<NT> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Envelope_triangles_traits_3<Kernel> Traits_3;
typedef Traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3;
typedef CGAL::Envelope_diagram_2<Traits_3> Envelope_diagram_2;
using std::cout;
using std::endl;
int main(int argc, char **argv)
{
std::vector<Xy_monotone_surface_3> 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<triangles_num; ++i)
{
std::cin >> 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;
}

View File

@ -1,743 +0,0 @@
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <limits>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <queue>
#include <list>
#include <vector>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Sweep_line_2_algorithms.h>
#include <CGAL/Timer.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arr_accessor.h>
#include <CGAL/IO/Arr_iostream.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
////typedef double NT;
typedef CGAL::Quotient<CGAL::MP_Float> NT;
typedef CGAL::Simple_cartesian<NT> 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<Kernel> 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<Kernel> Traits_2;
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
typedef CGAL::Arr_accessor<Arrangement_2> 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<<explanation<<"\n";
}
CGAL::Timer t_boundary;
CGAL::Timer t_do_x;
class Make_xy_monotone
{
protected:
typedef std::list<Arrangement_2*> XY_surfaces_list;
std::queue<Facet_const_iterator> m_queue;
CGAL::Unique_hash_map<Facet_const_iterator, bool> m_status_map;
CGAL::Unique_hash_map<Halfedge_const_handle, Arr_halfedge> m_edges_map;
public:
void operator()(const Polyhedron& p, XY_surfaces_list& xy_surfaces)
{
m_status_map =
CGAL::Unique_hash_map<Facet_const_iterator, bool>(false, p.size_of_facets());
m_edges_map = CGAL::Unique_hash_map<Halfedge_const_handle,
Arr_halfedge>(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<Segment_2>(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<<"("<<i++<<")"<<"insert_in_face_interior: " << cv<<"\n";
//prev_he = arr.insert_in_face_interior(cv, arr.unbounded_face());
if(prev_he->direction() != res)
prev_he = prev_he->twin();
}
else
if(!next_exist && prev_exist)
{
if(res == CGAL::SMALLER)
{
//std::cout<<"("<<i++<<")"<<"insert_from_left_vertex: " << cv<<"\n";
prev_he = arr.insert_from_left_vertex(cv, prev_he);
if(prev_he->direction() != res)
prev_he = prev_he->twin();
}
else
{
//std::cout<<"("<<i++<<")"<<"insert_from_right_vertex: " << cv<<"\n";
prev_he = arr.insert_from_right_vertex(cv, prev_he);
if(prev_he->direction() != res)
prev_he = prev_he->twin();
}
}
else
if(next_exist && !prev_exist)
{
if(res == CGAL::SMALLER)
{
//std::cout<<"("<<i++<<")"<<"insert_from_right_vertex: " << cv<<"\n";
prev_he = arr.insert_from_right_vertex(cv, next_he);
if(prev_he->direction() != res)
prev_he = prev_he->twin();
}
else
{
//std::cout<<"("<<i++<<")"<<"insert_from_left_vertex: " << cv<<"\n";
prev_he = arr.insert_from_left_vertex(cv, next_he);
if(prev_he->direction() != res)
prev_he = prev_he->twin();
}
}
else
{
/*std::cout<<"("<<i++<<")"<<"insert_at_vertices: " << cv<<"\n";
std::cout<<"prev_he: " <<prev_he->source()->point()<<" --> "<< prev_he->target()->point()<<"\n";
std::cout<<"next_he: " <<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<Facet_const_iterator>& surf)
{
CGAL::Unique_hash_map<Halfedge_const_handle, bool> edges_hash(false);
typedef CGAL::Arr_segment_traits_2<Kernel> Traits;
typedef Traits::Curve_2 Curve_2;
std::list<Curve_2> 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 "<<argv[1] <<"\n";
std::cout<<"Reading OFF file took: " <<t.time()<<" seconds\n";
t.reset();
if(p.empty())
return 0;
Facet_const_iterator f = p.facets_begin();
std::cout << "|V| = " <<p.size_of_vertices()<<std::endl;
std::cout << "|E| = " <<p.size_of_halfedges()<<std::endl;
std::cout << "|F| = " <<p.size_of_facets()<<std::endl;
std::list<Arrangement_2*> xy_surfs;
typedef std::list<Arrangement_2*>::iterator Xy_surf_itr;
Make_xy_monotone make_xy;
t.start();
make_xy(p, xy_surfs);
t.stop();
std::cout<<"Making the surface xy-monotone took: " <<t.time()<<" seconds\n";
std::cout<<"Intersecting with boundary took : " <<t_boundary.time()<<" seconds\n";
std::cout<<"do intersect took : " <<t_do_x.time()<<" seconds\n";
std::cout<<"There are: " << xy_surfs.size() << " xy-surfaces\n";
unsigned int i=1;
for(Xy_surf_itr itr = xy_surfs.begin(); itr != xy_surfs.end(); ++itr, ++i)
{
std::cout<<"#" <<i<<" surface : "<<std::endl;
std::cout<<" |V| = "<<(*itr)->number_of_vertices()<<std::endl;
std::cout<<" |E| = "<<(*itr)->number_of_edges()<<std::endl;
std::cout<<" |F| = "<<(*itr)->number_of_faces()<<std::endl;
std::cout<<"is_valid? " << CGAL::is_valid(**itr)<<std::endl;
if(i<10)
{
char buffer[33];
buffer[0] = '1' + i-1;
buffer[1] = '\0';
std::string prog_name (argv[1]);
std::string filename("surface");
std::string prefix (buffer);
std::string temp(".arr");
prefix += temp;
filename += prefix;
std::cout << filename<<"\n";
std::ofstream arr_file(filename.c_str());
if(!arr_file.is_open())
std::cout<<"Failed to open: " << filename<<"\n";
arr_file << **itr;
}
}
return (0);
}

View File

@ -0,0 +1,101 @@
100
761 -584 331 12321
526 -634 133 24964
-170 68 -345 28224
77 862 -811 23409
-790 222 -93 576
-228 263 -846 47961
458 -747 -520 31684
662 505 13 24964
88 -187 -698 11236
584 -350 899 1369
-999 981 628 25600
-634 114 389 8100
433 769 -83 32041
295 958 746 13924
-482 -135 -176 5776
781 17 32 43681
-965 497 803 55225
539 -489 261 256
-648 -187 -75 61504
1 -288 -986 7396
-16 -659 598 55225
-901 730 598 9604
868 -353 963 14641
826 -607 396 22801
-309 215 -307 33489
708 -751 210 53824
205 -948 -8 44521
716 313 25 28900
-471 -761 -434 12100
240 -748 -82 52900
580 849 919 34969
310 447 -97 48841
957 410 1 19044
-650 -192 -130 11025
565 500 -304 15376
813 -289 386 26244
865 702 94 5625
179 -271 -699 2809
417 293 -983 5041
668 -789 -454 32761
518 -870 785 7921
-34 32 366 52900
-623 -966 -322 484
184 -96 -365 361
-314 599 -15 9604
395 -14 -450 9409
98 -919 -636 51529
826 -618 -770 6889
119 -602 408 12769
330 -57 -174 51076
459 -271 -505 28561
-507 -905 -987 9604
-474 -228 -21 5476
429 405 355 1600
28 -609 -459 61504
-986 -59 225 49
-905 303 -378 484
-524 533 719 43681
-126 -58 545 31329
816 767 -334 17424
-455 -738 995 36100
-361 -725 455 12996
410 253 947 10609
-183 -391 -526 6084
206 149 902 47961
-853 -625 -69 51076
450 -3 -55 57600
-16 -284 39 2025
925 -738 515 900
692 -72 -611 3721
953 -77 -795 50625
-771 -621 -250 13924
481 -673 388 1681
-909 -199 -201 61009
240 -296 614 18496
614 633 -178 19321
-389 -421 -31 9025
326 618 -581 12996
588 133 402 49284
-484 522 327 42849
438 727 19 8100
817 -523 -26 19881
-856 864 202 3136
-56 -336 -315 26569
646 -722 -224 32400
280 99 -984 2916
859 -932 630 28900
477 -514 -758 40401
-388 888 567 196
-865 215 156 9604
861 -764 672 6889
-662 209 110 41209
-797 -588 -71 44521
-134 95 71 34596
142 870 -984 1024
-757 886 661 32761
-690 516 -57 26569
-204 757 -198 529
-316 325 -720 51076
899 -518 -108 36864

View File

@ -37,6 +37,10 @@
// this cache doesn't help much // this cache doesn't help much
#define CGAL_ENV_TRIANGLES_TRAITS_CACHE_POINT_ON #define CGAL_ENV_TRIANGLES_TRAITS_CACHE_POINT_ON
#ifdef CGAL_ENV_TRIANGLES_TRAITS_CACHE_POINT_ON
#include <map>
#endif
CGAL_BEGIN_NAMESPACE CGAL_BEGIN_NAMESPACE
template <class Kernel_> class Env_triangle_3; template <class Kernel_> class Env_triangle_3;

View File

@ -21,12 +21,10 @@
#define ENVELOPE_OVERLAY_2_H #define ENVELOPE_OVERLAY_2_H
#include <CGAL/Arr_overlay.h> #include <CGAL/Arr_overlay.h>
#include <CGAL/Envelope_overlay_functor.h> #include <CGAL/Envelope_3/Envelope_overlay_functor.h>
#include <iostream> #include <iostream>
//#define CGAL_DEBUG_ENVELOPE_OVERLAY_2
CGAL_BEGIN_NAMESPACE CGAL_BEGIN_NAMESPACE
template <class MinimizationDiagram_2, template <class MinimizationDiagram_2,
@ -56,54 +54,16 @@ public:
Minimization_diagram_2& md2, Minimization_diagram_2& md2,
Minimization_diagram_2& result) Minimization_diagram_2& result)
{ {
#ifdef CGAL_DEBUG_ENVELOPE_OVERLAY_2
cout << "In overlay: print edges of md1" << endl;
for(Halfedge_iterator hi = md1.halfedges_begin();
hi != md1.halfedges_end(); ++hi, ++hi)
cout << hi->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_functor overlay_func(md1, md2, result);
overlay(md1, md2, result, overlay_func); 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); post_test_assertions(result);
} }
public: public:
/*
void print_face(Face_handle fh) void print_face(Face_handle fh)
{ {
std::cout << (fh->is_unbounded() ? "unbounded" : "bounded"); std::cout << (fh->is_unbounded() ? "unbounded" : "bounded");
@ -207,6 +167,7 @@ public:
} }
std::cout << std::endl; std::cout << std::endl;
} }
*/
void post_test_assertions(Minimization_diagram_2& md) void post_test_assertions(Minimization_diagram_2& md)
{ {

View File

@ -27,7 +27,7 @@
#include <CGAL/Object.h> #include <CGAL/Object.h>
#include <CGAL/enum.h> #include <CGAL/enum.h>
#include <CGAL/Arr_observer.h> #include <CGAL/Arr_observer.h>
#include <CGAL/Overlay_2.h> #include <CGAL/Envelope_3/Env_overlay_2.h>
#include <CGAL/Envelope_3/Envelope_element_visitor_3.h> #include <CGAL/Envelope_3/Envelope_element_visitor_3.h>
#include <CGAL/Envelope_3/No_vertical_decomposition_2.h> #include <CGAL/Envelope_3/No_vertical_decomposition_2.h>
#include <CGAL/Envelope_3/set_dividors.h> #include <CGAL/Envelope_3/set_dividors.h>

View File

@ -82,7 +82,23 @@ public:
{ {
m_decision = dec; 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. * Get the number of data objects associated with the face.
*/ */

View File

@ -24,9 +24,6 @@
#include <CGAL/Object.h> #include <CGAL/Object.h>
#include <utility> #include <utility>
#include <iostream>
CGAL_BEGIN_NAMESPACE CGAL_BEGIN_NAMESPACE
template< class Traits_, class Arrangement_, class OutputIterator> template< class Traits_, class Arrangement_, class OutputIterator>
@ -66,9 +63,6 @@ public:
//(above_on_event is true iff 'above' subcurve is on the event //(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) 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 // we should never have above_on_event = true since we sweep an existing
// arrangement // arrangement
CGAL_assertion(!above_on_event); CGAL_assertion(!above_on_event);
@ -105,20 +99,11 @@ public:
{ {
// should change the previous pair - is sees the current event point // should change the previous pair - is sees the current event point
// instead of the previous above curve // 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(); Vertex_const_handle pvh = m_last_event->get_point().get_vertex_handle();
if (event_should_shoot_down || m_last_should_shoot_up) if (event_should_shoot_down || m_last_should_shoot_up)
*m_out++ = std::make_pair(CGAL::make_object(pvh), CGAL::make_object(vh)); *m_out++ = std::make_pair(CGAL::make_object(pvh),
else CGAL::make_object(vh));
{
#ifdef CGAL_DEBUG_PARTIAL_VD
std::cout << "point pair doesn't follow partial vd rules"
<< std::endl;
#endif
}
previous_event_see_current = true; previous_event_see_current = true;
} }
else else
@ -126,23 +111,13 @@ public:
// keep the previous pair, if existed // keep the previous pair, if existed
if (m_last_above != NULL) 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(); 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(); 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(), CGAL_assertion(m_arr.get_traits()->equal_2_object()(m_last_event->get_point(),
pvh->point())); pvh->point()));
if (m_last_should_shoot_up) if (m_last_should_shoot_up)
*m_out++ = std::make_pair(CGAL::make_object(pvh), CGAL::make_object(phe)); *m_out++ = std::make_pair(CGAL::make_object(pvh),
else CGAL::make_object(phe));
{
#ifdef CGAL_DEBUG_PARTIAL_VD
std::cout << "pair doesn't follow partial vd rules"
<< std::endl;
#endif
}
} }
} }
} }
@ -182,10 +157,6 @@ public:
// the status line // the status line
// it is also not an endpoint, since in this case, we would have // it is also not an endpoint, since in this case, we would have
// previous_event_see_current = true // 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(), CGAL_assertion(m_arr.get_traits()->equal_2_object()(event->get_point(),
vh->point())); vh->point()));
@ -199,13 +170,6 @@ public:
Halfedge_const_handle he = (*below)->get_last_curve().get_halfedge_handle(); Halfedge_const_handle he = (*below)->get_last_curve().get_halfedge_handle();
if (event_should_shoot_down) if (event_should_shoot_down)
*m_out++ = std::make_pair(CGAL::make_object(vh), CGAL::make_object(he)); *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
}
} }
} }
} }

View File

@ -20,15 +20,12 @@
#ifndef CGAL_PARTIAL_VERTICAL_DECOMPOSITION_2_H #ifndef CGAL_PARTIAL_VERTICAL_DECOMPOSITION_2_H
#define CGAL_PARTIAL_VERTICAL_DECOMPOSITION_2_H #define CGAL_PARTIAL_VERTICAL_DECOMPOSITION_2_H
//#define CGAL_DEBUG_PARTIAL_VD
#include <CGAL/Basic_sweep_line_2.h> #include <CGAL/Basic_sweep_line_2.h>
#include <CGAL/Sweep_line_2/Sweep_line_subcurve.h> #include <CGAL/Sweep_line_2/Sweep_line_subcurve.h>
#include <CGAL/Sweep_line_2/Sweep_line_event.h> #include <CGAL/Sweep_line_2/Sweep_line_event.h>
#include <CGAL/Partial_vd_visitor.h> #include <CGAL/Envelope_3/Partial_vd_visitor.h>
#include <CGAL/Partial_vd_meta_traits.h> #include <CGAL/Envelope_3/Partial_vd_meta_traits.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
#include <CGAL/Timer.h>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
@ -84,19 +81,7 @@ public:
// Do a partial vertical decomposition on existing arrangement "arr" // Do a partial vertical decomposition on existing arrangement "arr"
void operator()(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. // Go over all arrangement edges.
std::vector<X_monotone_curve_2> xcurves_vec; std::vector<X_monotone_curve_2> xcurves_vec;
xcurves_vec.resize(arr.number_of_edges()); xcurves_vec.resize(arr.number_of_edges());
@ -131,22 +116,14 @@ public:
Visitor visitor (arr, std::back_inserter(vd_pairs)); Visitor visitor (arr, std::back_inserter(vd_pairs));
Sweep_line sweep_line (&visitor); Sweep_line sweep_line (&visitor);
sweep_timer.start();
sweep_line.sweep(xcurves_vec.begin(), sweep_line.sweep(xcurves_vec.begin(),
xcurves_vec.end(), xcurves_vec.end(),
iso_points.begin(), iso_points.begin(),
iso_points.end()); iso_points.end());
sweep_timer.stop();
add_timer.start();
_add_vertical_edges(arr, vd_pairs); _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: protected:
// add the vertical edges (that were determined by the sweep) to the // add the vertical edges (that were determined by the sweep) to the
// arrangement // arrangement
@ -184,20 +161,10 @@ protected:
{ {
if (should_add_vertical_edge(arr.non_const_handle(v1), arr.non_const_handle(v2))) 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.insert_at_vertices(
arr.get_traits()->construct_vertical_2_object()(v1->point(), v2->point()), arr.get_traits()->construct_vertical_2_object()(v1->point(), v2->point()),
arr.non_const_handle(v1), arr.non_const_handle(v1),
arr.non_const_handle(v2)); arr.non_const_handle(v2));
insert_timer.stop();
} }
continue; continue;
} }
@ -223,10 +190,6 @@ protected:
if (!should_add_vertical_edge(v, orig_split_he)) if (!should_add_vertical_edge(v, orig_split_he))
continue; 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 // split split_he and connect the split point with v
if (map_orig_to_rightmost.is_defined(orig_split_he)) if (map_orig_to_rightmost.is_defined(orig_split_he))
// we should split the rightmost halfedge instead // we should split the rightmost halfedge instead
@ -247,10 +210,6 @@ protected:
split_p = arr.get_traits()->vertical_ray_shoot_2 split_p = arr.get_traits()->vertical_ray_shoot_2
(v->point(), split_he->curve()); (v->point(), split_he->curve());
Base_X_monotone_curve_2 a,b; 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); arr.get_traits()->split_2_object()(split_he->curve(), split_p, a, b);
split_he = arr.split_edge(split_he, a, b); split_he = arr.split_edge(split_he, a, b);
// split always returns the halfedge with source = original source // split always returns the halfedge with source = original source
@ -265,17 +224,10 @@ protected:
prev_split_v = split_v; prev_split_v = split_v;
// insert the vertical edge // 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.insert_at_vertices(
arr.get_traits()->construct_vertical_2_object()(v->point(), split_p), arr.get_traits()->construct_vertical_2_object()(v->point(), split_p),
v, v,
split_v); split_v);
insert_timer.stop();
// insert_x_monotone(arr, Base_X_monotone_curve_2(v->point(), split_p));
} }
vd_pairs.clear(); vd_pairs.clear();
} }
@ -283,25 +235,12 @@ protected:
bool should_add_vertical_edge(Vertex_handle v1, Vertex_handle v2) bool should_add_vertical_edge(Vertex_handle v1, Vertex_handle v2)
{ {
return true; return true;
// return (!v1->get_is_intersection() || !v2->get_is_intersection());
} }
bool should_add_vertical_edge(Vertex_handle v, Halfedge_handle he) bool should_add_vertical_edge(Vertex_handle v, Halfedge_handle he)
{ {
return true; 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;
}; };

View File

@ -37,16 +37,22 @@ template <class Traits_> class Envelope_diagram_2 :
typename Envelope_caching_traits_3<Traits_>::Xy_monotone_surface_3> > typename Envelope_caching_traits_3<Traits_>::Xy_monotone_surface_3> >
{ {
public: public:
typedef Traits_ Traits_3; typedef Traits_ Traits_3;
protected: protected:
typedef Envelope_caching_traits_3<Traits_3> Cache_traits_3; typedef Envelope_caching_traits_3<Traits_3> Cache_traits_3;
public: public:
typedef typename Cache_traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3; typedef typename Cache_traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3;
typedef Arrangement_2<Cache_traits_3,
Envelope_pm_dcel<Cache_traits_3, protected:
Xy_monotone_surface_3> > Base; typedef Envelope_pm_dcel<Cache_traits_3,
Xy_monotone_surface_3> Env_dcel;
public:
typedef Envelope_diagram_2<Traits_3> Self;
typedef Arrangement_2<Cache_traits_3, Env_dcel> Base;
typedef typename Env_dcel::Dcel_data_const_iterator Surface_const_iterator;
/*! Default constructor. */ /*! Default constructor. */
Envelope_diagram_2() : Envelope_diagram_2() :
@ -69,15 +75,15 @@ public:
*/ */
template <class InputIterator, class Traits> template <class InputIterator, class Traits>
void lower_envelope_3 (InputIterator begin, InputIterator end, void lower_envelope_3 (InputIterator begin, InputIterator end,
Envelope_diagram_2<Traits_>& min_diagram) Envelope_diagram_2<Traits>& min_diagram)
{ {
typedef Traits Traits_3; typedef Traits Traits_3;
typedef Envelope_caching_traits_3<Traits_3> Cache_Traits_3; typedef Envelope_caching_traits_3<Traits_3> Cache_traits_3;
typedef typename Envelope_diagram_2<Traits_3>::Base Base_arr_2; typedef typename Envelope_diagram_2<Traits_3>::Base Base_arr_2;
typedef Envelope_divide_and_conquer_3<Cache_traits_3, typedef Envelope_divide_and_conquer_3<Cache_traits_3,
Base_arr_2> Envelope_algorithm; Base_arr_2> Envelope_algorithm;
Traits_3 *traits = min_diagram->get_traits(); Cache_traits_3 *traits = min_diagram.get_traits();
traits->set_lower(); traits->set_lower();
Envelope_algorithm env_alg (traits); Envelope_algorithm env_alg (traits);
@ -94,17 +100,17 @@ void lower_envelope_3 (InputIterator begin, InputIterator end,
* \param max_diag Output: The maximization diagram. * \param max_diag Output: The maximization diagram.
* \pre The value-type of InputIterator is Traits::Surface_3. * \pre The value-type of InputIterator is Traits::Surface_3.
*/ */
template <class InputIterator, class Traits_> template <class InputIterator, class Traits>
void upper_envelope_3 (InputIterator begin, InputIterator end, void upper_envelope_3 (InputIterator begin, InputIterator end,
Envelope_diagram_2<Traits_>& max_diagram) Envelope_diagram_2<Traits>& max_diagram)
{ {
typedef Traits Traits_3; typedef Traits Traits_3;
typedef Envelope_caching_traits_3<Traits_3> Cache_Traits_3; typedef Envelope_caching_traits_3<Traits_3> Cache_traits_3;
typedef typename Envelope_diagram_2<Traits_3>::Base Base_arr_2; typedef typename Envelope_diagram_2<Traits_3>::Base Base_arr_2;
typedef Envelope_divide_and_conquer_3<Cache_traits_3, typedef Envelope_divide_and_conquer_3<Cache_traits_3,
Base_arr_2> Envelope_algorithm; Base_arr_2> Envelope_algorithm;
Traits_3 *traits = max_diagram->get_traits(); Cache_traits_3 *traits = max_diagram.get_traits();
traits->set_upper(); traits->set_upper();
Envelope_algorithm env_alg (traits); Envelope_algorithm env_alg (traits);