# teaching machines

## Deriving the View Matrix

Computer graphics is less about knowing when to apply algorithms and more about knowing where. There are many possible wheres. Our 3D models are born in model space. To situate models in the virtual world, their model space coordinates are transformed into world space. Many lighting algorithms are applied in camera or eye space. From […]

## Triangular Colors

Last week I was trying to think of boolean predicates that I could use for exercises in an introductory programming class. I remembered the triangle inequality, which states how the lengths of three line segments must relate if they are to be formed into a triangle. In short, each segment must be shorter than the […]

## Clockwork

My dream some day is to teach CS 491: Bad GUIs. We would learn the principles of good interface design by examining (and implementing!) terrible user interfaces. The first assignment would be to design an unreadable clock widget. Perhaps like this one: If it’s not terrible enough, reload the page. I saw a clock like […]

## Eyes Saw a Mouse

Mostly I made this because I miss solving math problems.

## Fitting a Rectangle Inside a Rectangle

A common problem in computer graphics and user interfaces is scaling one rectangle to fit inside another—preserving the rectangle’s aspect ratio. For example, I’ve encountered this problem in the following situations: Placing an image of arbitrary size on a button of fixed size. Overlay a map on a corner of a game scene. Squeezing an image […]

## F1 Carissa

Although this was a fairly simple feature to implement, I did run into a few weird problems. For instance, when I first had made the item in Blender and exported it, it was only showing the top view, not the front view. To fix this, I switched around the x, y and z coordinates in […]

## Right-handed Coordinate System

The definitions of left- and right-handed coordinate systems never clear anything up for me. Following is my current understanding of how the systems are determined and why they are given their names. A right-handed coordinate system is one that can be modeled on your right hand. Point your index finger along the positive x-axis ([1 0 […]

## Zooming to Target Rectangle

A student of mine was telling me about a sticky note app he was working on. When he tapped on a note, he wanted to animate its filling the screen. The drawing library we’re using supports all the standard transformations and includes the ability to set the pivot point about which scaling and rotation occur. […]

## Computer Graphics Proofs

Inverse of rotation/translation matrix Occasionally I need to be back out of eye space and get back to object space, so I need the inverse of my modelview matrix. Finding an arbitrary inverse is non-trivial, but finding the inverse of a matrix that simply rotates and translates is simpler. Inverting a matrix product Inverting a […]

## A logarithmic data usage graph?

Getting a new phone last week meant getting a capped data plan. That made me a Paranoid Android user. Luckily, I saw that there was data usage graph available under Settings: Unluckily, someone thought a logarithmic scale would be effective here. To match, I think I’ll have to make my data usage exponential as the […]