Assignment 1
Introduction
The aim of this assignment is to develop a set
of mathematical calculation in term of matrix transformation. All of the
transformation are in 2D included translate, scale,
rotate and shear. Other than that student also need to develop a set of
class vector. All of the programming code need to be write by using C++
programming.
Objective
- to refresh back how to do C++ programming.
- to solve the mathematical calculation (matrix)
using programming.
- to develop a set of class vector.
The Problem
This assignment are divided into two parts.
Part 1
Solve all of these problem using C++ programming :-
1. To
translate a point 2D coordinate (30,30) to a new point (?,?). Translation
in x-direction = -18
and translation in y-direction = -15.
2. To scale a point from 2D coordinate (30,30) by 7 in the x-direction and 8 in y-direction
3. To rotate a point from 2D coordinate (30,30) by 35 degrees
4. To
shear a point from 2D coordinate (35,35) by 10.5 in the x-direction and
20.5 in the y-direction
(a = 10.5, b = 20.5)
Part 2
Develop
a class vector that encapsulate the behaviour of a 3D vector i.e (3,4,5).
The vector should contain at
least
the following functionality:-
- Vector Addition
V1 + V2 = (V1x + V2x, V1y + V2y, V1z + V2z)
- Vector Subtraction
V1 - V2 = (V1x - V2x, V1y - V2y, V1z - V2z)
- Cross product
V1 . V2 = (V1x V2x + V1yV2y + V1zV2z)
- Dot Product
V1 x V2 = (V1yV2z - V1zV2y ,V1zV2x - V1xV2z , V1xV2y - V1yV2x)
- Scalar Multiplication
a (V1 ) = ( aV1x , aV2y , aV1z )
- Length of Vector
| V | = sqrt (Vx2 + Vy2 + Vz2 )
Test
all of these functionality using a vector.
Report
An overall project report is required. This should
include:
- A statement of problem AND
- what has been accomplished
- Conclusions, problems, etc.
- Code Listing
Deadline
Work must be submitted to me or En. Zaimufarruddin
by: Saturday 12 July 2003