All pastes #611185 Raw Edit

Something

public text v1 · immutable
·published 2007-07-09 20:20 UTC
rendered paste body
//include guard
//An include guard is a piece of code the ensures that the contents of this header are only included once in your project

#include <iostream>
#include <cmath>
#include<My3DMatrix.h>
#include <My3DVector.h>

Using namespace std;

Enumerated data type;
Enum Transftype = (Scale, Rotate, Translate) ;

My3DVector Operator *(const My3DMatrix& M, const My3DVector& V)

(
	//perform the multiplication
	// return a vector


Int main()
{
	TransfType t= Translate ; 

	My3DVector M ;
            My3DVector V ;

	My3DMatrix Product = M*V ; //multiplication is only defined if
                                                              // Number of columns in M = number of rows in V 

//cout << M.operator() (1,1) <<endl ;
 

TASK
Write a transformation Class that allows 3 types of transformation .. translation, rotation and scaling All in 2D with homogeneous coordinates
//Transformation T(rotation, angle);
//Transformation T2(Scale, sx,sy,) ;
//TransformationT3(translate, tx, ty) ;

//My3DVector V(1.34,2.21,1) ;
//My3DVector RptatedVec = T*V
//My3DVector ScaledVec = T2*V
//My3DVector TranslatedVec = T3*V

Hints 
First create a new editor with class transformation
Then Inside the class have a matrix from my3D matrix object as data member 
Depending on the first argument, fill the matrix elements appropriately
Overload the *operator so it takes Transformation object and My3DVector as argument types. Multiply the matrix that is inside the transformation object with the given My3DVector

1) Finish implementation of Matrices and Vectors
2) Matirx-Vector product
3) Finish transformation class implementation
4) Read up on Stacks
a. Whats is a stack?  It is a datastrucutre
b. Stack class - push, pop, top