Hey guys, I'm new to c++ and need to create a math library that is capable of doing the following tasks:

Create an Identity Matric

Create a Translation Matrix

Create a scaling Matric (uniform)

Create a Shear Matrix (non-uniform scaling)

Create a Rotation Matrix (about individual axis)

So far I have the following code but I'm fairly sure it's wrong as I get error messages and I know at some point I am going to need to use pointers and more void vectors.

#include <iostream>

#include <math.h>

class Vector2

{

float x;

float y;

float length;

float lengthSquared;

public:

Vector2::Vector2(float xValue, float yValue)

{

xValue = x;

yValue = y;

}

Vector2::~Vector2()

{

}

float GetMagnitude()

{

length = sqrt( ( x*x ) + ( y*y ) );

}

float GetMagnitudeSquared()

{

lengthSquared = x*x + y*y;

}

void Normalise(float normal)

{

length = GetMagnitude();

normal.x = x / length;

normal.y = y / length;

}

};

If you guys could give me tips, point me in the right direction or even flesh it out for me as to give me an idea of what I'm doing wrong/next I would really appreciate it.

Create an Identity Matric

Create a Translation Matrix

Create a scaling Matric (uniform)

Create a Shear Matrix (non-uniform scaling)

Create a Rotation Matrix (about individual axis)

So far I have the following code but I'm fairly sure it's wrong as I get error messages and I know at some point I am going to need to use pointers and more void vectors.

#include <iostream>

#include <math.h>

class Vector2

{

float x;

float y;

float length;

float lengthSquared;

public:

Vector2::Vector2(float xValue, float yValue)

{

xValue = x;

yValue = y;

}

Vector2::~Vector2()

{

}

float GetMagnitude()

{

length = sqrt( ( x*x ) + ( y*y ) );

}

float GetMagnitudeSquared()

{

lengthSquared = x*x + y*y;

}

void Normalise(float normal)

{

length = GetMagnitude();

normal.x = x / length;

normal.y = y / length;

}

};

If you guys could give me tips, point me in the right direction or even flesh it out for me as to give me an idea of what I'm doing wrong/next I would really appreciate it.

How would I go about that? looked it up and all I can find is 2 youtube videos which arn't exactly great.

Topic archived. No new replies allowed.