tig.maths
Class Vector3
- java.lang.Object
-
- tig.maths.Vector3
-
public class Vector3 extends java.lang.ObjectSimple representation of a vector in a 3D space, based ondoubles.
Represented as 3doubles.
-
-
Field Summary
Fields Modifier and Type Field and Description doublex0First coordinate of this vector.doublex1Second coordinate of this vector.doublex2Third coordinate of this vector.
-
Constructor Summary
Constructors Constructor and Description Vector3(double[] coords)Constructor from an array containing 3doubles.Vector3(double a0, double a1, double a2)Constructor from 3doubles.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static Vector3add(Vector3 a, Vector3 b)Returns aVector3c such as c = a + b.static Vector3doClone(Vector3 a)Returns a copy of aVector3.static Vector3mul(double k, Vector3 a)Multiplication of a vector by a scalar ; returns a vector b such as b = k a.static Vector3mul(Matrix3 M, Vector3 a)Multiplication of a vector by a matrix ; returns a vector b such as b = M a.static Vector3negate(Vector3 a)Returns aVector3b such as b = -a.static doublenorm(Vector3 v)Returns the norm of the vector passed in parameter.static Vector3sub(Vector3 a, Vector3 b)Returns aVector3c such as c = a - b.java.lang.StringtoString()Returns a String representation of this Vector.
-
-
-
Field Detail
-
x0
public double x0
First coordinate of this vector.
-
x1
public double x1
Second coordinate of this vector.
-
x2
public double x2
Third coordinate of this vector.
-
-
Constructor Detail
-
Vector3
public Vector3(double a0, double a1, double a2)Constructor from 3doubles.
-
Vector3
public Vector3(double[] coords)
Constructor from an array containing 3doubles.- Throws:
java.lang.IllegalArgumentException- ifcoords.length != 3.
-
-
Method Detail
-
toString
public java.lang.String toString()
Returns a String representation of this Vector. The form is :(x0, x1, x2).- Overrides:
toStringin classjava.lang.Object
-
norm
public static double norm(Vector3 v)
Returns the norm of the vector passed in parameter.
-
mul
public static Vector3 mul(Matrix3 M, Vector3 a)
Multiplication of a vector by a matrix ; returns a vector b such as b = M a.
-
mul
public static Vector3 mul(double k, Vector3 a)
Multiplication of a vector by a scalar ; returns a vector b such as b = k a.
-
-
DMelt 3.0 © DataMelt by jWork.ORG