CIS4930/6930 – Advanced Interactive Graphics and Virtual Environments

Project 1

By Lihan Bin

Introduction

This program simulates Newton’s law of motion by using Augmented Reality technology. The program tracks different markers’ movement and rotation to interact with user. For example, on the first marker, the program renders a surface as well as a ball on it. The user can rotate the marker which will let the surface to rotate. The small ball on the surface will roll along the surface. The user can also create a slope with another marker. Ball may roll onto the slope or hit to it.

Implementation

1.      Calculate the rotation angle of the marker

The ARToolkit recognizes the marker and give the user a matrix which contains position information and rotation information. This matrix transforms from camera coordinates to marker coordinates. The (0,0,0) coordinates is the center of the marker. By decompose the matrix, we can calculate the rotation angle of the marker with respect to the camera as long as the distance.

This is the 4x3 matrix which is calculated by ARToolkit. The left 3x3 matrix is the rotation matrix and the right 1x3 matrix is the translation matrix and each element represents the corresponding x,y,z distance between camera and marker. We can also calculate the corresponding rotation Euler angle by the equations below:

bank = atan2(-r12,r11)
attitude = asin(r10)

The program utilized the method above to calculate the rotation angle of the marker and render a surface on which the ball can roll along.

2.      Collision detection

Since we can get each marker’s relative position, we can convert them to the same coordinates system. Then, we can calculate the distance of each object. If their distance is less than their radius sum, two objects collide.

Video