1 / 28

CS361

Week 4 - Friday. CS361. Last time. What did we talk about last time? Texturing in XNA Homogeneous notation Geometric techniques Lines (2D and 3D) Planes. Questions?. Project 1. Implicit planes.

Download Presentation

CS361

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Week 4 - Friday CS361

  2. Last time • What did we talk about last time? • Texturing in XNA • Homogeneous notation • Geometric techniques • Lines (2D and 3D) • Planes

  3. Questions?

  4. Project 1

  5. Implicit planes • The implicit equation for a plane is just like the implicit for a line, except with an extra dimension • Let n be a vector (a, b, c) • Let p be a point (x, y, z) • p is on plane π if and only if • n • p + d = 0 • Since n is the normal of the plane we can compute it in a couple of ways: • n = s x t where s and t span the plane • n = (u – w) x (v – w) where u, v, and w are noncollinear points in the plane

  6. Implicit plane function • Again, it works just like a line • If we write f(p) = n • p + d • Assuming q plane π • f(p) = 0 iffp π • f(p) > 0 iffp lies on the same side as the point q + n • f(p) < 0 iffp lies on the same side as the point q - n • f(p) again gives a (scaled) measure of the perpendicular distance from p to π • Distance(p) = f(p)/||n|| • This implies that Distance(0) = d, making d the shortest distance from the origin to the plane

  7. Cross product • The cross product of two vectors finds a vector that is orthogonal to both • For 3D vectors u and v in an orthonormal basis, the cross product w is:

  8. Practice with a plane • Plane defined by: • (1, 3, 2) • (2, 5, 2) • (3, 8, 2) • Where is (3, 3, 2)? • What about (3, 4, 5)?

  9. Student Lecture: Basic Transforms

  10. Transforms

  11. Transforms • A transform is an operation that changes points, vectors or colors • We can use them to position and animate objects, lights, and cameras • A linear transform is one that holds over vector addition and scalar multiplication • Rotation • Scaling • Can be represented by a 3 x 3 matrix

  12. Affine transforms • Adding a vector after a linear transform makes an affine transform • Affine transforms can be stored in a 4 x 4 matrix using homogeneous notation • Affine transforms: • Translation • Rotation • Scaling • Reflection • Shearing

  13. List of transforms

  14. Translation • Move a point from one place to another by vector t = (tx, ty, tz) • We can represent this with translation matrix T

  15. Rotation • Rotation, like translation, is a rigid-body transform (points don't change distance from each other and handedness doesn't change) • An orientation matrix is used to define up and forward (usually for a camera) • We usually express rotation in terms of 3 separate x, y, and z rotation matrices

  16. Rotation matrices

  17. Rotation around a point • Usually all the rotations are multiplied together before translations • But if you want to rotate around a point • Translate so that that point lies at the origin • Perform rotations • Translate back

  18. Scaling • Scaling is easy and can be done for all axes as the same time with matrix S • If sx = sy = sz, the scaling is called uniform or isotropic and nonuniform or anisotropic otherwise

  19. Shearing • A shearing transform distorts one dimension in terms of another with parameter s • Thus, there are six shearing matrices Hxy(s), Hxz(s), Hyx(s), Hyz(s), Hzx(s), and Hzy(s) • Here's an example of Hxz(s):

  20. To make a shearing matrix • To make Hij(s), start with the identity matrix and put s in row i, column j • See how the only the affected dimension changes

  21. Concatenation of transforms • Because matrix multiplications are not commutative, order of transforms matters • Still, parts (or the entirety) of the transform can be precomputed and stored as a single matrix • Note that matrices are applied from right to left, thus TRSp scales point p, rotates it, then translates it

  22. Non-commutativity of transforms • This example from the book shows how the same sets of transforms, applied in different orders, can have different outcomes

  23. Rigid-body transforms • A rigid-body transform preserves lengths, angles, and handedness • We can write any rigid-body transform X as a translation matrix T(t) multiplied by a rotation matrix R

  24. Inverse of a rigid-body transform • Because R is orthogonal, its inverse is its transpose • Because of the nature of a translation, its inverse is just its negative • Thus, the inverse of X is • X-1 = (T(t)R)-1 = R-1T(t)-1 = RTT(-t)

  25. Transforms in XNA

  26. Upcoming

  27. Next time… • Normal transforms • Inverses • Euler transform • Matrix decomposition • Rotation around an arbitrary axis • Quaternions

  28. Reminders • Keep reading Chapter 4 • Finish Project 1, due tonight by 11:59

More Related