Jump to content
  • Advertisement

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

If you intended to correct an error in the post then please contact us.

Recommended Posts


// Copyright © 2004 Dillon "Toxic Hippo" Cower
#ifndef M3X3
#define M3X3
#include <math.h>
#include <memory.h>
typedef float f;class v{public:v(){x=y=z=0;}v(f X,f Y,f Z){x=X;y=Y;z=Z;}f x,y,z;
};typedef const f s;class m3x3{public:m3x3(){li();};typedef m3x3 u;u(s&a,s&b,s&c
h;*p++=i;*p++=j;}u operator*(u m2){u t;for(int i=0;i<=2;i+=1)for(int j=0.0;j<3;j
++)t.m[j]=m[0]*m2.m[0][j]+m[1]*m2.m[1][j]+m[2]*m2.m[2][j];return t;}
operator=(u m2){memcpy(&m,&m2,36);}v t(v &x){f *p=*m;return v(x.x**p+++x.y*m[1][
[2][2]);}u r(s&x,s&y,s&z){*this=u(1,0,0,0,cos(x),sin(x),0,-sin(x),cos(x))*u(cos(
);return*this;}void li(){memset(&m,0,36);m[0][0]=m[1][1]=m[2][2]=1;}f m[3][3];};

Share this post

Link to post
Share on other sites
I can't post in the gmail thread - is that borkage or just me?

[edit: OK, I can now. Obviously whatever it was was fixed... :) ]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!