/** * Sets this quaternion to the rotation of (0, 0, -1) onto the supplied normalized vector. * * @return a reference to the quaternion, for chaining. */ public Quaternion fromVectorFromNegativeZ (float tx, float ty, float tz) { float angle = FloatMath.acos(-tz); if (angle < MathUtil.EPSILON) { return set(IDENTITY); } if (angle > FloatMath.PI - MathUtil.EPSILON) { return set(0f, 1f, 0f, 0f); // 180 degrees about y } float len = FloatMath.hypot(tx, ty); return fromAngleAxis(angle, ty/len, -tx/len, 0f); }
/** * Sets this quaternion to the rotation of (0, 0, -1) onto the supplied normalized vector. * * @return a reference to the quaternion, for chaining. */ public Quaternion fromVectorFromNegativeZ (float tx, float ty, float tz) { float angle = FloatMath.acos(-tz); if (angle < MathUtil.EPSILON) { return set(IDENTITY); } if (angle > FloatMath.PI - MathUtil.EPSILON) { return set(0f, 1f, 0f, 0f); // 180 degrees about y } float len = FloatMath.hypot(tx, ty); return fromAngleAxis(angle, ty/len, -tx/len, 0f); }
float len = FloatMath.hypot(a, b); if (len < MathUtil.EPSILON) { // start equals end; check as circle return getIntersection(start, radius, result);
float len = FloatMath.hypot(a, b); if (len < MathUtil.EPSILON) { // start equals end; check as circle return getIntersection(start, radius, result);