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

Testing...

// 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
,s&d,s&e,s&g,s&h,s&i,s&j){f*p=*m;*p++=a;*p++=b;*p++=c;*p++=d;*p++=e;*p++=g;*p++=
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][
0]+x.z*m[2][0],x.x*m[0][1]+x.y*m[1][1]+x.z*m[2][1],x.x*m[0][2]+x.y*m[1][2]+x.z*m
[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(
y),0,-sin(y),0,1,0,sin(y),0,cos(y))*u(cosf(z),sinf(z),0,-sinf(z),cosf(z),0,0,0,1
);return*this;}void li(){memset(&m,0,36);m[0][0]=m[1][1]=m[2][2]=1;}f m[3][3];};
#endif

Share this post


Link to post
Share on other sites
Advertisement
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!