1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>within</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Geometry"> 8<link rel="up" href="../within.html" title="within"> 9<link rel="prev" href="../within.html" title="within"> 10<link rel="next" href="within_3_with_strategy.html" title="within (with strategy)"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="../within.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../within.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="within_3_with_strategy.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="geometry.reference.algorithms.within.within_2"></a><a class="link" href="within_2.html" title="within">within</a> 28</h5></div></div></div> 29<p> 30 <a class="indexterm" name="idm45635687098896"></a> 31Checks if the first geometry is completely inside the second geometry. 32 </p> 33<h6> 34<a name="geometry.reference.algorithms.within.within_2.h0"></a> 35 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.description"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.description">Description</a> 36 </h6> 37<p> 38 The free function within checks if the first geometry is completely inside 39 the second geometry. 40 </p> 41<h6> 42<a name="geometry.reference.algorithms.within.within_2.h1"></a> 43 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.synopsis"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.synopsis">Synopsis</a> 44 </h6> 45<p> 46</p> 47<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Geometry1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Geometry2</span><span class="special">></span> 48<span class="keyword">bool</span> <span class="identifier">within</span><span class="special">(</span><span class="identifier">Geometry1</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">geometry1</span><span class="special">,</span> <span class="identifier">Geometry2</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">geometry2</span><span class="special">)</span></pre> 49<p> 50 </p> 51<h6> 52<a name="geometry.reference.algorithms.within.within_2.h2"></a> 53 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.parameters"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.parameters">Parameters</a> 54 </h6> 55<div class="informaltable"><table class="table"> 56<colgroup> 57<col> 58<col> 59<col> 60<col> 61</colgroup> 62<thead><tr> 63<th> 64 <p> 65 Type 66 </p> 67 </th> 68<th> 69 <p> 70 Concept 71 </p> 72 </th> 73<th> 74 <p> 75 Name 76 </p> 77 </th> 78<th> 79 <p> 80 Description 81 </p> 82 </th> 83</tr></thead> 84<tbody> 85<tr> 86<td> 87 <p> 88 Geometry1 const & 89 </p> 90 </td> 91<td> 92 <p> 93 Any type fulfilling a Geometry Concept 94 </p> 95 </td> 96<td> 97 <p> 98 geometry1 99 </p> 100 </td> 101<td> 102 <p> 103 A model of the specified concept which might be within the 104 second geometry 105 </p> 106 </td> 107</tr> 108<tr> 109<td> 110 <p> 111 Geometry2 const & 112 </p> 113 </td> 114<td> 115 <p> 116 Any type fulfilling a Geometry Concept 117 </p> 118 </td> 119<td> 120 <p> 121 geometry2 122 </p> 123 </td> 124<td> 125 <p> 126 A model of the specified concept which might contain the first 127 geometry 128 </p> 129 </td> 130</tr> 131</tbody> 132</table></div> 133<h6> 134<a name="geometry.reference.algorithms.within.within_2.h3"></a> 135 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.returns"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.returns">Returns</a> 136 </h6> 137<p> 138 true if geometry1 is completely contained within geometry2, else false 139 </p> 140<h6> 141<a name="geometry.reference.algorithms.within.within_2.h4"></a> 142 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.header"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.header">Header</a> 143 </h6> 144<p> 145 Either 146 </p> 147<p> 148 <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 149 </p> 150<p> 151 Or 152 </p> 153<p> 154 <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">algorithms</span><span class="special">/</span><span class="identifier">within</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 155 </p> 156<h6> 157<a name="geometry.reference.algorithms.within.within_2.h5"></a> 158 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.conformance"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.conformance">Conformance</a> 159 </h6> 160<p> 161 The function within implements function Within from the <a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC 162 Simple Feature Specification</a>. 163 </p> 164<div class="note"><table border="0" summary="Note"> 165<tr> 166<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td> 167<th align="left">Note</th> 168</tr> 169<tr><td align="left" valign="top"><p> 170 OGC defines within as completely within and not on the border. See 171 the notes for within / on the border 172 </p></td></tr> 173</table></div> 174<h6> 175<a name="geometry.reference.algorithms.within.within_2.h6"></a> 176 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.supported_geometries"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.supported_geometries">Supported 177 geometries</a> 178 </h6> 179<div class="informaltable"><table class="table"> 180<colgroup> 181<col> 182<col> 183<col> 184<col> 185<col> 186<col> 187<col> 188<col> 189<col> 190<col> 191<col> 192</colgroup> 193<thead><tr> 194<th> 195 </th> 196<th> 197 <p> 198 Point 199 </p> 200 </th> 201<th> 202 <p> 203 Segment 204 </p> 205 </th> 206<th> 207 <p> 208 Box 209 </p> 210 </th> 211<th> 212 <p> 213 Linestring 214 </p> 215 </th> 216<th> 217 <p> 218 Ring 219 </p> 220 </th> 221<th> 222 <p> 223 Polygon 224 </p> 225 </th> 226<th> 227 <p> 228 MultiPoint 229 </p> 230 </th> 231<th> 232 <p> 233 MultiLinestring 234 </p> 235 </th> 236<th> 237 <p> 238 MultiPolygon 239 </p> 240 </th> 241<th> 242 <p> 243 Variant 244 </p> 245 </th> 246</tr></thead> 247<tbody> 248<tr> 249<td> 250 <p> 251 Point 252 </p> 253 </td> 254<td> 255 <p> 256 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 257 </p> 258 </td> 259<td> 260 <p> 261 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 262 </p> 263 </td> 264<td> 265 <p> 266 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 267 </p> 268 </td> 269<td> 270 <p> 271 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 272 </p> 273 </td> 274<td> 275 <p> 276 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 277 </p> 278 </td> 279<td> 280 <p> 281 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 282 </p> 283 </td> 284<td> 285 <p> 286 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 287 </p> 288 </td> 289<td> 290 <p> 291 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 292 </p> 293 </td> 294<td> 295 <p> 296 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 297 </p> 298 </td> 299<td> 300 <p> 301 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 302 </p> 303 </td> 304</tr> 305<tr> 306<td> 307 <p> 308 Segment 309 </p> 310 </td> 311<td> 312 <p> 313 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 314 </p> 315 </td> 316<td> 317 <p> 318 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 319 </p> 320 </td> 321<td> 322 <p> 323 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 324 </p> 325 </td> 326<td> 327 <p> 328 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 329 </p> 330 </td> 331<td> 332 <p> 333 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 334 </p> 335 </td> 336<td> 337 <p> 338 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 339 </p> 340 </td> 341<td> 342 <p> 343 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 344 </p> 345 </td> 346<td> 347 <p> 348 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 349 </p> 350 </td> 351<td> 352 <p> 353 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 354 </p> 355 </td> 356<td> 357 <p> 358 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 359 </p> 360 </td> 361</tr> 362<tr> 363<td> 364 <p> 365 Box 366 </p> 367 </td> 368<td> 369 <p> 370 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 371 </p> 372 </td> 373<td> 374 <p> 375 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 376 </p> 377 </td> 378<td> 379 <p> 380 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 381 </p> 382 </td> 383<td> 384 <p> 385 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 386 </p> 387 </td> 388<td> 389 <p> 390 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 391 </p> 392 </td> 393<td> 394 <p> 395 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 396 </p> 397 </td> 398<td> 399 <p> 400 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 401 </p> 402 </td> 403<td> 404 <p> 405 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 406 </p> 407 </td> 408<td> 409 <p> 410 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 411 </p> 412 </td> 413<td> 414 <p> 415 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 416 </p> 417 </td> 418</tr> 419<tr> 420<td> 421 <p> 422 Linestring 423 </p> 424 </td> 425<td> 426 <p> 427 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 428 </p> 429 </td> 430<td> 431 <p> 432 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 433 </p> 434 </td> 435<td> 436 <p> 437 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 438 </p> 439 </td> 440<td> 441 <p> 442 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 443 </p> 444 </td> 445<td> 446 <p> 447 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 448 </p> 449 </td> 450<td> 451 <p> 452 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 453 </p> 454 </td> 455<td> 456 <p> 457 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 458 </p> 459 </td> 460<td> 461 <p> 462 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 463 </p> 464 </td> 465<td> 466 <p> 467 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 468 </p> 469 </td> 470<td> 471 <p> 472 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 473 </p> 474 </td> 475</tr> 476<tr> 477<td> 478 <p> 479 Ring 480 </p> 481 </td> 482<td> 483 <p> 484 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 485 </p> 486 </td> 487<td> 488 <p> 489 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 490 </p> 491 </td> 492<td> 493 <p> 494 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 495 </p> 496 </td> 497<td> 498 <p> 499 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 500 </p> 501 </td> 502<td> 503 <p> 504 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 505 </p> 506 </td> 507<td> 508 <p> 509 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 510 </p> 511 </td> 512<td> 513 <p> 514 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 515 </p> 516 </td> 517<td> 518 <p> 519 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 520 </p> 521 </td> 522<td> 523 <p> 524 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 525 </p> 526 </td> 527<td> 528 <p> 529 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 530 </p> 531 </td> 532</tr> 533<tr> 534<td> 535 <p> 536 Polygon 537 </p> 538 </td> 539<td> 540 <p> 541 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 542 </p> 543 </td> 544<td> 545 <p> 546 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 547 </p> 548 </td> 549<td> 550 <p> 551 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 552 </p> 553 </td> 554<td> 555 <p> 556 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 557 </p> 558 </td> 559<td> 560 <p> 561 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 562 </p> 563 </td> 564<td> 565 <p> 566 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 567 </p> 568 </td> 569<td> 570 <p> 571 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 572 </p> 573 </td> 574<td> 575 <p> 576 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 577 </p> 578 </td> 579<td> 580 <p> 581 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 582 </p> 583 </td> 584<td> 585 <p> 586 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 587 </p> 588 </td> 589</tr> 590<tr> 591<td> 592 <p> 593 MultiPoint 594 </p> 595 </td> 596<td> 597 <p> 598 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 599 </p> 600 </td> 601<td> 602 <p> 603 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 604 </p> 605 </td> 606<td> 607 <p> 608 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 609 </p> 610 </td> 611<td> 612 <p> 613 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 614 </p> 615 </td> 616<td> 617 <p> 618 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 619 </p> 620 </td> 621<td> 622 <p> 623 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 624 </p> 625 </td> 626<td> 627 <p> 628 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 629 </p> 630 </td> 631<td> 632 <p> 633 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 634 </p> 635 </td> 636<td> 637 <p> 638 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 639 </p> 640 </td> 641<td> 642 <p> 643 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 644 </p> 645 </td> 646</tr> 647<tr> 648<td> 649 <p> 650 MultiLinestring 651 </p> 652 </td> 653<td> 654 <p> 655 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 656 </p> 657 </td> 658<td> 659 <p> 660 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 661 </p> 662 </td> 663<td> 664 <p> 665 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 666 </p> 667 </td> 668<td> 669 <p> 670 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 671 </p> 672 </td> 673<td> 674 <p> 675 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 676 </p> 677 </td> 678<td> 679 <p> 680 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 681 </p> 682 </td> 683<td> 684 <p> 685 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 686 </p> 687 </td> 688<td> 689 <p> 690 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 691 </p> 692 </td> 693<td> 694 <p> 695 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 696 </p> 697 </td> 698<td> 699 <p> 700 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 701 </p> 702 </td> 703</tr> 704<tr> 705<td> 706 <p> 707 MultiPolygon 708 </p> 709 </td> 710<td> 711 <p> 712 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 713 </p> 714 </td> 715<td> 716 <p> 717 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 718 </p> 719 </td> 720<td> 721 <p> 722 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 723 </p> 724 </td> 725<td> 726 <p> 727 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 728 </p> 729 </td> 730<td> 731 <p> 732 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 733 </p> 734 </td> 735<td> 736 <p> 737 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 738 </p> 739 </td> 740<td> 741 <p> 742 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 743 </p> 744 </td> 745<td> 746 <p> 747 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 748 </p> 749 </td> 750<td> 751 <p> 752 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 753 </p> 754 </td> 755<td> 756 <p> 757 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 758 </p> 759 </td> 760</tr> 761<tr> 762<td> 763 <p> 764 Variant 765 </p> 766 </td> 767<td> 768 <p> 769 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 770 </p> 771 </td> 772<td> 773 <p> 774 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 775 </p> 776 </td> 777<td> 778 <p> 779 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 780 </p> 781 </td> 782<td> 783 <p> 784 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 785 </p> 786 </td> 787<td> 788 <p> 789 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 790 </p> 791 </td> 792<td> 793 <p> 794 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 795 </p> 796 </td> 797<td> 798 <p> 799 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 800 </p> 801 </td> 802<td> 803 <p> 804 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 805 </p> 806 </td> 807<td> 808 <p> 809 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 810 </p> 811 </td> 812<td> 813 <p> 814 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 815 </p> 816 </td> 817</tr> 818</tbody> 819</table></div> 820<div class="note"><table border="0" summary="Note"> 821<tr> 822<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td> 823<th align="left">Note</th> 824</tr> 825<tr><td align="left" valign="top"><p> 826 In this status matrix above: columns are types of first parameter and 827 rows are types of second parameter. So a point can be checked to be 828 within a polygon, but not vice versa. 829 </p></td></tr> 830</table></div> 831<h6> 832<a name="geometry.reference.algorithms.within.within_2.h7"></a> 833 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.notes"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.notes">Notes</a> 834 </h6> 835<p> 836 If a point is located exactly on the border of a geometry, the result 837 depends on the strategy. The default strategy (<a class="link" href="../../strategies/strategy_within_winding.html" title="strategy::within::winding">Winding 838 (coordinate system agnostic)</a>) returns false in that case. 839 </p> 840<p> 841 If a polygon has a reverse oriented (e.g. counterclockwise for a clockwise 842 typed polygon), the result also depends on the strategy. The default 843 strategy returns still true if a point is completely within the reversed 844 polygon. There is a specific strategy which returns false in this case. 845 </p> 846<h6> 847<a name="geometry.reference.algorithms.within.within_2.h8"></a> 848 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.complexity"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.complexity">Complexity</a> 849 </h6> 850<p> 851 Linear 852 </p> 853<h6> 854<a name="geometry.reference.algorithms.within.within_2.h9"></a> 855 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.see_also"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.see_also">See 856 also</a> 857 </h6> 858<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 859 <a class="link" href="../covered_by.html" title="covered_by">covered_by</a> 860 </li></ul></div> 861<h6> 862<a name="geometry.reference.algorithms.within.within_2.h10"></a> 863 <span class="phrase"><a name="geometry.reference.algorithms.within.within_2.example"></a></span><a class="link" href="within_2.html#geometry.reference.algorithms.within.within_2.example">Example</a> 864 </h6> 865<p> 866 Shows how to detect if a point is inside a polygon, or not 867 </p> 868<p> 869</p> 870<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> 871<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">list</span><span class="special">></span> 872 873<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 874<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 875<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 876 877 878<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> 879<span class="special">{</span> 880 <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">point_type</span><span class="special">;</span> 881 <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">polygon</span><span class="special"><</span><span class="identifier">point_type</span><span class="special">></span> <span class="identifier">polygon_type</span><span class="special">;</span> 882 883 <span class="identifier">polygon_type</span> <span class="identifier">poly</span><span class="special">;</span> 884 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span> 885 <span class="string">"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"</span> 886 <span class="string">"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))"</span><span class="special">,</span> <span class="identifier">poly</span><span class="special">);</span> 887 888 <span class="identifier">point_type</span> <span class="identifier">p</span><span class="special">(</span><span class="number">4</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> 889 890 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"within: "</span> <span class="special"><<</span> <span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">within</span><span class="special">(</span><span class="identifier">p</span><span class="special">,</span> <span class="identifier">poly</span><span class="special">)</span> <span class="special">?</span> <span class="string">"yes"</span> <span class="special">:</span> <span class="string">"no"</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 891 892 <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> 893<span class="special">}</span> 894</pre> 895<p> 896 </p> 897<p> 898 Output: 899 </p> 900<pre class="programlisting">within: yes 901 902<img src="../../../../img/algorithms/within.png" alt="within"> 903</pre> 904</div> 905<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 906<td align="left"></td> 907<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 908 Wulkiewicz, Oracle and/or its affiliates<p> 909 Distributed under the Boost Software License, Version 1.0. (See accompanying 910 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 911 </p> 912</div></td> 913</tr></table> 914<hr> 915<div class="spirit-nav"> 916<a accesskey="p" href="../within.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../within.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="within_3_with_strategy.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 917</div> 918</body> 919</html> 920