Jump to content
  • Advertisement
Sign in to follow this  

cofactor booyashaka

This topic is 4493 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

I got this cofactor working without errors and i get a numbers back. Is there a way you can tell your getting the correct numbers back. Cuz they dont look right ?
float MatrixCofactor(Matrix &jug, int row, int col){
	Matrix naix;
	int counterr = 0;
	int counterc = 0;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			if((row != i) && (col != j)){
				naix.m33[counterr][counterc] = jug.m33[j];
		if(row == j){
			counterc = 0;}
	float leo = {(  naix.m33[0][0] * naix.m33[1][1] * naix.m33[2][2])
					+(naix.m33[0][1] * naix.m33[1][2] * naix.m33[2][0])
					+(naix.m33[0][2] * naix.m33[1][0] * naix.m33[2][1])
					-(naix.m33[0][0] * naix.m33[1][2] * naix.m33[2][1])
					-(naix.m33[0][1] * naix.m33[1][0] * naix.m33[2][2])
					-(naix.m33[0][2] * naix.m33[1][1] * naix.m33[2][2])};
	return leo;
void XcoFactor(Matrix &jug){
	Matrix tmp;
	int col = 0;
int row = 0;
	CopyMatrix(jug, tmp);
	for(row = 0; row < 4; row++){
		for(col = 0; col < 4; col++){
			jug.m33[row][col] = MatrixCofactor(tmp, row, col);

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!