Class AbstractJavaPoint<T extends AbstractJavaPoint<T>>

    • Field Detail

      • x

        protected double x
        x-coordinate
      • y

        protected double y
        y-coordinate
      • z

        protected double z
        z-coordinate
    • Constructor Detail

      • AbstractJavaPoint

        public AbstractJavaPoint()
    • Method Detail

      • pointDistance

        public static double pointDistance​(AbstractJavaPoint<?> p1,
                                           AbstractJavaPoint<?> p2)
        returns the 3D distance between two given points sqrt((point1.x - point2.x)^2 + (point1.y - point2.y)^2 + (point1.z - point2.z)^2)
        Parameters:
        p1 - point1
        p2 - point2
        Returns:
        the distance between two given points
      • xDistance

        public static double xDistance​(AbstractJavaPoint<?> p1,
                                       AbstractJavaPoint<?> p2)
        returns the absolute distance in x direction between two points. abs(point1.x - point2.x)
        Parameters:
        p1 - point1
        p2 - point2
        Returns:
        distance in x direction
      • yDistance

        public static double yDistance​(AbstractJavaPoint<?> p1,
                                       AbstractJavaPoint<?> p2)
        returns the absolute distance in y direction between two points. abs(point1.y - point2.y)
        Parameters:
        p1 - point1
        p2 - point2
        Returns:
        distance in y direction
      • zDistance

        public static double zDistance​(AbstractJavaPoint<?> p1,
                                       AbstractJavaPoint<?> p2)
        returns the absolute distance in x direction between two points. abs(point1.x - point2.x)
        Parameters:
        p1 - point1
        p2 - point2
        Returns:
        distance in x direction
      • getIntX

        public int getIntX()
        Returns the rounded int value
        Returns:
        rounded x-coordinate
      • getIntY

        public int getIntY()
        Returns the rounded int value
        Returns:
        rounded y-coordinate
      • getIntZ

        public int getIntZ()
        Returns the rounded int value
        Returns:
        rounded z-coordinate
      • sub

        public abstract T sub​(T vector)
        Subtracts the given JavaPoint from this.
        Parameters:
        vector - The JavaPoint to be subtracted from this
        Returns:
        A new instance holding the result of the vector subtraction
      • add

        public abstract T add​(T vector)
        Adds the given JavaPoint to this.
        Parameters:
        vector - The JavaPoint to be added to this
        Returns:
        A new instance holding the result of the vector addition
      • mult

        public abstract T mult​(double scalar)
        Multiplies this by the given scalar.
        Parameters:
        scalar - The scalar to be multiplied by this
        Returns:
        A new instance holding the result of the multiplication
      • mult

        public abstract T mult​(T vector)
        Multiplies this by the given vector.
        Parameters:
        vector - The vector to be multiplied by this
        Returns:
        A new instance holding the result of the multiplication
      • div

        public abstract T div​(double scalar)
        Divides this by the given scalar.
        Parameters:
        scalar - The scalar to by which this should be divided
        Returns:
        A new instance holding the result of the division
      • dot

        public abstract double dot​(T vector)
        Computes the dot product of this and the given JavaPoint.
        Parameters:
        vector - The JavaPoint to be multiplied by this
        Returns:
        A new instance holding the result of the multiplication
      • calculateUnify

        protected abstract T calculateUnify()
        Returns:
        Returns a new instance holding the unit vector of this
      • equals

        public boolean equals​(Object o,
                              double epsilon)
        Equality check with epsilon for coordinates
        Parameters:
        o - other object
        epsilon - epsilon used for coordinate comparison
        Returns:
        true iff this and o are equal with the given epsilon; else false
      • positionalEqual

        public boolean positionalEqual​(T that)
        Checks if this and that are positional equal (not type equal)
        Parameters:
        that - other point
        Returns:
        true iff this and that are not null and positional equal; else false
      • positionalEqual

        public boolean positionalEqual​(T that,
                                       double epsilon)
        Checks if this and that are positional equal (not type equal)
        Parameters:
        that - other point
        epsilon - epsilon used for coordinate comparison
        Returns:
        true iff this and that are not null and positional equal; else false
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object