Packages

package algorithm

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package construct
  2. package distance
  3. package locate

Type Members

  1. trait BoundaryNodeRule extends AnyRef
  2. class CGAlgorithms extends AnyRef
  3. class Centroid extends AnyRef
  4. class ConvexHull extends AnyRef
  5. class HCoordinate extends AnyRef
  6. class InteriorPointArea extends AnyRef
  7. class InteriorPointLine extends AnyRef
  8. class InteriorPointPoint extends AnyRef
  9. abstract class LineIntersector extends AnyRef
  10. class MinimumDiameter extends AnyRef
  11. class NotRepresentableException extends Exception

    Indicates that a {link HCoordinate} has been computed which is not representable on the Cartesian plane.

    Indicates that a {link HCoordinate} has been computed which is not representable on the Cartesian plane.

    Version

    1.7

    See also

    HCoordinate

  12. class PointLocator extends AnyRef

    Computes the topological ({link Location}) of a single point to a {link Geometry}.

    Computes the topological ({link Location}) of a single point to a {link Geometry}. A {link BoundaryNodeRule} may be specified to control the evaluation of whether the point lies on the boundary or not The default rule is to use the the SFS Boundary Determination Rule

    Notes:

    • {link LinearRing}s do not enclose any area - points inside the ring are still in the EXTERIOR of the ring.

    Instances of this class are not reentrant.

    Version

    1.7

  13. class RayCrossingCounter extends AnyRef
  14. class RectangleLineIntersector extends AnyRef

    Computes whether a rectangle intersects line segments.

    Computes whether a rectangle intersects line segments.

    Rectangles contain a large amount of inherent symmetry (or to put it another way, although they contain four coordinates they only actually contain 4 ordinates worth of information). The algorithm used takes advantage of the symmetry of the geometric situation to optimize performance by minimizing the number of line intersection tests.

  15. class RobustLineIntersector extends LineIntersector

