Class AbstractJavaLine<T extends AbstractJavaPoint<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
    • Constructor Detail

      • AbstractJavaLine

        public AbstractJavaLine()
    • 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 points
        includeStartAndEnd - flag which decides if start and endpoint should be added to the result
        Returns:
        List of points