1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>crosses</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="../crosses.html" title="crosses"> 9<link rel="prev" href="crosses_3_with_strategy.html" title="crosses (with strategy)"> 10<link rel="next" href="../densify.html" title="densify"> 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="crosses_3_with_strategy.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../crosses.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="../densify.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.crosses.crosses_2"></a><a class="link" href="crosses_2.html" title="crosses">crosses</a> 28</h5></div></div></div> 29<p> 30 <a class="indexterm" name="idm45635702429632"></a> 31Checks if two geometries crosses. 32 </p> 33<h6> 34<a name="geometry.reference.algorithms.crosses.crosses_2.h0"></a> 35 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.synopsis"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.synopsis">Synopsis</a> 36 </h6> 37<p> 38</p> 39<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> 40<span class="keyword">bool</span> <span class="identifier">crosses</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> 41<p> 42 </p> 43<h6> 44<a name="geometry.reference.algorithms.crosses.crosses_2.h1"></a> 45 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.parameters"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.parameters">Parameters</a> 46 </h6> 47<div class="informaltable"><table class="table"> 48<colgroup> 49<col> 50<col> 51<col> 52<col> 53</colgroup> 54<thead><tr> 55<th> 56 <p> 57 Type 58 </p> 59 </th> 60<th> 61 <p> 62 Concept 63 </p> 64 </th> 65<th> 66 <p> 67 Name 68 </p> 69 </th> 70<th> 71 <p> 72 Description 73 </p> 74 </th> 75</tr></thead> 76<tbody> 77<tr> 78<td> 79 <p> 80 Geometry1 const & 81 </p> 82 </td> 83<td> 84 <p> 85 Any type fulfilling a Geometry Concept 86 </p> 87 </td> 88<td> 89 <p> 90 geometry1 91 </p> 92 </td> 93<td> 94 <p> 95 A model of the specified concept 96 </p> 97 </td> 98</tr> 99<tr> 100<td> 101 <p> 102 Geometry2 const & 103 </p> 104 </td> 105<td> 106 <p> 107 Any type fulfilling a Geometry Concept 108 </p> 109 </td> 110<td> 111 <p> 112 geometry2 113 </p> 114 </td> 115<td> 116 <p> 117 A model of the specified concept 118 </p> 119 </td> 120</tr> 121</tbody> 122</table></div> 123<h6> 124<a name="geometry.reference.algorithms.crosses.crosses_2.h2"></a> 125 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.returns"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.returns">Returns</a> 126 </h6> 127<p> 128 Returns true if two geometries crosses 129 </p> 130<h6> 131<a name="geometry.reference.algorithms.crosses.crosses_2.h3"></a> 132 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.header"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.header">Header</a> 133 </h6> 134<p> 135 Either 136 </p> 137<p> 138 <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> 139 </p> 140<p> 141 Or 142 </p> 143<p> 144 <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">crosses</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 145 </p> 146<h6> 147<a name="geometry.reference.algorithms.crosses.crosses_2.h4"></a> 148 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.conformance"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.conformance">Conformance</a> 149 </h6> 150<p> 151 The function crosses implements function Crosses from the <a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC 152 Simple Feature Specification</a>. 153 </p> 154<h6> 155<a name="geometry.reference.algorithms.crosses.crosses_2.h5"></a> 156 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.supported_geometries"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.supported_geometries">Supported 157 geometries</a> 158 </h6> 159<div class="informaltable"><table class="table"> 160<colgroup> 161<col> 162<col> 163<col> 164<col> 165<col> 166<col> 167<col> 168<col> 169<col> 170<col> 171<col> 172</colgroup> 173<thead><tr> 174<th> 175 </th> 176<th> 177 <p> 178 Point 179 </p> 180 </th> 181<th> 182 <p> 183 Segment 184 </p> 185 </th> 186<th> 187 <p> 188 Box 189 </p> 190 </th> 191<th> 192 <p> 193 Linestring 194 </p> 195 </th> 196<th> 197 <p> 198 Ring 199 </p> 200 </th> 201<th> 202 <p> 203 Polygon 204 </p> 205 </th> 206<th> 207 <p> 208 MultiPoint 209 </p> 210 </th> 211<th> 212 <p> 213 MultiLinestring 214 </p> 215 </th> 216<th> 217 <p> 218 MultiPolygon 219 </p> 220 </th> 221<th> 222 <p> 223 Variant 224 </p> 225 </th> 226</tr></thead> 227<tbody> 228<tr> 229<td> 230 <p> 231 Point 232 </p> 233 </td> 234<td> 235 <p> 236 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 237 </p> 238 </td> 239<td> 240 <p> 241 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 242 </p> 243 </td> 244<td> 245 <p> 246 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 247 </p> 248 </td> 249<td> 250 <p> 251 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 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/ok.png" alt="ok"></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/ok.png" alt="ok"></span> 272 </p> 273 </td> 274<td> 275 <p> 276 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 277 </p> 278 </td> 279<td> 280 <p> 281 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 282 </p> 283 </td> 284</tr> 285<tr> 286<td> 287 <p> 288 Segment 289 </p> 290 </td> 291<td> 292 <p> 293 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 294 </p> 295 </td> 296<td> 297 <p> 298 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 299 </p> 300 </td> 301<td> 302 <p> 303 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 304 </p> 305 </td> 306<td> 307 <p> 308 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 309 </p> 310 </td> 311<td> 312 <p> 313 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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</tr> 342<tr> 343<td> 344 <p> 345 Box 346 </p> 347 </td> 348<td> 349 <p> 350 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 351 </p> 352 </td> 353<td> 354 <p> 355 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 356 </p> 357 </td> 358<td> 359 <p> 360 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 361 </p> 362 </td> 363<td> 364 <p> 365 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 366 </p> 367 </td> 368<td> 369 <p> 370 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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/nyi.png" alt="nyi"></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</tr> 399<tr> 400<td> 401 <p> 402 Linestring 403 </p> 404 </td> 405<td> 406 <p> 407 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 408 </p> 409 </td> 410<td> 411 <p> 412 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 413 </p> 414 </td> 415<td> 416 <p> 417 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 418 </p> 419 </td> 420<td> 421 <p> 422 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 423 </p> 424 </td> 425<td> 426 <p> 427 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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</tr> 456<tr> 457<td> 458 <p> 459 Ring 460 </p> 461 </td> 462<td> 463 <p> 464 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 465 </p> 466 </td> 467<td> 468 <p> 469 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 470 </p> 471 </td> 472<td> 473 <p> 474 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 475 </p> 476 </td> 477<td> 478 <p> 479 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 480 </p> 481 </td> 482<td> 483 <p> 484 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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/nyi.png" alt="nyi"></span> 505 </p> 506 </td> 507<td> 508 <p> 509 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 510 </p> 511 </td> 512</tr> 513<tr> 514<td> 515 <p> 516 Polygon 517 </p> 518 </td> 519<td> 520 <p> 521 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 522 </p> 523 </td> 524<td> 525 <p> 526 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 527 </p> 528 </td> 529<td> 530 <p> 531 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 532 </p> 533 </td> 534<td> 535 <p> 536 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 537 </p> 538 </td> 539<td> 540 <p> 541 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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/nyi.png" alt="nyi"></span> 562 </p> 563 </td> 564<td> 565 <p> 566 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 567 </p> 568 </td> 569</tr> 570<tr> 571<td> 572 <p> 573 MultiPoint 574 </p> 575 </td> 576<td> 577 <p> 578 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 579 </p> 580 </td> 581<td> 582 <p> 583 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 584 </p> 585 </td> 586<td> 587 <p> 588 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 589 </p> 590 </td> 591<td> 592 <p> 593 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 594 </p> 595 </td> 596<td> 597 <p> 598 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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</tr> 627<tr> 628<td> 629 <p> 630 MultiLinestring 631 </p> 632 </td> 633<td> 634 <p> 635 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 636 </p> 637 </td> 638<td> 639 <p> 640 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 641 </p> 642 </td> 643<td> 644 <p> 645 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 646 </p> 647 </td> 648<td> 649 <p> 650 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 651 </p> 652 </td> 653<td> 654 <p> 655 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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</tr> 684<tr> 685<td> 686 <p> 687 MultiPolygon 688 </p> 689 </td> 690<td> 691 <p> 692 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 693 </p> 694 </td> 695<td> 696 <p> 697 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 698 </p> 699 </td> 700<td> 701 <p> 702 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 703 </p> 704 </td> 705<td> 706 <p> 707 <span class="inlinemediaobject"><img src="../../../../img/ok.png" alt="ok"></span> 708 </p> 709 </td> 710<td> 711 <p> 712 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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/nyi.png" alt="nyi"></span> 733 </p> 734 </td> 735<td> 736 <p> 737 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 738 </p> 739 </td> 740</tr> 741<tr> 742<td> 743 <p> 744 Variant 745 </p> 746 </td> 747<td> 748 <p> 749 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 750 </p> 751 </td> 752<td> 753 <p> 754 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 755 </p> 756 </td> 757<td> 758 <p> 759 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 760 </p> 761 </td> 762<td> 763 <p> 764 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></span> 765 </p> 766 </td> 767<td> 768 <p> 769 <span class="inlinemediaobject"><img src="../../../../img/nyi.png" alt="nyi"></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</tr> 798</tbody> 799</table></div> 800<h6> 801<a name="geometry.reference.algorithms.crosses.crosses_2.h6"></a> 802 <span class="phrase"><a name="geometry.reference.algorithms.crosses.crosses_2.examples"></a></span><a class="link" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.examples">Examples</a> 803 </h6> 804<p> 805 Checks if two geometries crosses 806 </p> 807<p> 808</p> 809<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> 810 811<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> 812<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> 813<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> 814 815<span class="keyword">namespace</span> <span class="identifier">bg</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">;</span> <a class="co" name="geometry.reference.algorithms.crosses.crosses_2.c0" href="crosses_2.html#geometry.reference.algorithms.crosses.crosses_2.c1"><img src="../../../../../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a> 816 817<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> 818<span class="special">{</span> 819 <span class="comment">// Checks if the two geometries (here, a polygon and a linestring) crosses or not. </span> 820 <span class="identifier">bg</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">bg</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="special">></span> <span class="identifier">poly</span><span class="special">;</span> 821 <span class="identifier">bg</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"POLYGON((0 0,0 3,3 3,3 0,0 0))"</span><span class="special">,</span> <span class="identifier">poly</span><span class="special">);</span> 822 <span class="identifier">bg</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">linestring</span><span class="special"><</span><span class="identifier">bg</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="special">></span> <span class="identifier">line1</span><span class="special">;</span> 823 <span class="identifier">bg</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"LINESTRING(1 1,2 2,4 4)"</span><span class="special">,</span> <span class="identifier">line1</span><span class="special">);</span> 824 <span class="keyword">bool</span> <span class="identifier">check_crosses</span> <span class="special">=</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">crosses</span><span class="special">(</span><span class="identifier">poly</span><span class="special">,</span> <span class="identifier">line1</span><span class="special">);</span> 825 <span class="keyword">if</span> <span class="special">(</span><span class="identifier">check_crosses</span><span class="special">)</span> <span class="special">{</span> 826 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Crosses: Yes"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 827 <span class="special">}</span> <span class="keyword">else</span> <span class="special">{</span> 828 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Crosses: No"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 829 <span class="special">}</span> 830 831 <span class="comment">// Edge case: linestring just touches the polygon but doesn't crosses it.</span> 832 <span class="identifier">bg</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">linestring</span><span class="special"><</span><span class="identifier">bg</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="special">></span> <span class="identifier">line2</span><span class="special">;</span> 833 <span class="identifier">bg</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"LINESTRING(1 1,1 2,1 3)"</span><span class="special">,</span> <span class="identifier">line2</span><span class="special">);</span> 834 <span class="identifier">check_crosses</span> <span class="special">=</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">crosses</span><span class="special">(</span><span class="identifier">poly</span><span class="special">,</span> <span class="identifier">line2</span><span class="special">);</span> 835 <span class="keyword">if</span> <span class="special">(</span><span class="identifier">check_crosses</span><span class="special">)</span> <span class="special">{</span> 836 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Crosses: Yes"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 837 <span class="special">}</span> <span class="keyword">else</span> <span class="special">{</span> 838 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Crosses: No"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> 839 <span class="special">}</span> 840 841 <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> 842<span class="special">}</span> 843</pre> 844<p> 845 </p> 846<div class="calloutlist"><table border="0" summary="Callout list"><tr> 847<td width="5%" valign="top" align="left"><p><a name="geometry.reference.algorithms.crosses.crosses_2.c1"></a><a href="#geometry.reference.algorithms.crosses.crosses_2.c0"><img src="../../../../../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a> </p></td> 848<td valign="top" align="left"><p> 849 Convenient namespace alias 850 </p></td> 851</tr></table></div> 852<p> 853 Output: 854 </p> 855<pre class="programlisting">Crosses: Yes 856Crosses: No 857 858<img src="../../../../img/algorithms/crosses.png" alt="crosses"> 859 860</pre> 861</div> 862<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 863<td align="left"></td> 864<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 865 Wulkiewicz, Oracle and/or its affiliates<p> 866 Distributed under the Boost Software License, Version 1.0. (See accompanying 867 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>) 868 </p> 869</div></td> 870</tr></table> 871<hr> 872<div class="spirit-nav"> 873<a accesskey="p" href="crosses_3_with_strategy.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../crosses.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="../densify.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 874</div> 875</body> 876</html> 877