All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.loki3.util.Vector

java.lang.Object
    |
    +----com.loki3.util.Vector

public class Vector
extends java.lang.Object

Constructor Index

 o Vector()
create a zero vector
 o Vector(double, double)
create a vector with the given values (set z to 0)
 o Vector(double, double, double)
create a vector with the given values
 o Vector(Vector)
create a copy of the given vector

Method Index

 o add(Vector)
add given vector to this vector
 o getAngle()
get direction of vector in radians counterclockwise from x-axis
 o getAngle(Vector)
get direction of vector in radians counterclockwise from x-axis using this as origin
 o getDistance(Vector)
get distance from this vector to another
 o getDistance2(Vector)
get the square of the distance from this vector to another
 o getLength()
get length of vector
 o getR()
get length of vector in the xy-plane
 o getRoundX()
get x coordinate rounded to nearest int
 o getRoundY()
get y coordinate rounded to nearest int
 o getRoundZ()
get z coordinate rounded to nearest int
 o getX()
get x coordinate
 o getY()
get y coordinate
 o getZ()
get z coordinate
 o isZero()
is entire vector 0?
 o multiply(double)
multiply each coordinate by s
 o normalize()
turn this into a vector of length 1 that goes in same direction
 o set(double, double)
change the values in the vector (set z to 0)
 o set(double, double, double)
change the values in the vector
 o set(Vector)
copy the given vector into this vector
 o setCylindrical(double, double, double)
change x & y based on the cylindrical coordinates r, theta & z
 o setLength(double)
keep the direction the same but change the length
 o setMax(Vector)
Set this to the maximum values of this.x & v.x, this.y & v.y, this.z & v.z
 o setMin(Vector)
Set this to the minimum values of this.x & v.x, this.y & v.y, this.z & v.z
 o setPolar(double, double)
change x & y based on the polar coordinates r & theta
 o setX(double)
set x coordinate
 o setY(double)
set y coordinate
 o setZ(double)
set z coordinate
 o subtract(Vector)
subtract given vector from this vector
 o valueOf(String)
parse the given string and turn it into a Vector
 o zero()
set all coordinates to 0

Constructor Detail

 o Vector
public Vector()
          create a zero vector
 o Vector
public Vector(double x,
              double y)
          create a vector with the given values (set z to 0)
 o Vector
public Vector(double x,
              double y,
              double z)
          create a vector with the given values
 o Vector
public Vector(Vector v)
          create a copy of the given vector

Method Detail

 o getX
public double getX()
          get x coordinate
 o getY
public double getY()
          get y coordinate
 o getZ
public double getZ()
          get z coordinate
 o getRoundX
public int getRoundX()
          get x coordinate rounded to nearest int
 o getRoundY
public int getRoundY()
          get y coordinate rounded to nearest int
 o getRoundZ
public int getRoundZ()
          get z coordinate rounded to nearest int
 o setX
public void setX(double x)
          set x coordinate
 o setY
public void setY(double y)
          set y coordinate
 o setZ
public void setZ(double z)
          set z coordinate
 o zero
public void zero()
          set all coordinates to 0
 o isZero
public boolean isZero()
          is entire vector 0?
 o set
public void set(double x,
                double y)
          change the values in the vector (set z to 0)
 o set
public void set(double x,
                double y,
                double z)
          change the values in the vector
 o set
public void set(Vector v)
          copy the given vector into this vector
 o setPolar
public void setPolar(double r,
                     double theta)
          change x & y based on the polar coordinates r & theta
 o setCylindrical
public void setCylindrical(double r,
                           double theta,
                           double z)
          change x & y based on the cylindrical coordinates r, theta & z
 o add
public void add(Vector v)
          add given vector to this vector
 o subtract
public void subtract(Vector v)
          subtract given vector from this vector
 o multiply
public void multiply(double s)
          multiply each coordinate by s
 o getLength
public double getLength()
          get length of vector
 o getR
public double getR()
          get length of vector in the xy-plane
 o getDistance
public double getDistance(Vector other)
          get distance from this vector to another
 o getDistance2
public double getDistance2(Vector other)
          get the square of the distance from this vector to another
 o getAngle
public double getAngle()
          get direction of vector in radians counterclockwise from x-axis
 o getAngle
public double getAngle(Vector other)
          get direction of vector in radians counterclockwise from x-axis using this as origin
 o normalize
public void normalize()
          turn this into a vector of length 1 that goes in same direction
 o setLength
public void setLength(double length)
          keep the direction the same but change the length
 o setMin
public void setMin(Vector v)
          Set this to the minimum values of this.x & v.x, this.y & v.y, this.z & v.z
 o setMax
public void setMax(Vector v)
          Set this to the maximum values of this.x & v.x, this.y & v.y, this.z & v.z
 o valueOf
public static Vector valueOf(java.lang.String s)
          parse the given string and turn it into a Vector

All Packages  Class Hierarchy  This Package  Previous  Next  Index