BSNS102 Study Guide - Final Guide: Rotation Matrix, Common Subexpression Elimination, Angle Of Rotation

33 views4 pages

Document Summary

// and a rotation matrix r and then creating the matrix. // as the concatenation of tr tx = -(pos. x*m11 + pos. y*m21 + pos. z*m31); ty = -(pos. x*m12 + pos. y*m22 + pos. z*m32); tz = -(pos. x*m13 + pos. y*m23 + pos. z*m33); // setup the matrix to perform a rotation about a cardinal axis. // the axis of rotation is specified using a 1-based index: // setup the matrix to perform a rotation about an arbitrary axis. // the axis of rotation must pass through the origin. // axis defines the axis of rotation, and must be a unit vector. // theta is the amount of rotation, in radians. // get sin and cosine of rotation angle float s, c; sincos(&s, &c, theta); // compute 1 - cos(theta) and some common subexpressions float a = 1. 0f - c; float ax = a * axis. x; float ay = a * axis. y; float az = a * axis. z;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents