ConvexHull2D (Apache Commons Math 3.3 API)

org.apache.commons.math3.geometry.euclidean.twod.hull

## Class ConvexHull2D

- java.lang.Object
- - org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHull2D

- All Implemented Interfaces:
    Serializable, ConvexHull<Euclidean2D,Vector2D>

      public class ConvexHull2D
      extends Object
      implements ConvexHull<Euclidean2D,Vector2D>, Serializable

  This class represents a convex hull in an two-dimensional euclidean space.
  Since:
    3.3
  Version:
    $Id: ConvexHull2D.java 1568752 2014-02-16 12:19:51Z tn $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConvexHull2D(Vector2D[] vertices, double tolerance)` Simple constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Region<Euclidean2D>` | `createRegion()` Returns a new region that is enclosed by the convex hull.
    `Segment[]` | `getLineSegments()` Get the line segments of the convex hull, ordered.
    `Vector2D[]` | `getVertices()` Get the vertices of the convex hull.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConvexHull2D

          public ConvexHull2D(Vector2D[] vertices,
                      double tolerance)
                       throws MathIllegalArgumentException

      Simple constructor.
      Parameters:
        `vertices` - the vertices of the convex hull, must be ordered
        `tolerance` - tolerance below which points are considered identical
      Throws:
        `MathIllegalArgumentException` - if the vertices do not form a convex hull

  - ### Method Detail

    - #### getVertices

          public Vector2D[] getVertices()

      Get the vertices of the convex hull.
      Specified by:
        `getVertices` in interface `ConvexHull<Euclidean2D,Vector2D>`
      Returns:
        vertices of the convex hull

    - #### getLineSegments

          public Segment[] getLineSegments()

      Get the line segments of the convex hull, ordered.
      Returns:
        the line segments of the convex hull

    - #### createRegion

          public Region<Euclidean2D> createRegion()
                                           throws InsufficientDataException

      Returns a new region that is enclosed by the convex hull.
      Specified by:
        `createRegion` in interface `ConvexHull<Euclidean2D,Vector2D>`
      Returns:
        the region enclosed by the convex hull
      Throws:
        `InsufficientDataException` - if the number of vertices is not enough to build a region in the respective space

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.