week 4 friday n.
Skip this Video
Download Presentation

Loading in 2 Seconds...

play fullscreen
1 / 28

CS361 - PowerPoint PPT Presentation

  • Uploaded on

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.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'CS361' - yuki

Download Now 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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
last time
Last time
  • What did we talk about last time?
  • Texturing in XNA
  • Homogeneous notation
  • Geometric techniques
    • Lines (2D and 3D)
    • Planes
implicit planes
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
implicit plane function
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
cross product
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:
practice with a plane
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)?
  • 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
affine transforms
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
  • Move a point from one place to another by vector t = (tx, ty, tz)
  • We can represent this with translation matrix T
  • 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
rotation around a point
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
  • 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
  • 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):
to make a shearing matrix
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
concatenation of transforms
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
non commutativity of transforms
Non-commutativity of transforms
  • This example from the book shows how the same sets of transforms, applied in different orders, can have different outcomes
rigid body transforms
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
inverse of a rigid body transform
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)
next time
Next time…
  • Normal transforms
  • Inverses
  • Euler transform
  • Matrix decomposition
  • Rotation around an arbitrary axis
  • Quaternions
  • Keep reading Chapter 4
  • Finish Project 1, due tonight by 11:59