## org.apache.lucene.spatial.geometry.shape
Class LineSegment

    java.lang.Object
      org.apache.lucene.spatial.geometry.shape.LineSegment

    public class LineSegment

extends java.lang.Object

2d line segment.

NOTE: This API is still in flux and might change in incompatible ways in the next release.

Field Summary
`Point2D` `A`
`Point2D` `B`

Constructor Summary
`LineSegment()`
`LineSegment(Point2D p1, Point2D p2)`

Method Summary
`double` `distance(Point2D P, Point2D closestPt)` Finds the distance of a specified point from the line segment and the closest point on the segment to the specified point.
`boolean` `equals(java.lang.Object obj)`
`int` `hashCode()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### A

    public final Point2D A

### B

    public final Point2D B

Constructor Detail

### LineSegment

    public LineSegment()

### LineSegment

    public LineSegment(Point2D p1,
                       Point2D p2)

Method Detail

### distance

    public double distance(Point2D P,
                           Point2D closestPt)

  Finds the distance of a specified point from the line segment and the closest point on the segment to the specified point.

  Parameters:
    `P` - Test point.
    `closestPt` - (Return) Closest point on the segment to c.
  Returns:
    Returns the distance from P to the closest point on the segment.

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.