/** * Transforms the x coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param x The x coordinate of the original vector * @param y The y coordinate of the original vector * @return The transformed x coordinate */ public int transformX(int x, int y) { return GenericMath.floor(this.matrixRow0.dot(x, y, 1) + GenericMath.FLT_EPSILON); }
/** * Transforms the y coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param x The x coordinate of the original vector * @param y The y coordinate of the original vector * @return The transformed y coordinate */ public int transformY(int x, int y) { return GenericMath.floor(this.matrixRow1.dot(x, y, 1) + GenericMath.FLT_EPSILON); }
public double dot(Vector3d v) { return dot(v.x, v.y, v.z); }
public double dot(float x, float y, float z) { return dot((double) x, (double) y, (double) z); }
public double dot(float x, float y, float z) { return dot((double) x, (double) y, (double) z); }
public double dot(Vector3d v) { return dot(v.x, v.y, v.z); }
/** * Transforms the x coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param x The x coordinate of the original vector * @param y The y coordinate of the original vector * @return The transformed x coordinate */ public int transformX(int x, int y) { return GenericMath.floor(this.matrixRow0.dot(x, y, 1) + GenericMath.FLT_EPSILON); }
public Vector3d project(double x, double y, double z) { final double lengthSquared = x * x + y * y + z * z; if (Math.abs(lengthSquared) < GenericMath.DBL_EPSILON) { throw new ArithmeticException("Cannot project onto the zero vector"); } final double a = dot(x, y, z) / lengthSquared; return new Vector3d(a * x, a * y, a * z); }
/** * Transforms the y coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param x The x coordinate of the original vector * @param y The y coordinate of the original vector * @return The transformed y coordinate */ public int transformY(int x, int y) { return GenericMath.floor(this.matrixRow1.dot(x, y, 1) + GenericMath.FLT_EPSILON); }
public Vector3d project(double x, double y, double z) { final double lengthSquared = x * x + y * y + z * z; if (Math.abs(lengthSquared) < GenericMath.DBL_EPSILON) { throw new ArithmeticException("Cannot project onto the zero vector"); } final double a = dot(x, y, z) / lengthSquared; return new Vector3d(a * x, a * y, a * z); }
/** * Creates a new complex from the angle defined from the first to the second vector. * * @param from The first vector * @param to The second vector * @return The complex defined by the angle between the vectors */ public static Complexd fromRotationTo(Vector3d from, Vector3d to) { return fromAngleRad(TrigMath.acos(from.dot(to) / (from.length() * to.length()))); }
/** * Creates a new complex from the angle defined from the first to the second vector. * * @param from The first vector * @param to The second vector * @return The complex defined by the angle between the vectors */ public static Complexd fromRotationTo(Vector3d from, Vector3d to) { return fromAngleRad(TrigMath.acos(from.dot(to) / (from.length() * to.length()))); }
/** * Creates a new quaternion from the angle-axis rotation defined from the first to the second vector. * * @param from The first vector * @param to The second vector * @return The quaternion defined by the angle-axis rotation between the vectors */ public static Quaterniond fromRotationTo(Vector3d from, Vector3d to) { return Quaterniond.fromAngleRadAxis(TrigMath.acos(from.dot(to) / (from.length() * to.length())), from.cross(to)); }
/** * Creates a new quaternion from the angle-axis rotation defined from the first to the second vector. * * @param from The first vector * @param to The second vector * @return The quaternion defined by the angle-axis rotation between the vectors */ public static Quaterniond fromRotationTo(Vector3d from, Vector3d to) { return Quaterniond.fromAngleRadAxis(TrigMath.acos(from.dot(to) / (from.length() * to.length())), from.cross(to)); }