#### Archived

This topic is now archived and is closed to further replies.

# matrices

This topic is 5638 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

For those of you who code without the assistance of a graphics API, would you care to help me out a bit with matrices? I''m wondering how people usually implement matrices in their systems. I have a 4x4 matrix struct, and overloaded + and * operators right now. I think it works as I need it to, but I''m wondering how others have done it.

##### Share on other sites
I don''t know what you really want, but I designed my matrix class to work with DirectX, but I suspect you could talor it to mix with others as well. This is what I am currently using...

void scale( double a );
void scale( double sx= 1, double sy= 1, double sz= 1, double sw= 1 );
void rotate( double x, double y, double z );
void translate( double x, double y, double z );
void perspective( double v, double h, double near, double far );
void perspectiveFov( double fov, double aspect, double zn, double zf );
void perspectivePrism( double xmin, double xmax, double ymin, double ymax, double zn, double zf );
void viewport( Vector eye, Vector at, Vector up );
void ortho( double w, double h, double zn, double zf );
void orthoPrism( double xmin, double xmax, double ymin, double ymax, double zn, double zf );
Matrix identity( void );
Matrix inverse( void );

Matrix operator + (Matrix m);
Matrix operator - (Matrix m);
Matrix operator * (Matrix m);

This is for no reason all that you would need.

##### Share on other sites
You should take a look at how DirectX does it, and the "extra" part that takes advantage of C++ functions (I forgot its name)

##### Share on other sites
I''m looking for info on how the actual struct or class is set up.

##### Share on other sites
You can open the D3DX (the helper library) header files at your leasure.

I''ve checked once, and there wasn''t any particular trick. They just did the obvious, but didn''t overload the * operator, because the temporaries created would have slowed down the calculations, I think.

Cédric

1. 1
2. 2
3. 3
Rutin
20
4. 4
khawk
14
5. 5

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633655
• Total Posts
3013187
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!