Value Members

  1. object Angle

    Utility functions for working with angles.

    Utility functions for working with angles. Unless otherwise noted, methods in this class express angles in radians.

  2. object Area

    Functions for computing area.

  3. object BoundaryNodeRule

    An interface for rules which determine whether node points which are in boundaries of {link Lineal} geometry components are in the boundary of the parent geometry collection.

    An interface for rules which determine whether node points which are in boundaries of {link Lineal} geometry components are in the boundary of the parent geometry collection. The SFS specifies a single kind of boundary node rule, the {link Mod2BoundaryNodeRule} rule. However, other kinds of Boundary Node Rules are appropriate in specific situations (for instance, linear network topology usually follows the {link EndPointBoundaryNodeRule}.) Some JTS operations (such as {link RelateOp}, {link BoundaryOp} and {link IsSimpleOp}) allow the BoundaryNodeRule to be specified, and respect the supplied rule when computing the results of the operation.

    An example use case for a non-SFS-standard Boundary Node Rule is that of checking that a set of {link LineString}s have valid linear network topology, when turn-arounds are represented as closed rings. In this situation, the entry road to the turn-around is only valid when it touches the turn-around ring at the single (common) endpoint. This is equivalent to requiring the set of LineStrings to be simple under the {link EndPointBoundaryNodeRule}. The SFS-standard {link Mod2BoundaryNodeRule} is not sufficient to perform this test, since it states that closed rings have no boundary points.

    This interface and its subclasses follow the Strategy design pattern.

    Version

    1.7

    See also

    RelateOp

    BoundaryOp

    IsSimpleOp

    PointLocator

  4. object CGAlgorithms3D

    Basic computational geometry algorithms for geometry and coordinates defined in 3-dimensional Cartesian space.

  5. object CGAlgorithmsDD

    Implements basic computational geometry algorithms using {link DD} arithmetic.

  6. object Centroid

    Computes the centroid of a {link Geometry} of any dimension.

    Computes the centroid of a {link Geometry} of any dimension. If the geometry is nominally of higher dimension, but has lower effective dimension (i.e. contains only components having zero length or area), the centroid will be computed as for the equivalent lower-dimension geometry. If the input geometry is empty, a null Coordinate is returned.

    Algorithm

    • Dimension 2 - the centroid is computed as the weighted sum of the centroids of a decomposition of the area into (possibly overlapping) triangles. Holes and multipolygons are handled correctly. See http://www.faqs.org/faqs/graphics/algorithms-faq/ for further details of the basic approach.
    • Dimension 1 - Computes the average of the midpoints of all line segments weighted by the segment length. Zero-length lines are treated as points.
    • Dimension 0 - Compute the average coordinate for all points. Repeated points are all included in the average.
    Version

    1.7

  7. object ConvexHull

    Computes the convex hull of a {link Geometry}.

    Computes the convex hull of a {link Geometry}. The convex hull is the smallest convex Geometry that contains all the points in the input Geometry.

    Uses the Graham Scan algorithm.

    Version

    1.7

  8. object Distance

    Functions to compute distance between basic geometric structures.

  9. object HCoordinate

    Represents a homogeneous coordinate in a 2-D coordinate space.

    Represents a homogeneous coordinate in a 2-D coordinate space. In JTS {link HCoordinate}s are used as a clean way of computing intersections between line segments.

    Version

    1.7

  10. object InteriorPoint

    Computes an interior point of a {link Geometry}.

    Computes an interior point of a {link Geometry}. An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the geometry.

    The interior point of an empty geometry is null.

  11. object InteriorPointArea

    Computes a point in the interior of an areal geometry.

    Computes a point in the interior of an areal geometry. The point will lie in the geometry interior in all except certain pathological cases.

    Algorithm

    For each input polygon:

    • Determine a horizontal scan line on which the interior point will be located. To increase the chance of the scan line having non-zero-width intersection with the polygon the scan line Y ordinate is chosen to be near the centre of the polygon's Y extent but distinct from all of vertex Y ordinates.
    • Compute the sections of the scan line which lie in the interior of the polygon.
    • Choose the widest interior section and take its midpoint as the interior point.

    The final interior point is chosen as the one occurring in the widest interior section.

    This algorithm is a tradeoff between performance and point quality (where points further from the geometry boundary are considered to be higher quality) Priority is given to performance. This means that the computed interior point may not be suitable for some uses (such as label positioning).

    The algorithm handles some kinds of invalid/degenerate geometry, including zero-area and self-intersecting polygons.

    Empty geometry is handled by returning a null point.

    KNOWN BUGS
    • If a fixed precision model is used, in some cases this method may return a point which does not lie in the interior.
    • If the input polygon is extremely narrow the computed point may not lie in the interior of the polygon.
    Version

    1.17

  12. object InteriorPointLine

    Computes a point in the interior of an linear geometry.

    Computes a point in the interior of an linear geometry.

    Algorithm

    • Find an interior vertex which is closest to the centroid of the linestring.
    • If there is no interior vertex, find the endpoint which is closest to the centroid.
    Version

    1.7

  13. object InteriorPointPoint

    Computes a point in the interior of an point geometry.

    Computes a point in the interior of an point geometry.

    Algorithm

    Find a point which is closest to the centroid of the geometry.

    Version

    1.7

  14. object Intersection

    Contains functions to compute intersections between lines.

  15. object Length

    Functions for computing length.

  16. object LineIntersector

    A LineIntersector is an algorithm that can both test whether two line segments intersect and compute the intersection point(s) if they do.

    A LineIntersector is an algorithm that can both test whether two line segments intersect and compute the intersection point(s) if they do.

    There are three possible outcomes when determining whether two line segments intersect:

    • {link #NO_INTERSECTION} - the segments do not intersect
    • {link #POINT_INTERSECTION} - the segments intersect in a single point
    • {link #COLLINEAR_INTERSECTION} - the segments are collinear and they intersect in a line segment

    For segments which intersect in a single point, the point may be either an endpoint or in the interior of each segment. If the point lies in the interior of both segments, this is termed a proper intersection. The method {link #isProper()} test for this situation.

    The intersection point(s) may be computed in a precise or non-precise manner. Computing an intersection point precisely involves rounding it via a supplied {link PrecisionModel}.

    LineIntersectors do not perform an initial envelope intersection test to determine if the segments are disjoint. This is because this class is likely to be used in a context where envelope overlap is already known to occur (or be likely).

    Version

    1.7

  17. object MinimumDiameter

    Computes the minimum diameter of a {link Geometry}.

    Computes the minimum diameter of a {link Geometry}. The minimum diameter is defined to be the width of the smallest band that contains the geometry, where a band is a strip of the plane defined by two parallel lines. This can be thought of as the smallest hole that the geometry can be moved through, with a single rotation.

    The first step in the algorithm is computing the convex hull of the Geometry. If the input Geometry is known to be convex, a hint can be supplied to avoid this computation.

    This class can also be used to compute a line segment representing the minimum diameter, the supporting line segment of the minimum diameter, and a minimum rectangle enclosing the input geometry. This rectangle will have width equal to the minimum diameter, and have one side parallel to the supporting segment.

    Version

    1.7

    See also

    ConvexHull

  18. object Orientation

    Functions to compute the orientation of basic geometric structures including point triplets (triangles) and rings.

    Functions to compute the orientation of basic geometric structures including point triplets (triangles) and rings. Orientation is a fundamental property of planar geometries (and more generally geometry on two-dimensional manifolds).

    Orientation is notoriously subject to numerical precision errors in the case of collinear or nearly collinear points. JTS uses extended-precision arithmetic to increase the robustness of the computation.

  19. object PointLocation

    Functions for locating points within basic geometric structures such as lines and rings.

  20. object RayCrossingCounter

    Counts the number of segments crossed by a horizontal ray extending to the right from a given point, in an incremental fashion.

    Counts the number of segments crossed by a horizontal ray extending to the right from a given point, in an incremental fashion. This can be used to determine whether a point lies in a {link Polygonal} geometry. The class determines the situation where the point lies exactly on a segment. When being used for Point-In-Polygon determination, this case allows short-circuiting the evaluation.

    This class handles polygonal geometries with any number of shells and holes. The orientation of the shell and hole rings is unimportant. In order to compute a correct location for a given polygonal geometry, it is essential that all segments are counted which

    • touch the ray
    • lie in in any ring which may contain the point

    The only exception is when the point-on-segment situation is detected, in which case no further processing is required. The implication of the above rule is that segments which can be a priori determined to not touch the ray (i.e. by a test of their bounding box or Y-extent) do not need to be counted. This allows for optimization by indexing.

    This implementation uses the extended-precision orientation test, to provide maximum robustness and consistency within other algorithms.

  21. object RobustDeterminant

    Implements an algorithm to compute the sign of a 2x2 determinant for double precision values robustly.

    Implements an algorithm to compute the sign of a 2x2 determinant for double precision values robustly. It is a direct translation of code developed by Olivier Devillers.

    The original code carries the following copyright notice:

    ************************************************************************
    Author : Olivier Devillers
    Olivier.Devillers@sophia.inria.fr
    http:/www.inria.fr:/prisme/personnel/devillers/anglais/determinant.html
    
    Relicensed under EDL and EPL with Permission from Olivier Devillers
    
    *************************************************************************
    
    *************************************************************************
    Copyright (c) 1995  by  INRIA Prisme Project
    BP 93 06902 Sophia Antipolis Cedex, France.
    All rights reserved
    *************************************************************************
    

    Version

    1.7

  22. object RobustLineIntersector

    A robust version of {link LineIntersector}.

    A robust version of {link LineIntersector}.

    Version

    1.7

Deprecated Value Members

  1. object CGAlgorithms

    Specifies and implements various fundamental Computational Geometric algorithms.

    Specifies and implements various fundamental Computational Geometric algorithms. The algorithms supplied in this class are robust for double-precision floating point.

    Deprecated

    See Length, Area, Distance, Orientation, PointLocation

    Version

    1.7

Ungrouped