| TerraLib 4.1

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

- File List
- File Members

Classes | Functions
E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeGeometryAlgorithms.cpp File Reference
`#include "TeAssertions.h"`
`#include "TeGeometryAlgorithms.h"`
`#include "TeDefines.h"`
`#include "TeIntersector.h"`
`#include "TeFragmentation.h"`
`#include <algorithm>`
`#include <iterator>`
`#include <set>`

## Classes

struct | ThetaOrder
| This struct is used for compare angles between two points and an anchor. More...
struct | xOrder< T >
| Returns true if c1 < c2 otherwise, returns false. More...

## Functions

double | Theta (const TeCoord2D &c1, const TeCoord2D &c2)
| Instead of using arctan, use this to compare angles, so given two points return a number to be used in place of the angle formed by the segment.
double | Te2Area (const TeLinearRing &r)
short | ConverseRelation (const short &rel)
bool | MayTouches (const TeLine2D &lRed, const TeLine2D &lBlue, TeINTERSECTOR2::TeVectorBoundaryIP &report)
short | Relation (const TeLine2D &lRed, const TeLine2D &lBlue, TeINTERSECTOR2::TeVectorBoundaryIP &report, const short &relation)
short | Relation (const TeLine2D &line, const TeLinearRing &ring)
short | TopologicRelation (const TeLine2D &line, const TeLinearRing &r)
| This function returns the relation between a line and a linear ring (treated as a simple polygon with no holes).
short | TopologicRelation (const TeLinearRing &rRed, const TeLinearRing &rBlue)
| This function returns the relationship between two rings (treated as simple polygons with no holes).
short | LookAtInnerRings (const TeLinearRing &rRed, const TePolygon &pBlue, vector< TeLinearRing > &rings, short &rel)
short | TestInnerRings (const TePolygon &pRed, vector< TeLinearRing > &rings)
| This function returns the relationship between the ring and the polygon inner rings.
template<>
bool | TeEquals (const TeCoord2D &c1, const TeCoord2D &c2)
| Check if coordinate 1 and coordinate 2 are equal.
template<>
bool | TeEquals (const TePoint &p1, const TePoint &p2)
| Check if point 1 and point 2 are equal.
template<>
bool | TeEquals (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if lineRed and lineBlue are equal.
template<>
bool | TeEquals (const TePolygon &redPol, const TePolygon &bluePol)
| Check if polygon red and polygon blue are equal.
template<>
bool | TeEquals (const TePolygonSet &ps1, const TePolygonSet &ps2)
| Check if polygonset1 and polygonset1 are equal.
template<>
bool | TeEquals (const TeBox &bx1, const TeBox &bx2)
| Check if box 1 and box 2 are equal.
template<>
bool | TeEquals (const TeCell &cell1, const TeCell &cell2)
| Check if cell 1 and cell 2 are equal.
bool | TeDisjoint (const TeCoord2D &c1, const TeCoord2D &c2)
| Check if coordinate cl and coordinate c2 are disjoint.
bool | TeDisjoint (const TeCoord2D &c, const TeBox &b)
| Check if coordinate and box are disjoint.
bool | TeDisjoint (const TeBox &bx1, const TeBox &bx2)
| Check if box 1 and box 2 are disjoint.
bool | TeDisjoint (const TeCoord2D &c, const TeLine2D &l)
| Check if coordinate and line are disjoint.
bool | TeDisjoint (const TeCoord2D &c, const TePolygon &pol)
| Check if coordinate and polygon are disjoint.
bool | TeDisjoint (const TePoint &p1, const TePoint &p2)
| Check if point l and point 2 are disjoint.
bool | TeDisjoint (const TePoint &p, const TeLine2D &l)
| Check if point and object are disjoint.
bool | TeDisjoint (const TePoint &p, const TePolygon &pol)
| Check if point and object are disjoint.
bool | TeDisjoint (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if lines are disjoint.
bool | TeDisjoint (const TeLine2D &l, const TePolygon &pol)
| Check if line and polygon are disjoint.
bool | TeDisjoint (const TePolygon &redPol, const TePolygon &bluePol)
| Check if polygons are disjoint.
bool | TeDisjoint (const TeCell &cell1, const TeCell &cell2)
| Check if cell 1 and cell 2 are disjoint.
bool | TeDisjoint (const TeCell &cell, const TeLine2D &line)
| Check if cell and line are disjoint.
bool | TeDisjoint (const TeCell &cell, const TePolygon &pol)
| Check if cell and polygon are disjoint.
bool | TeDisjoint (const TeCell &cell, const TePoint &point)
| Check if cell and point are disjoint.
template<>
bool | TeIntersects (const TeCoord2D &c, const TeBox &b)
| Check if coordinate and box intersects.
template<>
bool | TeIntersects (const TePoint &p, const TeBox &b)
| Check if point and box intersects.
template<>
bool | TeIntersects (const TeBox &bx1, const TeBox &bx2)
| Check if boxes intersects.
bool | TeTouches (const TeCoord2D &c, const TeLine2D &l)
| Check if coordinate and line touches.
bool | TeTouches (const TeCoord2D &c, const TePolygon &pol)
| Check if coordinate and polygon touches.
bool | TeTouches (const TePoint &p, const TeLine2D &l)
| Check if point and object touches.
bool | TeTouches (const TePoint &p, const TePolygon &pol)
| Check if point and object touches.
bool | TeTouches (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if line and line touches.
bool | TeTouches (const TeLine2D &l, const TePolygon &pol)
| Check if line and polygon.
bool | TeTouches (const TePolygon &redPol, const TePolygon &bluePol)
| Check if polygons touches.
bool | TeTouches (const TeBox &bx1, const TeBox &bx2)
| Check if boxes touches.
bool | TeTouches (const TeCell &c1, const TeCell &c2)
| Check if cells touches.
bool | TeTouches (const TeLine2D &line, const TeCell &cell)
| Check if cell and line touches.
bool | TeTouches (const TeCell &c1, const TePolygon &poly)
| Check if cell and polygon touches.
bool | TeTouches (const TePoint &point, const TeCell &c1)
| Check if cell and point touches.
bool | TeCrosses (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if red line crosses blue line.
bool | TeCrosses (const TeLine2D &l, const TePolygon &pol)
| Check if line crosses polygon.
bool | TeCrosses (const TeLine2D &l, const TeCell &cell)
| Check if line and cell crosses.
bool | TeWithin (const TeCoord2D &c1, const TeCoord2D &c2)
| Check if coordinate 1 is within coordinate 2.
bool | TeWithin (const TeCoord2D &c, const TeBox &b)
| Check if coordinate is within a box.
bool | TeWithin (const TeCoord2D &c, const TeLine2D &l)
| Check if a cordinate is within a line.
bool | TeWithin (const TeCoord2D &c, const TePolygon &pol)
| Check if a cordinate is within a polygon.
bool | TeWithin (const TePoint &p1, const TePoint &p2)
| Check if point 1 is within point 2.
bool | TeWithin (const TePoint &p, const TeLine2D &l)
| Check if point is within object.
bool | TeWithin (const TePoint &p, const TePolygon &pol)
| Check if point is within object.
bool | TeWithin (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if red line is within blue line.
bool | TeWithin (const TeLine2D &l, const TePolygon &pol)
| Check if line is within polygon.
bool | TeWithin (const TePolygon &redPol, const TePolygon &bluePol)
| Check if red polygon is within blue polygon.
bool | TeWithin (const TeBox &bx1, const TeBox &bx2)
| Check if box1 is within box2.
bool | TeWithin (const TeCell &cell1, const TeCell &cell2)
| Check if cell1 is within cell2.
bool | TeWithin (const TeLine2D &line, const TeCell &cell)
| Check if line is within cell.
bool | TeWithin (const TeCell &cell, const TePolygon &poly)
| Check if cell is within polygon.
bool | TeWithin (const TePoint &point, const TeCell &cell)
| Check if point is within cell.
bool | TeOverlaps (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if red red overlaps blue line.
bool | TeOverlaps (const TePolygon &redPol, const TePolygon &bluePol)
| Check if red polygon overlaps blue polygon.
bool | TeOverlaps (const TeCell &cell1, const TeCell &cell2)
| Check if cell1 overlaps cell2.
bool | TeOverlaps (const TeCell &cell, const TePolygon &poly)
| Check if cell overlaps polygon.
bool | TeCoveredBy (const TeLine2D &redLine, const TeLine2D &blueLine)
| Check if red line is covered by blue line.
bool | TeCoveredBy (const TeLine2D &l, const TePolygon &pol)
| Check if line is covered by polygon.
bool | TeCoveredBy (const TePolygon &redPol, const TePolygon &bluePol)
| Check if red polygon is covered by blue polygon.
bool | TeCoveredBy (const TeCell &cell1, const TeCell &cell2)
| Check if cell1 is covered by cell2.
bool | TeCoveredBy (const TePolygon &poly, const TeCell &cell)
| Check if polygon is covered by cell.
bool | TeCoveredBy (const TeLine2D &line, const TeCell &cell)
| Check if line is covered by cell.
bool | TeDisjointOrTouches (const TeBox &bx1, const TeBox &bx2)
| Check if box1 is DISJOINT or TOUCHes box2.
template<>
bool | TeWithinOrCoveredByOrEquals (const TeBox &bx1, const TeBox &bx2)
| Check if box1 is WITHIN, COVERED BY or EQUAL to box2.
template<>
bool | TeWithinOrCoveredByOrEquals (const TeLine2D &line1, const TeLine2D &line2)
| Check if line1 is WITHIN, COVERED BY or EQUAL to line2.
template<>
bool | TeWithinOrCoveredByOrEquals (const TeLine2D &line1, const TePolygon &pol)
| Check if line1 is WITHIN or COVERED BY to pol.
template<>
bool | TeWithinOrCoveredByOrEquals (const TePolygon &pol1, const TePolygon &pol2)
| Check if pol1 is WITHIN, COVERED BY or EQUAL to pol2.
bool | TeWithinOrTouches (const TeCoord2D &c, const TeCoord2D &c1, const TeCoord2D &c2)
| Check if coordinate c is WITHIN or TOUCHes segments c1 and c2.
bool | TeIntersection (const TeBox &bx1, const TeBox &bx2, TeBox &bout)
| Performs the intersection between box b1 and b2, returning the resulting box bout.
TeCoordPairVect | TeGetIntersections (const TePolygon &poly, const double &y)
| Returns the segments that intersept the poly polygon in the line y.
TeBox | TeUnion (const TeBox &bx1, const TeBox &bx2)
| Combine two box, make one that includes both.
bool | TePointInPoly (const TeCoord2D &c, const TeLinearRing &r)
| Point in polygon inside/outside/boundary code.
bool | TeIsOnSegment (const TeCoord2D &c, const TeCoord2D &c1, const TeCoord2D &c2)
| Check if coordinate c is on segment (segment is closed).
bool | TeIsOnLine (const TeCoord2D &c, const TeLine2D &l)
| Check if coordinate c is on line boundary or on line interior (see explanation above for definition of boundary and interior of a line).
bool | TeLocateLineSegment (TeCoord2D &pin, TeLine2D &line, int &segment, double)
| Locate the nearest line segment of a coordinate.
template<>
double | TeGeometryArea (const TePolygon &p)
| This is a explicit specialization that returns the area of a TePolygon.
template<>
double | TeGeometryArea (const TePolygonSet &ps)
| This is a explicit specialization that returns the area of a TePolygonSet.
template<>
double | TeGeometryArea (const TeBox &b)
| This is a explicit specialization that returns the area of a Box.
template<>
double | TeGeometryArea (const TeMultiGeometry &mGeom)
| This is a explicit specialization that returns the area of a Box.
void | removeDuplicatedCoords (vector< TeCoord2D > &coordSet)
| If we have the two end point equals, so we remove it.
TePolygon | TeConvexHull (std::vector< TeCoord2D > &coordSet)
| This is a explicit specialization that returns the convex hull of a TeCoord2D set.
TePolygon | TeConvexHull (const TePolygon &p)
| This is a explicit specialization that returns the convex hull of a TePolygon.
TePolygon | TeConvexHull (const TePolygonSet &ps)
| This is a explicit specialization that returns the convex hull of a TePolygonSet.
TePolygon | TeConvexHull (const TePointSet &ps)
| This is a explicit specialization that returns the convex hull of a TePointSet. Must be defined!
bool | TeIsConvex (const TeLinearRing &ring)
| Verifies if a simple polygon defined as a linear ring is convex or not.
short | TeOrientation (const TeLinearRing &r)
| Returns the orientation of the ring (CLOCKWISE or COUNTERCLOCKWISE);.
void | TeGetMiddlePoint (const TeCoord2D &first, const TeCoord2D &last, TeCoord2D &middle)
| Returns the middle point of a segment.
double | TeDistance (const TeCoord2D &c1, const TeCoord2D &c2)
| Calculates the Euclidian distance between two points.
double | TeLength (const TeLine2D &l)
| Returns the length of a Line 2D.
double | TePerpendicularDistance (const TeCoord2D &first, const TeCoord2D &last, const TeCoord2D &pin, TeCoord2D &pinter)
| Perpendicular distance from point to segment.
double | TeMinimumDistance (const TeCoord2D &first, const TeCoord2D &last, const TeCoord2D &pin, TeCoord2D &pout, double)
| Minimal distance from point to segment.
short | TeRelation (const TeCoord2D &c, const TeLine2D &l)
| Returns the relation between coordinate c and line l.
short | TeRelation (const TeCoord2D &c, const TeLinearRing &r)
| Point in polygon inside/outside/boundary code.
short | TeRelation (const TeCoord2D &c, const TePolygon &pol)
| Coordinate in polygon inside/outside/boundary code.
short | TeRelation (const TePoint &p, const TePolygon &pol)
| Point in polygon inside/outside/boundary code.
short | TeRelation (const TeCoord2D &c, const TePolygonSet &pSet)
| Point in polygon set inside/outside/boundary code.
short | TeRelation (const TeLine2D &lRed, const TeLine2D &lBlue, const short &relation)
| This function returns the relation between two lines.
short | TeRelation (const TeLine2D &line, const TePolygon &pol)
| This function returns the relation between a line and a polygon.
short | TeRelation (const TePolygon &pRed, const TePolygon &pBlue)
| This function returns the relation between two polygons.
TePolygon | TeMakePolygon (const TeBox &b)
| Given a box return its polygon representation.
TeLinearRing | TeSimpleClosedPath (const TePointSet &pSet)
| Given N points, finds a path that doesn't self-intersects.
bool | TeNearest (TeCoord2D &pt, TeNodeSet &ns, int &k, const double &tol)
| Nearest node in set from location pt (i = the node index in the nodeset)
bool | TeNearest (TeCoord2D &pt, TePointSet &ps, int &k, const double &tol)
| Nearest point in set from location pt (i = the point index in the pointset)
bool | TeNearest (TeCoord2D &pt, TeTextSet &ts, int &k, const double &tol)
| Nearest text in set from location pt (i = the text index in the textset)
bool | TeNearest (TeCoord2D &pt, TeLineSet &ls, int &k, TeCoord2D &pi, const double &tol)
bool | TeNearest (TeCoord2D &pt, TeLineSet &ls, int &lindex, TeCoord2D &pout, double &dmin, const double &tol)
bool | TeNearest (TeCoord2D &pt, TePolygonSet &ps, int &k, const double &)
| Nearest polygon in set from location pt (i = the polygon index in the polygonset).
bool | TeNearestByPoints (TeCoord2D &pt, TeLineSet &ls, int &k, double &dist, const double &tol)
| Nearest line in set from location pt (i = the line index in lineset) calculated by the vertex of the lines.
bool | TeFindTriangleCenter (const TeCoord2D &vert0, const TeCoord2D &vert1, const TeCoord2D &vert2, TeCoord2D &pc)
| Calculates the center of a triangle.
bool | TeLineSimplify (TeLine2D &ptlist, double snap, double maxdist)
| Performs a line simplication.
bool | TeSegmentsIntersectPoint (const TeCoord2D &fr0, const TeCoord2D &to0, const TeCoord2D &fr1, const TeCoord2D &to1, TeCoord2D &pi)
| Calculates intersection between two segments.
void | TeSwap (TePoint &p1, TePoint &p2)
| Swaps to points.
bool | TeGetCenter (TePoint p1, TePoint p2, TePoint p3, TePoint &center)
| Given three points of a circunference, returns its center point.
double | TeGetRadius (TePoint &p1, TePoint &p2, TePoint &p3)
| Given three points of a circunference, returns the radius.
bool | TeGenerateArc (TePoint &p1, TePoint &p2, TePoint &p3, TeLine2D &arcOut, const short &NPoints)
| Given three points returns a smooth arc as a TeLine2D that contains a given total number of points.
bool | TeGenerateCircle (const TePoint &center, const double &radius, TeLine2D &circle, const short &NPoints)
| Given a center point and a radius, returns the circle as a TeLine2D interpolated by a given number of points.
double | TeGetPrecision (TeProjection *proj)
| Given a projection "proj" returns a tolerance value in the same unit of projection to be used in geometric operations.
bool | TeAdjustSegment (TeCoord2D P0, TeCoord2D P1, double d0, TeCoord2D &P0out, TeCoord2D &P1out)
| Adjust Segment to specific distance.
bool | TeFindCentroid (const TeLine2D &line, TeCoord2D &p)
| Get middle line Method like find Centroid but this method calculate the correct middle point.

## Function Documentation

short ConverseRelation | ( | const short & | rel | ) | `[inline]`

short LookAtInnerRings | ( | const TeLinearRing & | rRed,
|  | const TePolygon & | pBlue,
|  | vector< TeLinearRing > & | rings,
|  | short & | rel
| ) |  |

bool MayTouches | ( | const TeLine2D & | lRed,
|  | const TeLine2D & | lBlue,
|  | TeINTERSECTOR2::TeVectorBoundaryIP & | report
| ) |  |

short Relation | ( | const TeLine2D & | lRed,
|  | const TeLine2D & | lBlue,
|  | TeINTERSECTOR2::TeVectorBoundaryIP & | report,
|  | const short & | relation
| ) |  |

short Relation | ( | const TeLine2D & | line,
|  | const TeLinearRing & | ring
| ) |  |

double Te2Area | ( | const TeLinearRing & | r | ) |

short TestInnerRings | ( | const TePolygon & | pRed,
|  | vector< TeLinearRing > & | rings
| ) |  |

This function returns the relationship between the ring and the polygon inner rings.

Parameters:

  pRed | The inner rings from pRed to test relationship.
  rings | Inner rings from blue polygon that is inside or is covered by red external polygon.

This function returns the relationship between the inner ring of pRed and the inner rings in rings.

void TeSwap | ( | TePoint & | p1,
|  | TePoint & | p2
| ) |  |

Swaps to points.

Parameters:

  p1 | The first point.
  p2 | The second point.

double Theta | ( | const TeCoord2D & | c1,
|  | const TeCoord2D & | c2
| ) |  |

Instead of using arctan, use this to compare angles, so given two points return a number to be used in place of the angle formed by the segment.

short TopologicRelation | ( | const TeLine2D & | line,
|  | const TeLinearRing & | r
| ) |  |

This function returns the relation between a line and a linear ring (treated as a simple polygon with no holes).

Parameters:

  line | The line.
  r | The simple polygon ring.

This function returns the topologic relation between the line and the ring. The result may be: DISJOINT, WITHIN, TOUCHES, CROSSES or COVERED BY. Obs: Doesn't do box elimination. Just uses from TeRelation.

short TopologicRelation | ( | const TeLinearRing & | rRed,
|  | const TeLinearRing & | rBlue
| ) |  |

This function returns the relationship between two rings (treated as simple polygons with no holes).

Parameters:

  rRed | The ring to test relationship.
  rBlue | The ring to test relationship.

This function returns the relationship between two rings.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines