Atavism Version 2018.1AGIS API

atavism.server.math
Class AOVector

java.lang.Object
  extended by atavism.server.math.AOVector
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
TranslateTransform

public class AOVector
extends java.lang.Object
implements java.io.Externalizable

this object is not thread safe

See Also:
Serialized Form

Field Summary
static float epsilon
           
static AOVector UnitZ
           
static AOVector Zero
           
 
Constructor Summary
AOVector()
           
AOVector(AOVector other)
           
AOVector(float x, float y, float z)
           
AOVector(Point other)
           
 
Method Summary
 AOVector add(AOVector other)
           
static AOVector add(AOVector p1, AOVector p2)
           
 AOVector add(float x, float y, float z)
           
 AOVector add(Point other)
           
 void assign(AOVector source)
           
 java.lang.Object clone()
           
 AOVector cloneAOVector()
           
static boolean counterClockwisePoints(AOVector v0, AOVector v1, AOVector v2)
           
static AOVector cross(AOVector u, AOVector v)
           
static float distanceTo(AOVector p1, AOVector p2)
          returns distance from p1 to p2
static float distanceToSquared(AOVector p1, AOVector p2)
          returns the square of the distance from p1 to p2
static float distanceToSquaredXZ(AOVector p1, AOVector p2)
          returns the square of the distance from p1 to p2 on the XZ plane
static float distanceToXZ(AOVector p1, AOVector p2)
          returns distance from p1 to p2 on the XZ plane
 float dotProduct(AOVector v)
           
 boolean equals(java.lang.Object obj)
           
 float getAngle(AOVector target)
           
 float getAxisValue(int i)
          Returns the x, y or z axis value depending on the value passed in. 0 returns x, 1 returns y, 2 returns z.
static float getLookAtYaw(AOVector motion)
           
 Quaternion getRotationTo(AOVector destination)
          Gets the shortest arc quaternion to rotate this vector to the destination vector.
 float getX()
           
 float getY()
           
 float getZ()
           
 boolean isZero()
           
 float length()
           
 float lengthXZ()
           
static void main(java.lang.String[] args)
           
static AOVector multiply(AOVector src, float factor)
           
 AOVector multiply(float factor)
           
 AOVector negate()
           
 AOVector normalize()
           
static AOVector parsePoint(java.lang.String s)
           
 void readExternal(java.io.ObjectInput in)
           
 AOVector scale(float s)
           
 void setX(float x)
           
 void setY(float y)
           
 void setZ(float z)
           
 AOVector sub(AOVector other)
           
static AOVector sub(AOVector dest, AOVector cur)
           
 AOVector sub(float x, float y, float z)
           
 AOVector sub(Point other)
           
static AOVector sub(Point dest, Point cur)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UnitZ

public static final AOVector UnitZ

Zero

public static final AOVector Zero

epsilon

public static float epsilon
Constructor Detail

AOVector

public AOVector()

AOVector

public AOVector(float x,
                float y,
                float z)

AOVector

public AOVector(Point other)

AOVector

public AOVector(AOVector other)
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

cloneAOVector

public AOVector cloneAOVector()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

assign

public void assign(AOVector source)

distanceToXZ

public static float distanceToXZ(AOVector p1,
                                 AOVector p2)
returns distance from p1 to p2 on the XZ plane


distanceToSquaredXZ

public static float distanceToSquaredXZ(AOVector p1,
                                        AOVector p2)
returns the square of the distance from p1 to p2 on the XZ plane


distanceTo

public static float distanceTo(AOVector p1,
                               AOVector p2)
returns distance from p1 to p2


distanceToSquared

public static float distanceToSquared(AOVector p1,
                                      AOVector p2)
returns the square of the distance from p1 to p2


isZero

public boolean isZero()

normalize

public AOVector normalize()

add

public AOVector add(AOVector other)

add

public AOVector add(Point other)

add

public AOVector add(float x,
                    float y,
                    float z)

sub

public AOVector sub(AOVector other)

sub

public AOVector sub(Point other)

sub

public AOVector sub(float x,
                    float y,
                    float z)

multiply

public AOVector multiply(float factor)

negate

public AOVector negate()

length

public float length()

lengthXZ

public float lengthXZ()

dotProduct

public float dotProduct(AOVector v)

scale

public AOVector scale(float s)

getAngle

public float getAngle(AOVector target)

getRotationTo

public Quaternion getRotationTo(AOVector destination)
Gets the shortest arc quaternion to rotate this vector to the destination vector. Don't call this if you think the dest vector can be close to the inverse of this vector, since then ANY axis of rotation is ok.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAxisValue

public float getAxisValue(int i)
Returns the x, y or z axis value depending on the value passed in. 0 returns x, 1 returns y, 2 returns z.

Parameters:
i -
Returns:

getX

public float getX()

getY

public float getY()

getZ

public float getZ()

setX

public void setX(float x)

setY

public void setY(float y)

setZ

public void setZ(float z)

add

public static AOVector add(AOVector p1,
                           AOVector p2)

multiply

public static AOVector multiply(AOVector src,
                                float factor)

sub

public static AOVector sub(AOVector dest,
                           AOVector cur)

sub

public static AOVector sub(Point dest,
                           Point cur)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

parsePoint

public static AOVector parsePoint(java.lang.String s)

cross

public static AOVector cross(AOVector u,
                             AOVector v)

counterClockwisePoints

public static boolean counterClockwisePoints(AOVector v0,
                                             AOVector v1,
                                             AOVector v2)

getLookAtYaw

public static float getLookAtYaw(AOVector motion)

main

public static void main(java.lang.String[] args)


Copyright © 2018 Dragonsan Studios Sp. z o.o.