diff --git a/Code/hull.cpp b/Code/hull.cpp index 25249b6ccbbc01eb20c197c883d7a27f7d2b8811..00c06bab9e628e69ee25b88ce38cd8d2361d6684 100644 --- a/Code/hull.cpp +++ b/Code/hull.cpp @@ -40,14 +40,18 @@ struct vec { //}}} +int sign(float x) { + if(x > 0) return 1 ; + if(x < 0) return -1 ; + return 0 ; +} + int orient(const vec& v0, const vec& v1) { //determinant float d = v0.x*v1.y - v0.y*v1.x ; //encode as sign - if(d > 0) return 1 ; - if(d < 0) return -1 ; - return 0 ; + return sign(d) ; } struct vec_compare { @@ -90,13 +94,13 @@ void compute_hull(std::vector<vec>& points, std::vector<vec>& hull) { for(size_t i = 2; i < points.size(); ++i) { //check whether the last segment creates a wrong turn const vec& p = points[i] ; - vec v1 = p - *(hull.end() - 1) ; + vec v1 = p - *(hull.end() - 2) ; vec v2 = *(hull.end() - 1) - *(hull.end() - 2) ; while(hull.size() > 1 && orient(v1, v2) < 0) { //in case of wrong turn, rease the last point of the hull and iterate hull.erase(hull.end() - 1) ; - v1 = p - *(hull.end() - 1) ; - v2 = p - *(hull.end() - 2) ; + v1 = p - *(hull.end() - 2) ; + v2 = *(hull.end() - 1) - *(hull.end() - 2) ; } hull.push_back(p) ; } diff --git a/Presentation/Figures/hull.svg b/Presentation/Figures/hull.svg index 7a44f379651decc26660176777ea06ba1ac7524b..e177c819ca41e0b0cb03affa18505a198cda56fa 100644 --- a/Presentation/Figures/hull.svg +++ b/Presentation/Figures/hull.svg @@ -27,6 +27,92 @@ </metadata> <defs id="defs1894"> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker5177" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow2Send"> + <path + transform="scale(0.3) rotate(180) translate(-2.3,0)" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + id="path5175" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker4465" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + transform="scale(0.6) rotate(180) translate(0,0)" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + id="path4463" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0.0" + refX="0.0" + id="marker4219" + style="overflow:visible;" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path4217" + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(0.6) rotate(180) translate(0,0)" /> + </marker> + <marker + inkscape:stockid="Arrow2Mstart" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow2Mstart" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path841" + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(0.6) translate(0,0)" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible;" + id="marker3855" + refX="0.0" + refY="0.0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + transform="scale(0.6) rotate(180) translate(0,0)" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + id="path3853" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0.0" + refX="0.0" + id="marker3809" + style="overflow:visible;" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path844" + style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(0.6) rotate(180) translate(0,0)" /> + </marker> <marker inkscape:stockid="Arrow2Send" orient="auto" @@ -34,7 +120,8 @@ refX="0.0" id="Arrow2Send" style="overflow:visible;" - inkscape:isstock="true"> + inkscape:isstock="true" + inkscape:collect="always"> <path id="path2197" style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#f57900;stroke-opacity:1;fill:#f57900;fill-opacity:1" @@ -55,6 +142,21 @@ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " transform="scale(0.6) rotate(180) translate(0,0)" /> </marker> + <marker + inkscape:stockid="Arrow2Mstart" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mstart-2" + style="overflow:visible" + inkscape:isstock="true"> + <path + inkscape:connector-curvature="0" + id="path841-8" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(0.6)" /> + </marker> </defs> <sodipodi:namedview pagecolor="#ffffff" @@ -70,10 +172,11 @@ id="namedview1892" showgrid="false" inkscape:zoom="1.3796869" - inkscape:cx="454.51793" - inkscape:cy="483.23057" - inkscape:current-layer="layer6" - inkscape:snap-object-midpoints="true" /> + inkscape:cx="224.13977" + inkscape:cy="621.88734" + inkscape:current-layer="layer7" + inkscape:snap-object-midpoints="true" + inkscape:snap-global="true" /> <g inkscape:groupmode="layer" id="layer4" @@ -780,7 +883,7 @@ inkscape:groupmode="layer" id="layer6" inkscape:label="partial_hull" - style="display:inline"> + style="display:none"> <circle cx="56" cy="481" @@ -824,67 +927,68 @@ inkscape:connector-curvature="0" /> </g> <g - inkscape:groupmode="layer" - id="layer7" - inkscape:label="adding_point_1" - style="display:inline"> + style="display:none" + inkscape:label="adding_point_1 copy" + id="g4215" + inkscape:groupmode="layer"> <path - inkscape:connector-curvature="0" - id="path2434" + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" d="M 249,300 256,213 204,180 75,409 56,481" - style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + id="path4197" + inkscape:connector-curvature="0" /> <circle - id="circle2437" - style="display:inline;fill:none;stroke:#000000;stroke-width:2" - r="12" + cx="56" cy="481" - cx="56" /> - <circle - id="circle2439" - style="display:inline;fill:none;stroke:#000000;stroke-width:2" r="12" - cy="409" - cx="75" /> - <circle - id="circle2441" style="display:inline;fill:none;stroke:#000000;stroke-width:2" - r="12" - cy="180" - cx="204" /> + id="circle4199" /> <circle - id="circle2443" - style="display:inline;fill:none;stroke:#000000;stroke-width:2" + cx="75" + cy="409" r="12" - cy="213" - cx="256" /> + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + id="circle4201" /> <circle - id="circle2445" + cx="204" + cy="180" + r="12" style="display:inline;fill:none;stroke:#000000;stroke-width:2" + id="circle4203" /> + <circle + cx="256" + cy="213" r="12" - cy="300" - cx="249" /> + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + id="circle4205" /> <circle - cx="412" - cy="193" + cx="249" + cy="300" r="12" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + id="circle4207" /> + <circle + id="circle4209" style="display:inline;fill:#f57900;stroke:#f57900;stroke-width:2" - id="circle1838-62-9" /> + r="12" + cy="193" + cx="412" /> <path - style="display:inline;opacity:1;fill:#f57900;fill-opacity:1;stroke:#f57900;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" + id="path4211" d="M 249,300 412,193" - id="path2160" - inkscape:connector-curvature="0" /> + style="display:inline;opacity:1;fill:#f57900;fill-opacity:1;stroke:#f57900;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> <path - style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#f57900;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Send)" - d="m 286.70433,227.21216 c 0,6.93447 5.56889,12.58358 12.50265,12.68274 6.93376,0.0992 12.66193,-5.38837 12.86024,-12.32 0.19831,-6.93163 -4.18172,-9.66261 -12.13483,-13.0351" - id="path2162" + sodipodi:nodetypes="cssc" inkscape:connector-curvature="0" - sodipodi:nodetypes="cssc" /> + id="path4213" + d="m 286.70433,227.21216 c 0,6.93447 5.56889,12.58358 12.50265,12.68274 6.93376,0.0992 12.66193,-5.38837 12.86024,-12.32 0.19831,-6.93163 -4.18172,-9.66261 -12.13483,-13.0351" + style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#f57900;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Send)" /> </g> <g inkscape:groupmode="layer" id="layer8" - inkscape:label="adding_point_2" /> + inkscape:label="adding_point_2" + style="display:none" /> <g inkscape:groupmode="layer" id="layer3" @@ -1086,6 +1190,101 @@ y2="481" id="line1888" /> </g> + <g + inkscape:groupmode="layer" + id="layer1" + inkscape:label="sort_comparison" + style="display:none"> + <path + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:3.9987402;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker3855)" + d="m 56,481 239.39339,76.13113" + id="path3804" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:3.99900007;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker3809)" + d="M 56,481 260.93093,372.66266" + id="path3806" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:3.99900007;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-start:url(#Arrow2Mstart)" + id="path3893" + sodipodi:type="arc" + sodipodi:cx="56" + sodipodi:cy="481" + sodipodi:rx="135.90041" + sodipodi:ry="135.90041" + sodipodi:start="5.86421" + sodipodi:end="0.22218386" + sodipodi:open="true" + d="m 180.14588,425.71237 a 135.90041,135.90041 0 0 1 8.4139,85.23469" /> + </g> + <g + inkscape:groupmode="layer" + id="layer7" + inkscape:label="sweep_comparison" + style="display:inline"> + <path + inkscape:connector-curvature="0" + id="path2434" + d="M 249,300 256,213 204,180 75,409 56,481" + style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <circle + id="circle2437" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + r="12" + cy="481" + cx="56" /> + <circle + id="circle2439" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + r="12" + cy="409" + cx="75" /> + <circle + id="circle2441" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + r="12" + cy="180" + cx="204" /> + <circle + id="circle2443" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + r="12" + cy="213" + cx="256" /> + <circle + id="circle2445" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + r="12" + cy="300" + cx="249" /> + <circle + cx="412" + cy="193" + r="12" + style="display:inline;fill:none;stroke:#000000;stroke-width:2" + id="circle1838-62-9" /> + <path + style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker4219)" + d="M 256,213 392.52453,194.79379" + id="path2160" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path4461" + d="m 256,213 -5.69769,68.15215" + style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker4465)" /> + <path + style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:3.99900007;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-start:url(#Arrow2Mstart-2)" + d="m 298.36687,215.56256 c -0.20385,0.89626 -0.0234,1.65148 -0.0697,2.46886 -1.21336,21.43846 -17.36115,36.33106 -39.02351,37.97982" + id="path3893-9" + inkscape:connector-curvature="0" + sodipodi:nodetypes="csc" /> + </g> <g inkscape:groupmode="layer" id="layer5" diff --git a/Presentation/Figures/orient.pdf b/Presentation/Figures/orient.pdf new file mode 100644 index 0000000000000000000000000000000000000000..58c981c49844eff5719425e51f55f833550ebacf Binary files /dev/null and b/Presentation/Figures/orient.pdf differ diff --git a/Presentation/Figures/orient.svg b/Presentation/Figures/orient.svg new file mode 100644 index 0000000000000000000000000000000000000000..772fefe4cc34bf1db466d4c0534482e8df92d693 --- /dev/null +++ b/Presentation/Figures/orient.svg @@ -0,0 +1,396 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:ns1="http://www.iki.fi/pav/software/textext/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="114.63708mm" + height="57.568756mm" + viewBox="0 0 114.63708 57.568756" + version="1.1" + id="svg8" + inkscape:version="0.92.4 5da689c313, 2019-01-14" + sodipodi:docname="orient.svg"> + <defs + id="defs2"> + <marker + inkscape:stockid="Arrow2Sstart" + orient="auto" + refY="0" + refX="0" + id="Arrow2Sstart" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path847" + style="fill:#73d216;fill-opacity:1;fill-rule:evenodd;stroke:#73d216;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="matrix(0.3,0,0,0.3,-0.69,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow1Sstart" + orient="auto" + refY="0" + refX="0" + id="marker1657" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1655" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + transform="matrix(0.2,0,0,0.2,1.2,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow1Sstart" + orient="auto" + refY="0" + refX="0" + id="Arrow1Sstart" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path829" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1" + transform="matrix(0.2,0,0,0.2,1.2,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1115" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1113" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + id="path844" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-9" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + inkscape:connector-curvature="0" + id="path844-1" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1115-2" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend"> + <path + inkscape:connector-curvature="0" + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1113-7" /> + </marker> + <marker + inkscape:stockid="Arrow2Sstart" + orient="auto" + refY="0" + refX="0" + id="Arrow2Sstart-0" + style="overflow:visible" + inkscape:isstock="true"> + <path + inkscape:connector-curvature="0" + id="path847-9" + style="fill:#ef2929;fill-opacity:1;fill-rule:evenodd;stroke:#ef2929;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="matrix(0.3,0,0,0.3,-0.69,0)" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4" + inkscape:cx="236.33847" + inkscape:cy="47.737009" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:snap-object-midpoints="true" + inkscape:snap-global="true" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-48.106519,-105.14661)"> + <g + id="g1917"> + <path + inkscape:connector-curvature="0" + id="path815" + d="M 48.643053,133.96559 H 89.268021" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.05799997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Mend)" /> + <path + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.05799997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker1115)" + d="M 48.643053,133.96559 78.397999,106.3064" + id="path1111" + inkscape:connector-curvature="0" /> + <path + d="m 65.353562,122.04938 a 20.524063,20.524063 0 0 1 3.744204,10.23045" + sodipodi:open="true" + sodipodi:end="6.2009568" + sodipodi:start="5.6637237" + sodipodi:ry="20.524063" + sodipodi:rx="20.524063" + sodipodi:cy="133.96559" + sodipodi:cx="48.643051" + sodipodi:type="arc" + id="path1513" + style="opacity:1;fill:none;fill-opacity:1;stroke:#73d216;stroke-width:1.05799997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-start:url(#Arrow2Sstart)" /> + <g + style="stroke-width:2.2442975" + transform="matrix(1.0284933,0,0,1.0284933,-90.069698,3.9616292)" + ns1:version="0.10.0" + ns1:texconverter="pdflatex" + ns1:pdfconverter="pdf2svg" + ns1:text="$\\mathbf{v}_0$" + ns1:preamble="/home/nivoliev/.config/inkscape/extensions/textext/default_packages.tex" + ns1:scale="6.54305795713" + ns1:alignment="middle center" + ns1:jacobian_sqrt="2.308245" + id="g1814"> + <g + style="stroke-width:2.2442975" + id="surface1"> + <g + style="fill:#000000;fill-opacity:1;stroke-width:2.2442975" + id="g1807"> + <path + inkscape:connector-curvature="0" + style="stroke:none;stroke-width:0" + d="m 5.046875,-3.75 c 0.0625,-0.140625 0.09375,-0.203125 0.734375,-0.203125 v -0.46875 C 5.53125,-4.40625 5.25,-4.390625 5,-4.390625 c -0.25,0 -0.703125,-0.03125 -0.90625,-0.03125 v 0.46875 c 0.1875,0 0.46875,0.03125 0.46875,0.109375 0,0 0,0.03125 -0.046875,0.109375 l -1.15625,2.5 -1.265625,-2.71875 H 2.625 v -0.46875 c -0.328125,0.015625 -1.21875,0.03125 -1.234375,0.03125 -0.28125,0 -0.71875,-0.03125 -1.125,-0.03125 v 0.46875 h 0.625 l 1.75,3.75 c 0.125,0.25 0.25,0.25 0.375,0.25 0.171875,0 0.28125,-0.03125 0.375,-0.25 z m 0,0" + transform="translate(148.712,134.765)" + id="path1805" /> + </g> + <g + style="fill:#000000;fill-opacity:1;stroke-width:2.2442975" + id="g1811"> + <path + inkscape:connector-curvature="0" + style="stroke:none;stroke-width:0" + d="M 3.59375,-2.21875 C 3.59375,-2.984375 3.5,-3.546875 3.1875,-4.03125 2.96875,-4.34375 2.53125,-4.625 1.984375,-4.625 c -1.625,0 -1.625,1.90625 -1.625,2.40625 0,0.5 0,2.359375 1.625,2.359375 1.609375,0 1.609375,-1.859375 1.609375,-2.359375 z M 1.984375,-0.0625 c -0.328125,0 -0.75,-0.1875 -0.890625,-0.75 C 1,-1.21875 1,-1.796875 1,-2.3125 1,-2.828125 1,-3.359375 1.09375,-3.734375 1.25,-4.28125 1.6875,-4.4375 1.984375,-4.4375 c 0.375,0 0.734375,0.234375 0.859375,0.640625 0.109375,0.375 0.125,0.875 0.125,1.484375 0,0.515625 0,1.03125 -0.09375,1.46875 -0.140625,0.640625 -0.609375,0.78125 -0.890625,0.78125 z m 0,0" + transform="translate(154.759,136.259)" + id="path1809" /> + </g> + </g> + </g> + <g + transform="matrix(1.028493,0,0,1.028493,-101.47796,-21.149805)" + ns1:version="0.10.0" + ns1:texconverter="pdflatex" + ns1:pdfconverter="pdf2svg" + ns1:text="$\\mathbf{v}_1$" + ns1:preamble="/home/nivoliev/.config/inkscape/extensions/textext/default_packages.tex" + ns1:scale="2.91541464204" + ns1:alignment="middle center" + ns1:jacobian_sqrt="1.028493" + id="g1886"> + <g + id="g1884"> + <g + style="fill:#000000;fill-opacity:1" + id="g1878"> + <path + style="stroke:none;stroke-width:0" + d="m 5.046875,-3.75 c 0.0625,-0.140625 0.09375,-0.203125 0.734375,-0.203125 v -0.46875 C 5.53125,-4.40625 5.25,-4.390625 5,-4.390625 c -0.25,0 -0.703125,-0.03125 -0.90625,-0.03125 v 0.46875 c 0.1875,0 0.46875,0.03125 0.46875,0.109375 0,0 0,0.03125 -0.046875,0.109375 l -1.15625,2.5 -1.265625,-2.71875 H 2.625 v -0.46875 c -0.328125,0.015625 -1.21875,0.03125 -1.234375,0.03125 -0.28125,0 -0.71875,-0.03125 -1.125,-0.03125 v 0.46875 h 0.625 l 1.75,3.75 c 0.125,0.25 0.25,0.25 0.375,0.25 0.171875,0 0.28125,-0.03125 0.375,-0.25 z m 0,0" + transform="translate(148.712,134.765)" + id="path1876" + inkscape:connector-curvature="0" /> + </g> + <g + style="fill:#000000;fill-opacity:1" + id="g1882"> + <path + style="stroke:none;stroke-width:0" + d="m 2.328125,-4.4375 c 0,-0.1875 0,-0.1875 -0.203125,-0.1875 -0.453125,0.4375 -1.078125,0.4375 -1.359375,0.4375 v 0.25 c 0.15625,0 0.625,0 1,-0.1875 v 3.546875 c 0,0.234375 0,0.328125 -0.6875,0.328125 H 0.8125 V 0 c 0.125,0 0.984375,-0.03125 1.234375,-0.03125 0.21875,0 1.09375,0.03125 1.25,0.03125 V -0.25 H 3.03125 c -0.703125,0 -0.703125,-0.09375 -0.703125,-0.328125 z m 0,0" + transform="translate(154.759,136.259)" + id="path1880" + inkscape:connector-curvature="0" /> + </g> + </g> + </g> + <text + id="text1898" + y="127.0603" + x="73.131424" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.37443352px;line-height:17.77255249px;font-family:'Linux Biolinum';-inkscape-font-specification:'Linux Biolinum';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#73d216;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="fill:#73d216;stroke-width:0.26458332px" + y="127.0603" + x="73.131424" + id="tspan1896" + sodipodi:role="line">+</tspan></text> + </g> + <path + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.05799997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#Arrow2Mend-9)" + d="m 120.51912,133.91128 h 40.62496" + id="path815-6" + inkscape:connector-curvature="0" /> + <path + inkscape:connector-curvature="0" + id="path1111-0" + d="m 120.51912,133.91128 29.75494,27.65919" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1.05799997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker1115-2)" /> + <path + style="opacity:1;fill:none;fill-opacity:1;stroke:#ef2929;stroke-width:1.05799997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker-start:url(#Arrow2Sstart-0)" + id="path1513-6" + sodipodi:type="arc" + sodipodi:cx="120.51912" + sodipodi:cy="-133.91129" + sodipodi:rx="20.524063" + sodipodi:ry="20.524063" + sodipodi:start="5.6637237" + sodipodi:end="6.2009568" + sodipodi:open="true" + d="m 137.22963,-145.82749 a 20.524063,20.524063 0 0 1 3.7442,10.23044" + transform="scale(1,-1)" /> + <g + id="g1814-2" + ns1:jacobian_sqrt="2.308245" + ns1:alignment="middle center" + ns1:scale="6.54305795713" + ns1:preamble="/home/nivoliev/.config/inkscape/extensions/textext/default_packages.tex" + ns1:text="$\\mathbf{v}_0$" + ns1:pdfconverter="pdf2svg" + ns1:texconverter="pdflatex" + ns1:version="0.10.0" + transform="matrix(1.0284933,0,0,1.0284933,-19.516552,-11.589708)" + style="stroke-width:2.2442975"> + <g + id="surface1-6" + style="stroke-width:2.2442975"> + <g + id="g1807-1" + style="fill:#000000;fill-opacity:1;stroke-width:2.2442975"> + <path + id="path1805-8" + transform="translate(148.712,134.765)" + d="m 5.046875,-3.75 c 0.0625,-0.140625 0.09375,-0.203125 0.734375,-0.203125 v -0.46875 C 5.53125,-4.40625 5.25,-4.390625 5,-4.390625 c -0.25,0 -0.703125,-0.03125 -0.90625,-0.03125 v 0.46875 c 0.1875,0 0.46875,0.03125 0.46875,0.109375 0,0 0,0.03125 -0.046875,0.109375 l -1.15625,2.5 -1.265625,-2.71875 H 2.625 v -0.46875 c -0.328125,0.015625 -1.21875,0.03125 -1.234375,0.03125 -0.28125,0 -0.71875,-0.03125 -1.125,-0.03125 v 0.46875 h 0.625 l 1.75,3.75 c 0.125,0.25 0.25,0.25 0.375,0.25 0.171875,0 0.28125,-0.03125 0.375,-0.25 z m 0,0" + style="stroke:none;stroke-width:0" + inkscape:connector-curvature="0" /> + </g> + <g + id="g1811-7" + style="fill:#000000;fill-opacity:1;stroke-width:2.2442975"> + <path + id="path1809-9" + transform="translate(154.759,136.259)" + d="M 3.59375,-2.21875 C 3.59375,-2.984375 3.5,-3.546875 3.1875,-4.03125 2.96875,-4.34375 2.53125,-4.625 1.984375,-4.625 c -1.625,0 -1.625,1.90625 -1.625,2.40625 0,0.5 0,2.359375 1.625,2.359375 1.609375,0 1.609375,-1.859375 1.609375,-2.359375 z M 1.984375,-0.0625 c -0.328125,0 -0.75,-0.1875 -0.890625,-0.75 C 1,-1.21875 1,-1.796875 1,-2.3125 1,-2.828125 1,-3.359375 1.09375,-3.734375 1.25,-4.28125 1.6875,-4.4375 1.984375,-4.4375 c 0.375,0 0.734375,0.234375 0.859375,0.640625 0.109375,0.375 0.125,0.875 0.125,1.484375 0,0.515625 0,1.03125 -0.09375,1.46875 -0.140625,0.640625 -0.609375,0.78125 -0.890625,0.78125 z m 0,0" + style="stroke:none;stroke-width:0" + inkscape:connector-curvature="0" /> + </g> + </g> + </g> + <g + id="g1886-2" + ns1:jacobian_sqrt="1.028493" + ns1:alignment="middle center" + ns1:scale="2.91541464204" + ns1:preamble="/home/nivoliev/.config/inkscape/extensions/textext/default_packages.tex" + ns1:text="$\\mathbf{v}_1$" + ns1:pdfconverter="pdf2svg" + ns1:texconverter="pdflatex" + ns1:version="0.10.0" + transform="matrix(1.028493,0,0,1.028493,-30.35785,15.081596)"> + <g + id="g1884-0"> + <g + id="g1878-2" + style="fill:#000000;fill-opacity:1"> + <path + id="path1876-3" + transform="translate(148.712,134.765)" + d="m 5.046875,-3.75 c 0.0625,-0.140625 0.09375,-0.203125 0.734375,-0.203125 v -0.46875 C 5.53125,-4.40625 5.25,-4.390625 5,-4.390625 c -0.25,0 -0.703125,-0.03125 -0.90625,-0.03125 v 0.46875 c 0.1875,0 0.46875,0.03125 0.46875,0.109375 0,0 0,0.03125 -0.046875,0.109375 l -1.15625,2.5 -1.265625,-2.71875 H 2.625 v -0.46875 c -0.328125,0.015625 -1.21875,0.03125 -1.234375,0.03125 -0.28125,0 -0.71875,-0.03125 -1.125,-0.03125 v 0.46875 h 0.625 l 1.75,3.75 c 0.125,0.25 0.25,0.25 0.375,0.25 0.171875,0 0.28125,-0.03125 0.375,-0.25 z m 0,0" + style="stroke:none;stroke-width:0" + inkscape:connector-curvature="0" /> + </g> + <g + id="g1882-7" + style="fill:#000000;fill-opacity:1"> + <path + id="path1880-5" + transform="translate(154.759,136.259)" + d="m 2.328125,-4.4375 c 0,-0.1875 0,-0.1875 -0.203125,-0.1875 -0.453125,0.4375 -1.078125,0.4375 -1.359375,0.4375 v 0.25 c 0.15625,0 0.625,0 1,-0.1875 v 3.546875 c 0,0.234375 0,0.328125 -0.6875,0.328125 H 0.8125 V 0 c 0.125,0 0.984375,-0.03125 1.234375,-0.03125 0.21875,0 1.09375,0.03125 1.25,0.03125 V -0.25 H 3.03125 c -0.703125,0 -0.703125,-0.09375 -0.703125,-0.328125 z m 0,0" + style="stroke:none;stroke-width:0" + inkscape:connector-curvature="0" /> + </g> + </g> + </g> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.37443352px;line-height:17.77255249px;font-family:'Linux Biolinum';-inkscape-font-specification:'Linux Biolinum';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ef2929;fill-opacity:1;stroke:#ef2929;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="144.44052" + y="144.58188" + id="text1898-9"><tspan + sodipodi:role="line" + id="tspan1896-2" + x="144.44052" + y="144.58188" + style="fill:#ef2929;stroke:#ef2929;stroke-width:0.26458332px">-</tspan></text> + </g> +</svg> diff --git a/Presentation/Figures/sort_comparison.pdf b/Presentation/Figures/sort_comparison.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e29ce993b2fe28701ee649b9f9fb194db850186e Binary files /dev/null and b/Presentation/Figures/sort_comparison.pdf differ diff --git a/Presentation/Figures/sweep_comparison.pdf b/Presentation/Figures/sweep_comparison.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cfae1bbbcab5446616f0834efdecc54806b9dee4 Binary files /dev/null and b/Presentation/Figures/sweep_comparison.pdf differ diff --git a/Presentation/presentation.tex b/Presentation/presentation.tex index d70438fd7851f8cb0f6fa224068996a0c819ef45..a943089726b64c2cb7c1f289646e7174bd588e76 100644 --- a/Presentation/presentation.tex +++ b/Presentation/presentation.tex @@ -25,29 +25,29 @@ \frame { \frametitle{Enveloppe convexe} \centering - \includegraphics[width=0.6\li]{Figures/hull.pdf} + \includegraphics[width=0.6\li]{Figures/hull} } \frame { \frametitle{1 -- trier par angle} \centering - \includegraphics[width=0.6\li]{Figures/hull_sort.pdf} + \includegraphics[width=0.6\li]{Figures/hull_sort} } \frame { \frametitle{2 -- balayage} \centering - \only<1>{\includegraphics[width=0.6\li]{Figures/partial_hull.pdf}}% - \only<2>{\includegraphics[width=0.6\li]{Figures/increment_hull_1.pdf}}% - \only<3>{\includegraphics[width=0.6\li]{Figures/increment_hull_2.pdf}}% - \only<4>{\includegraphics[width=0.6\li]{Figures/increment_hull_3.pdf}}% - \only<5>{\includegraphics[width=0.6\li]{Figures/hull.pdf}}% + \only<1>{\includegraphics[width=0.6\li]{Figures/partial_hull}}% + \only<2>{\includegraphics[width=0.6\li]{Figures/increment_hull_1}}% + \only<3>{\includegraphics[width=0.6\li]{Figures/increment_hull_2}}% + \only<4>{\includegraphics[width=0.6\li]{Figures/increment_hull_3}}% + \only<5>{\includegraphics[width=0.6\li]{Figures/hull}}% } \frame { \frametitle{Robustesse : alignements de points} \centering - \includegraphics[width=0.6\li]{Figures/hull_aligned.pdf} + \includegraphics[width=0.6\li]{Figures/hull_aligned} } \frame { @@ -80,4 +80,149 @@ \end{ucblalgo} } +\section{Perturbation} + +\frame{ + \frametitle{Prédicat : orientation} + \centering + \includegraphics[width=0.5\li]{Figures/orient} + + \vspace{8mm} + \begin{myblock}{0.8\li} + \centering + $ + \det{ + \left( + \begin{array}{cc} + x_0 & x_1 \\ + y_0 & y_1 \\ + \end{array} + \right) + } + $ : sinus de l'angle si vecteurs normalisés. + + \hl{positif, négatif ou nul} + \end{myblock} +} + +\frame{ + \frametitle{Utilisation pour l'enveloppe convexe} + \centering + \only<1>{\includegraphics[width=0.6\li]{Figures/sort_comparison}}% + \only<2>{\includegraphics[width=0.6\li]{Figures/sweep_comparison}} +} + +\newcommand{\eps}{\ensuremath{\varepsilon}} + +\frame{ + \frametitle{Perturbation} + + \begin{align*} + \det{ + \left( + \begin{array}{cc} + x_0 + \eps_{0,0} & x_1 + \eps_{1,0} \\ + y_0 + \eps_{0,1} & y_1 + \eps_{1,1} \\ + \end{array} + \right) + } + &= + \det{ + \left( + \begin{array}{cc} + x_0 & x_1 \\ + y_0 & y_1 \\ + \end{array} + \right) + } \\ + & + + \eps_{0,0} y_1 + + \eps_{1,1} x_0 + - \eps_{0,1} x_1 + - \eps_{1,0} y_0 + \\ + & + + \eps_{0,0}\eps_{1,1} + - \eps_{0,1}\eps_{1,0} + \end{align*} + + \vspace{5mm} + \begin{myblock}{0.8\li} + \begin{enumerate} + \item systématiquement plus de zéro ? + \item facilité d'évaluation ? + \end{enumerate} + \end{myblock} +} + +\frame{ + \frametitle{Rester dans le pétrin} + + Posons que $ \forall(i,j), \eps_{i,j} = \eps > 0$ + + \begin{equation*} + \eps y_1 + + \eps x_0 + - \eps x_1 + - \eps y_0 + + \eps\eps + - \eps\eps + \end{equation*} + + \vspace{5mm} + Si $(x_0,y_0) = (0,1)$ et $(x_1,y_1) = (0,2)$ + + \begin{equation*} + 2\eps + - \eps + + \eps\eps + - \eps\eps + = \eps + \quad \Rightarrow \mbox{positif !} + \end{equation*} + + \visible<2>{ + \vspace{5mm} + Si $(x_0,y_0) = (1,1)$ et $(x_1,y_1) = (2,2)$ + + \begin{equation*} + 2\eps + + \eps + - 2\eps + - \eps + + \eps\eps + - \eps\eps + = 0 + \quad \Rightarrow \mbox{arf.} + \end{equation*} + } +} + +\frame{ + \frametitle{Sortir du pétrin} + + Avec la perturbation $ \begin{pmatrix}\eps^1 & \eps^2 \\ \eps^2 & \eps^2\end{pmatrix}$ + + \begin{align*} + & \eps^1 y_1 + + \eps^2 x_0 + - \eps^2 x_1 + - \eps^2 y_0 + + \eps^1\eps^2 + - \eps^2\eps^2 \\ + &= \eps y_1 + \eps^2(x_0 - x_1 - y_0) + \eps^3 - \eps^4 + \end{align*} + + \vspace{8mm} + \visible<2->{ + \begin{myblock}{0.8\li} + \begin{itemize} + \item<1-> si $y_1$ est non nul, renvoyer son signe ; + \item<3-> si $x_0 - x_1 - y_0$ est non nul, renvoyer son signe ; + \item<4-> sinon renvoyer positif. + \end{itemize} + \end{myblock} + } +} + \end{document}