Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#ZERO_NORM_FOR_ROTATION_AXIS
The following examples show how to use
org.apache.commons.math3.exception.util.LocalizedFormats#ZERO_NORM_FOR_ROTATION_AXIS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldRotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(FieldVector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public FieldRotation(final FieldVector3D<T> axis, final T angle) throws MathIllegalArgumentException { final T norm = axis.getNorm(); if (norm.getReal() == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } final T halfAngle = angle.multiply(-0.5); final T coeff = halfAngle.sin().divide(norm); q0 = halfAngle.cos(); q1 = coeff.multiply(axis.getX()); q2 = coeff.multiply(axis.getY()); q3 = coeff.multiply(axis.getZ()); }
Example 2
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 3
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 4
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 5
Source File: FieldRotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(FieldVector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public FieldRotation(final FieldVector3D<T> axis, final T angle) throws MathIllegalArgumentException { final T norm = axis.getNorm(); if (norm.getReal() == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } final T halfAngle = angle.multiply(-0.5); final T coeff = halfAngle.sin().divide(norm); q0 = halfAngle.cos(); q1 = coeff.multiply(axis.getX()); q2 = coeff.multiply(axis.getY()); q3 = coeff.multiply(axis.getZ()); }
Example 6
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 7
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 8
Source File: FieldRotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(FieldVector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public FieldRotation(final FieldVector3D<T> axis, final T angle) throws MathIllegalArgumentException { final T norm = axis.getNorm(); if (norm.getReal() == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } final T halfAngle = angle.multiply(-0.5); final T coeff = halfAngle.sin().divide(norm); q0 = halfAngle.cos(); q1 = coeff.multiply(axis.getX()); q2 = coeff.multiply(axis.getY()); q3 = coeff.multiply(axis.getZ()); }
Example 9
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 10
Source File: FieldRotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(FieldVector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public FieldRotation(final FieldVector3D<T> axis, final T angle) throws MathIllegalArgumentException { final T norm = axis.getNorm(); if (norm.getReal() == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } final T halfAngle = angle.multiply(-0.5); final T coeff = halfAngle.sin().divide(norm); q0 = halfAngle.cos(); q1 = coeff.multiply(axis.getX()); q2 = coeff.multiply(axis.getY()); q3 = coeff.multiply(axis.getZ()); }
Example 11
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }
Example 12
Source File: FieldRotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(FieldVector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public FieldRotation(final FieldVector3D<T> axis, final T angle) throws MathIllegalArgumentException { final T norm = axis.getNorm(); if (norm.getReal() == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } final T halfAngle = angle.multiply(-0.5); final T coeff = halfAngle.sin().divide(norm); q0 = halfAngle.cos(); q1 = coeff.multiply(axis.getX()); q2 = coeff.multiply(axis.getY()); q3 = coeff.multiply(axis.getZ()); }
Example 13
Source File: Rotation.java From astor with GNU General Public License v2.0 | 4 votes |
/** Build a rotation from an axis and an angle. * <p>We use the convention that angles are oriented according to * the effect of the rotation on vectors around the axis. That means * that if (i, j, k) is a direct frame and if we first provide +k as * the axis and π/2 as the angle to this constructor, and then * {@link #applyTo(Vector3D) apply} the instance to +i, we will get * +j.</p> * <p>Another way to represent our convention is to say that a rotation * of angle θ about the unit vector (x, y, z) is the same as the * rotation build from quaternion components { cos(-θ/2), * x * sin(-θ/2), y * sin(-θ/2), z * sin(-θ/2) }. * Note the minus sign on the angle!</p> * <p>On the one hand this convention is consistent with a vectorial * perspective (moving vectors in fixed frames), on the other hand it * is different from conventions with a frame perspective (fixed vectors * viewed from different frames) like the ones used for example in spacecraft * attitude community or in the graphics community.</p> * @param axis axis around which to rotate * @param angle rotation angle. * @exception MathIllegalArgumentException if the axis norm is zero */ public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException { double norm = axis.getNorm(); if (norm == 0) { throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS); } double halfAngle = -0.5 * angle; double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY(); q3 = coeff * axis.getZ(); }