Class JavaLine3D


  • public class JavaLine3D
    extends AbstractJavaLine<JavaPoint3D>

    Threedimensional line between two 3D points

    Since:
    1.0
    Author:
    Christoph Praschl
    • Constructor Detail

      • JavaLine3D

        public JavaLine3D​(double x1,
                          double y1,
                          double z1,
                          double x2,
                          double y2,
                          double z2)
      • JavaLine3D

        public JavaLine3D​(JavaPoint3D startPoint,
                          JavaPoint3D endPoint)
        set line by start and end point
        Parameters:
        startPoint - the start point of the line
        endPoint - the end point of the line
    • Method Detail

      • calculateCenterPoint

        protected JavaPoint3D calculateCenterPoint()

        Calculate the center point of a given line
        x = (start.x + end.x) / 2
        y = (start.y + end.y) / 2
        z = (start.z + end.z) / 2

        Specified by:
        calculateCenterPoint in class AbstractJavaLine<JavaPoint3D>
        Returns:
        center point of the line
      • getPointAlongLine

        public JavaPoint3D 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)
        Specified by:
        getPointAlongLine in class AbstractJavaLine<JavaPoint3D>
        Parameters:
        distance - from the startPoint
        Returns:
        the point with the given distance