| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

Classes | Typedefs | Functions
Intersection Algorithms

## Classes

struct | TeINTERSECTOR2::TeBoundaryIP
| This struct is used to represent a point intersection between two segments on boundary of a TePolygon or TeLine2D. More...
struct | TeINTERSECTOR2::TeSegIdInPolygonSet
| This struct represents an index to the right place of a segment in a TeLineSet, TeLine2D, TePolygon or TePolygonSet. More...

## Typedefs

typedef vector< TeBoundaryIP > | TeINTERSECTOR2::TeVectorBoundaryIP
| This is the type of intersection point list.
typedef pair < TeSegIdInPolygonSet, TeSegIdInPolygonSet > | TeINTERSECTOR2::TePairSegIdInPolygonSet
| This pair is used to index two segments that intersects.
typedef TeSAM::TeRTree < TeSegIdInPolygonSet, 8 > | TeINTERSECTOR2::TeSegmentRTree
| This is the type used to index the segments in the boundary of a TeLine2D, TeLineSet, TePolygon or TePolygonSet.

## Functions

TL_DLL short | TeINTERSECTOR2::TeCCW (const TeCoord2D &c1, const TeCoord2D &c2, const TeCoord2D &c3, bool &between)
| Tells if three points makes a right turn, a left turn or are collinear.
TL_DLL bool | TeINTERSECTOR2::TeIntersection (const TeCoord2D &a, const TeCoord2D &b, const TeCoord2D &c, const TeCoord2D &d, TeBoundaryIP &ips, TeSegmentIntersectionType &intersectionType)
| Returns the intersection point of the segments.
TL_DLL bool | TeINTERSECTOR2::TeIntersects (const TeCoord2D &a, const TeCoord2D &b, const TeCoord2D &c, const TeCoord2D &d, TeSegmentIntersectionType &intersectionType)
| Tells if two segments intersects.
TL_DLL bool | TeINTERSECTOR2::TeSafeIntersections (const TePolygonSet &redPols, const TePolygonSet &bluePols, TeVectorBoundaryIP &report)
| Verifies if there is an intersection between two given polygonsets.
TL_DLL bool | TeINTERSECTOR2::TeSafeIntersections (const TeLine2D &redLine, const TeLine2D &blueLine, TeVectorBoundaryIP &report, const unsigned int &redObjId=0, const unsigned int &blueObjId=0)
| Verifies if there is an intersection between two given lines.
TL_DLL bool | TeINTERSECTOR2::TeIntersects (const TeLine2D &redLine, const TeLine2D &blueLine)
| Returns true if the lines intersects.
TL_DLL bool | TeINTERSECTOR2::TeIntersection (const TePolygonSet &polygons, TeSegmentRTree &tree, TeVectorBoundaryIP &report)
| Reports intersections between segments of polygons in the polygonset list.
TL_DLL bool | TeINTERSECTOR2::TeIntersection (const TePolygonSet &redPolygons, TeSegmentRTree &redTree, const TePolygonSet &bluePolygons, TeINTERSECTOR2::TeVectorBoundaryIP &report)
| Reports intersections between segments of two diferent polygonsets.
TL_DLL bool | TeINTERSECTOR2::TeIntersection (const TeLineSet &redLines, const TePolygonSet &bluePolygons, TeSegmentRTree &blueTree, TeINTERSECTOR2::TeVectorBoundaryIP &report)
| Reports intersections between segments of a lineset and a polygonset.
TL_DLL bool | TeINTERSECTOR2::TeIsSimple (const TePolygonSet &polygons, vector< TePairSegIdInPolygonSet > &selfIntersectionList)
| Tells if there is a self-intersection between segments.
TL_DLL void | TeINTERSECTOR2::TeIndexPolygonSet (const TePolygonSet &polygons, TeSegmentRTree &tree)
| Index polygon's segments.

## Detailed Description

