Module gomint.api

Class Vector

  • Direct Known Subclasses:
    Location

    public class Vector
    extends Object

    A immutable class representing a triple of float values resembling the x, y and z coordinates of a point respectively.

    Version:
    2.0
    Author:
    Digot, geNAZt, BlackyPaw
    • Field Detail

      • ZERO

        public static final Vector ZERO
      • UP

        public static final Vector UP
      • DOWN

        public static final Vector DOWN
      • EAST

        public static final Vector EAST
      • WEST

        public static final Vector WEST
      • NORTH

        public static final Vector NORTH
      • SOUTH

        public static final Vector SOUTH
      • x

        protected float x
      • y

        protected float y
      • z

        protected float z
    • Constructor Detail

      • Vector

        public Vector()
      • Vector

        public Vector​(float x,
                      float y,
                      float z)
    • Method Detail

      • add

        public Vector add​(float x,
                          float y,
                          float z)
      • subtract

        public Vector subtract​(float x,
                               float y,
                               float z)
      • multiply

        public Vector multiply​(float x,
                               float y,
                               float z)
      • divide

        public Vector divide​(float x,
                             float y,
                             float z)
      • multiply

        public Vector multiply​(float value)
      • length

        public float length()
      • normalize

        public Vector normalize()
      • distanceSquared

        public float distanceSquared​(Vector position)
      • distance

        public float distance​(Vector position)
      • getVectorWhenXIsOnLine

        public Vector getVectorWhenXIsOnLine​(Vector other,
                                             float x)
        Get a new vector with the x axis set to the x parameter when the x parameter is on a line with this and the vector other
        Parameters:
        other - to check with
        x - which may on the line or not
        Returns:
        vector with x set or null when x is not on a line with this and the other vector
      • getVectorWhenYIsOnLine

        public Vector getVectorWhenYIsOnLine​(Vector other,
                                             float y)
        Get a new vector with the y axis set to the y parameter when the y parameter is on a line with this and the vector other
        Parameters:
        other - to check with
        y - which may on the line or not
        Returns:
        vector with y set or null when y is not on a line with this and the other vector
      • getVectorWhenZIsOnLine

        public Vector getVectorWhenZIsOnLine​(Vector other,
                                             float z)
        Get a new vector with the z axis set to the z parameter when the z parameter is on a line with this and the vector other
        Parameters:
        other - to check with
        z - which may on the line or not
        Returns:
        vector with y set or null when y is not on a line with this and the other vector