public class LineSegment extends Object
Constructor and Description |
---|
LineSegment(Point p1,
Point p2)
Create a line segment with two given endpoints.
|
Modifier and Type | Method and Description |
---|---|
int |
dimension()
Get the dimension of the coordinate space.
|
double |
distance(Point p)
Calculate the shortest distance between a point and this line segment in Euclidean geometry.
|
Point |
getEndPoint1()
Get the first endpoint.
|
Point |
getEndPoint2()
Get the second endpoint.
|
double |
length()
Get the length of the line segment.
|
double |
perpendicularDistance(Point p) |
public Point getEndPoint1()
public Point getEndPoint2()
public int dimension()
public double length()
public double distance(Point p)
p
- the pointpublic double perpendicularDistance(Point p)
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.