Intersection Algorithms and data structures, used internally.

## Typedef Documentation

typedef pair<TeSegIdInPolygonSet, TeSegIdInPolygonSet> TeINTERSECTOR2::TePairSegIdInPolygonSet

This pair is used to index two segments that intersects.

typedef TeSAM::TeRTree<TeSegIdInPolygonSet, 8> TeINTERSECTOR2::TeSegmentRTree

This is the type used to index the segments in the boundary of a TeLine2D, TeLineSet, TePolygon or TePolygonSet.

typedef vector<TeBoundaryIP> TeINTERSECTOR2::TeVectorBoundaryIP

This is the type of intersection point list.

## Function Documentation

short TeINTERSECTOR2::TeCCW | ( | const TeCoord2D & | c1,
|  | const TeCoord2D & | c2,
|  | const TeCoord2D & | c3,
|  | bool & | between
| ) |  |

Tells if three points makes a right turn, a left turn or are collinear.

Parameters:

  c1 | The first coordinate.
  c2 | The second coordinate.
  c3 | The coordinate to test the relative position.
  between | Tells if c3 is between c1 and c2.

Returns:
  The orientation: TeCLOCKWISE, TeCOUNTERCLOCKWISE or TeNOTURN.

void TeINTERSECTOR2::TeIndexPolygonSet | ( | const TePolygonSet & | polygons,
|  | TeINTERSECTOR2::TeSegmentRTree & | tree
| ) |  |

Index polygon's segments.

Parameters:

  polygons | A list of polygons to index it segment's.
  tree | The tree if indexed segments.

bool TeINTERSECTOR2::TeIntersection | ( | const TePolygonSet & | redPolygons,
|  | TeINTERSECTOR2::TeSegmentRTree & | redTree,
|  | const TePolygonSet & | bluePolygons,
|  | TeINTERSECTOR2::TeVectorBoundaryIP & | report
| ) |  |

Reports intersections between segments of two diferent polygonsets.

Parameters:

  redPolygons | A list of polygons without self intersections.
  redTree | A tree with all red segment already indexed or not, if it is empty, so, it will be filled inside this method.
  bluePolygons | A list of polygons without self intersections.
  report | A report list of intersection points.

Returns:
  Returns true if there is an intersection between a red segment and a blue segment.

Note:
  This function will not returns intersections between segments of the same polygon. It will only report intersection between different polygons. The result may have duplicated points because intersections are reported twice: this will turn fragmentation easier.

bool TeINTERSECTOR2::TeIntersection | ( | const TeLineSet & | redLines,
|  | const TePolygonSet & | bluePolygons,
|  | TeSegmentRTree & | blueTree,
|  | TeINTERSECTOR2::TeVectorBoundaryIP & | report
| ) |  |

Reports intersections between segments of a lineset and a polygonset.

Parameters:

  redLines | A list of lines without self intersections.
  bluePolygons | A list of polygons without self intersections.
  blueTree | A tree with all segments from the polygonset already indexed or not, if it is empty, so, it will be filled inside this method.
  report | A report list of intersection points.

Returns:
  Returns true if there is an intersection between a red segment from the lineset and a blue segment from the polygonset.

Note:
  This function will not returns intersections between segments of the same polygon or lineset. It will only report intersection between segments from different sets.

bool TeINTERSECTOR2::TeIntersection | ( | const TeCoord2D & | a,
|  | const TeCoord2D & | b,
|  | const TeCoord2D & | c,
|  | const TeCoord2D & | d,
|  | TeBoundaryIP & | ips,
|  | TeSegmentIntersectionType & | intersectionType
| ) |  |

Returns the intersection point of the segments.

Parameters:

  a | The first coordinate of the first segment.
  b | The second coordinate of the first segment.
  c | The first coordinate of the second segment.
  d | The second coordinate of the second segment.
  ips | The intersection coordinates (0, 1 or 2).
  intersectionType | An intersection may be proper or improper.

