/** * <code>angleBetween</code> returns (in radians) the angle between two vectors. * It is assumed that both this vector and the given vector are unit vectors (iow, normalized). * * @param otherVector a unit vector to find the angle against * @return the angle in radians. */ public float angleBetween(Vector4f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>angleBetween</code> returns (in radians) the angle between two vectors. * It is assumed that both this vector and the given vector are unit vectors (iow, normalized). * * @param otherVector a unit vector to find the angle against * @return the angle in radians. */ public float angleBetween(Vector3f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>smallestAngleBetween</code> returns (in radians) the minimum * angle between two vectors. It is assumed that both this vector and the * given vector are unit vectors (iow, normalized). * * @param otherVector * a unit vector to find the angle against * @return the angle in radians. */ public float smallestAngleBetween(Vector2f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
public static Quaternion log(Quaternion q, Quaternion store) { float a = FastMath.acos(q.w); float sina = FastMath.sin(a); store.w = 0; if (sina > 0) { store.x = a * q.x / sina; store.y = a * q.y / sina; store.z = a * q.z / sina; } else { store.x = 0; store.y = 0; store.z = 0; } return store; }
angle = (2.0f * FastMath.acos(w)); if (axisStore != null) { float invLength = (1.0f / FastMath.sqrt(sqrLength));
public static Quaternion slerpNoInvert(Quaternion q1, Quaternion q2, float t, Quaternion store) { float dot = q1.dot(q2); if (dot > -0.95f && dot < 0.95f) { float angle = FastMath.acos(dot); float sin1 = FastMath.sin(angle * (1 - t)); float sin2 = FastMath.sin(angle * t); float sin3 = FastMath.sin(angle); store.x = (q1.x * sin1 + q2.x * sin2) / sin3; store.y = (q1.y * sin1 + q2.y * sin2) / sin3; store.z = (q1.z * sin1 + q2.z * sin2) / sin3; store.w = (q1.w * sin1 + q2.w * sin2) / sin3; System.err.println("real slerp"); } else { // if the angle is small, use linear interpolation store.set(q1).nlerp(q2, t); System.err.println("nlerp"); } return store; }
float theta = FastMath.acos(result); float invSinTheta = 1f / FastMath.sin(theta);
float theta = FastMath.acos(dot); float invSinTheta = 1f / FastMath.sin(theta);
float theta = FastMath.acos(result); float invSinTheta = 1f / FastMath.sin(theta);
/** * This method transforms the first line of the bevel points positioning it * on the first point of the curve. * * @param startingLinePoints * the vbevel shape points * @param firstCurvePoint * the first curve's point * @param secondCurvePoint * the second curve's point * @return points of transformed bevel */ protected Vector3f[] transformToFirstLineOfBevelPoints(Vector3f[] startingLinePoints, Vector3f firstCurvePoint, Vector3f secondCurvePoint) { Vector3f planeNormal = secondCurvePoint.subtract(firstCurvePoint).normalizeLocal(); float angle = FastMath.acos(planeNormal.dot(Vector3f.UNIT_X)); Vector3f rotationVector = Vector3f.UNIT_X.cross(planeNormal).normalizeLocal(); Matrix4f m = new Matrix4f(); m.setRotationQuaternion(new Quaternion().fromAngleAxis(angle, rotationVector)); m.setTranslation(firstCurvePoint); Vector3f temp = new Vector3f(); Vector3f[] verts = new Vector3f[startingLinePoints.length]; for (int i = 0; i < verts.length; ++i) { verts[i] = m.mult(startingLinePoints[i], temp).clone(); } return verts; } }
/** * <code>angleBetween</code> returns (in radians) the angle between two vectors. * It is assumed that both this vector and the given vector are unit vectors (iow, normalized). * * @param otherVector a unit vector to find the angle against * @return the angle in radians. */ public float angleBetween(Vector4f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>angleBetween</code> returns (in radians) the angle between two vectors. * It is assumed that both this vector and the given vector are unit vectors (iow, normalized). * * @param otherVector a unit vector to find the angle against * @return the angle in radians. */ public float angleBetween(Vector3f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>angleBetween</code> returns (in radians) the angle between two vectors. * It is assumed that both this vector and the given vector are unit vectors (iow, normalized). * * @param otherVector a unit vector to find the angle against * @return the angle in radians. */ public float angleBetween(Vector4f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>angleBetween</code> returns (in radians) the angle between two vectors. * It is assumed that both this vector and the given vector are unit vectors (iow, normalized). * * @param otherVector a unit vector to find the angle against * @return the angle in radians. */ public float angleBetween(Vector3f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>smallestAngleBetween</code> returns (in radians) the minimum * angle between two vectors. It is assumed that both this vector and the * given vector are unit vectors (iow, normalized). * * @param otherVector * a unit vector to find the angle against * @return the angle in radians. */ public float smallestAngleBetween(Vector2f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
/** * <code>smallestAngleBetween</code> returns (in radians) the minimum * angle between two vectors. It is assumed that both this vector and the * given vector are unit vectors (iow, normalized). * * @param otherVector * a unit vector to find the angle against * @return the angle in radians. */ public float smallestAngleBetween(Vector2f otherVector) { float dotProduct = dot(otherVector); float angle = FastMath.acos(dotProduct); return angle; }
angle = (2.0f * FastMath.acos(w)); if (axisStore != null) { float invLength = (1.0f / FastMath.sqrt(sqrLength));
angle = (2.0f * FastMath.acos(w)); if (axisStore != null) { float invLength = (1.0f / FastMath.sqrt(sqrLength));
float theta = FastMath.acos(result); float invSinTheta = 1f / FastMath.sin(theta);