mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 10:17:39 +00:00
Moved Vector.dot further up in the file and added Vector.cross.
This commit is contained in:
parent
4500f93a1b
commit
6bbf167cb4
@ -485,6 +485,30 @@ public class Vector {
|
|||||||
return divide(length());
|
return divide(length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the dot product of this and another vector.
|
||||||
|
*
|
||||||
|
* @param other
|
||||||
|
* @return the dot product of this and the other vector
|
||||||
|
*/
|
||||||
|
public double dot(Vector other) {
|
||||||
|
return x * other.x + y * other.y + z * other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the dot product of this and another vector.
|
||||||
|
*
|
||||||
|
* @param other
|
||||||
|
* @return the dot product of this and the other vector
|
||||||
|
*/
|
||||||
|
public Vector cross(Vector other) {
|
||||||
|
return new Vector(
|
||||||
|
y * other.z + z * other.y,
|
||||||
|
z * other.x + x * other.z,
|
||||||
|
x * other.y + y * other.x
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if a vector is contained with another.
|
* Checks to see if a vector is contained with another.
|
||||||
*
|
*
|
||||||
@ -628,16 +652,6 @@ public class Vector {
|
|||||||
return new Vector2D(x, z);
|
return new Vector2D(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the dot product of this and another vector.
|
|
||||||
*
|
|
||||||
* @param other
|
|
||||||
* @return the dot product of this and the other vector
|
|
||||||
*/
|
|
||||||
public double dot(Vector other) {
|
|
||||||
return x * other.x + y * other.y + z * other.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the minimum components of two vectors.
|
* Gets the minimum components of two vectors.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user