Returns:
  Returns true if there is an intersection between segments defined by end coordinates.

bool TeINTERSECTOR2::TeIntersection | ( | const TePolygonSet & | polygons,
|  | TeINTERSECTOR2::TeSegmentRTree & | tree,
|  | TeINTERSECTOR2::TeVectorBoundaryIP & | report
| ) |  |

Reports intersections between segments of polygons in the polygonset list.

Parameters:

  polygons | A list of polygons to test self intersections.
  tree | The tree with all index segments, it WILL BE filled inside this method.
  report | A report list of intersection points.

Returns:
  Returns true if there is an intersection.

Note:
  This function will not returns intersections between segments of the same polygon. It will only report intersection between different polygons. The index tree MUST BE EMPTY, othewise, the result is undefined. The result may have duplicated points because intersections are reported twice: this will turn fragmentation easier.

bool TeINTERSECTOR2::TeIntersects | ( | const TeLine2D & | redLine,
|  | const TeLine2D & | blueLine
| ) |  |

Returns true if the lines intersects.

Parameters:

  redLine | The line to test.
  blueLine | The line to test.

Returns:
  Returns true if there is an intersection between segments of the lines.

Note:
  WARNING: this is deprecated and will be replaced by another function in near future.

bool TeINTERSECTOR2::TeIntersects | ( | const TeCoord2D & | a,
|  | const TeCoord2D & | b,
|  | const TeCoord2D & | c,
|  | const TeCoord2D & | d,
|  | TeSegmentIntersectionType & | intersectionType
| ) |  |

Tells if two segments intersects.

Parameters:

  a | The first coordinate of the first segment.
  b | The second coordinate of the first segment.
  c | The first coordinate of the second segment.
  d | The second coordinate of the second segment.
  intersectionType | An intersection may be proper or improper.

Returns:
  Returns true if there is an intersection between segments defined by end coordinates.

bool TeINTERSECTOR2::TeIsSimple | ( | const TePolygonSet & | polygons,
|  | vector< TePairSegIdInPolygonSet > & | selfIntersectionList
| ) |  |

Tells if there is a self-intersection between segments.

Parameters:

  polygons | A list of polygons to test self intersections.
  selfIntersectionList | A report list with all self-intersections.

Returns:
  Returns true if there is not a self-intersection.

bool TeINTERSECTOR2::TeSafeIntersections | ( | const TeLine2D & | redLine,
|  | const TeLine2D & | blueLine,
|  | TeVectorBoundaryIP & | report,
|  | const unsigned int & | redObjId = `0`,
|  | const unsigned int & | blueObjId = `0`
| ) |  |

Verifies if there is an intersection between two given lines.

Parameters:

  redLine | The first line to test.
  blueLine | The second line to test.
  report | A list with the intersection points.
  redObjId | Red line object id.
  blueObjId | Blue line object id.

Returns:
  Returns true if there is an intersection between segments of the lines.

Note:
  WARNING: this is deprecated and will be replaced by another function in near future.

This is a lazy algorithm. It can be used, for example, in intersections between a box and a line. It is O(n*m) - where n and m are the numbers of segments in the first and second lines.

bool TeINTERSECTOR2::TeSafeIntersections | ( | const TePolygonSet & | redPols,
|  | const TePolygonSet & | bluePols,
|  | TeVectorBoundaryIP & | report
| ) |  |

Verifies if there is an intersection between two given polygonsets.

Parameters:

  redPols | The first polygonset to test.
  bluePols | The second polygonset to test.
  report | A list with the intersection points.

Returns:
  Returns true if there is an intersection between segments of the polygons.

Note:
  WARNING: this is deprecated and will be replaced by another function in near future.

This is a lazy algorithm. It can be used, for example, in intersections between a box and a line. It is O(n*m) - where n and m are the numbers of segments in the first and second polygonsets.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines