Home | History | Annotate | Download | only in math

Lines Matching refs:angles

160      * collection of rotation angles.

162 * @param angles
163 * the angles of rotation (x, y, z) that will define the
166 public Quaternion(float[] angles) {
167 fromAngles(angles);
220 * angles (y,r,p).
222 * @param angles
223 * the Euler angles of rotation (in radians).
225 public Quaternion fromAngles(float[] angles) {
226 if (angles.length != 3) {
228 "Angles array must have three elements");
231 return fromAngles(angles[0], angles[1], angles[2]);
236 * angles (y,r,p). Note that we are applying in order: roll, pitch, yaw but
280 * rotation angles (yaw,roll,pitch).<br/>
283 * @param angles
284 * the float[] in which the angles should be stored, or null if
286 * @return the float[] in which the angles are stored.
288 public float[] toAngles(float[] angles) {
289 if (angles == null) {
290 angles = new float[3];
291 } else if (angles.length != 3) {
292 throw new IllegalArgumentException("Angles array must have three elements");
303 angles[1] = 2 * FastMath.atan2(x, w);
304 angles[2] = FastMath.HALF_PI;
305 angles[0] = 0;
307 angles[1] = -2 * FastMath.atan2(x, w);
308 angles[2] = -FastMath.HALF_PI;
309 angles[0] = 0;
311 angles[1] = FastMath.atan2(2 * y * w - 2 * x * z, sqx - sqy - sqz + sqw); // roll or heading
312 angles[2] = FastMath.asin(2 * test / unit); // pitch or attitude
313 angles[0] = FastMath.atan2(2 * x * w - 2 * y * z, -sqx + sqy - sqz + sqw); // yaw or bank
315 return angles;