Package science.aist.imaging.api.domain
Class AbstractJavaLine<T extends AbstractJavaPoint<T>>
- java.lang.Object
-
- science.aist.imaging.api.domain.AbstractJavaLine<T>
-
- Type Parameters:
T
- The type of the point.
- Direct Known Subclasses:
JavaLine2D
,JavaLine3D
public abstract class AbstractJavaLine<T extends AbstractJavaPoint<T>> extends Object
Abstract line representation
- Since:
- 1.0
- Author:
- Christoph Praschl
-
-
Field Summary
Fields Modifier and Type Field Description protected T
endPoint
end point of the lineprotected T
startPoint
start point of the line
-
Constructor Summary
Constructors Constructor Description AbstractJavaLine()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T
calculateCenterPoint()
Calculate the center point of a given lineList<T>
getInterpolatedPoints(int n)
Method for getting n points between start and endpointList<T>
getInterpolatedPoints(int n, boolean includeStartAndEnd)
Method for getting n points between start and endpointT
getLineDirection()
abstract T
getPointAlongLine(double distance)
Method for getting a point along this line with the given distance from the startPoint (Based on https://math.stackexchange.com/questions/175896/finding-a-point-along-a-line-a-certain-distance-away-from-another-point) Note: abstract implementation because of generic T not possible also if it is the same calculation.double
length()
Returns the length of the line.
-
-
-
Field Detail
-
startPoint
protected T extends AbstractJavaPoint<T> startPoint
start point of the line
-
endPoint
protected T extends AbstractJavaPoint<T> endPoint
end point of the line
-
-
Method Detail
-
getLineDirection
public T getLineDirection()
- Returns:
- The direction vector of this line
-
length
public double length()
Returns the length of the line. JavaPoint.pointDistance(start, end)- Returns:
- line of the length
-
calculateCenterPoint
protected abstract T calculateCenterPoint()
Calculate the center point of a given line- Returns:
- center point of the line
-
getPointAlongLine
public abstract T getPointAlongLine(double distance)
Method for getting a point along this line with the given distance from the startPoint (Based on https://math.stackexchange.com/questions/175896/finding-a-point-along-a-line-a-certain-distance-away-from-another-point) Note: abstract implementation because of generic T not possible also if it is the same calculation.- Parameters:
distance
- from the startPoint- Returns:
- the point with the given distance
-
getInterpolatedPoints
public List<T> getInterpolatedPoints(int n)
Method for getting n points between start and endpoint- Parameters:
n
- number of interpolated points- Returns:
- List of points
-
getInterpolatedPoints
public List<T> getInterpolatedPoints(int n, boolean includeStartAndEnd)
Method for getting n points between start and endpoint- Parameters:
n
- number of interpolated pointsincludeStartAndEnd
- flag which decides if start and endpoint should be added to the result- Returns:
- List of points
-
-