Jump to content
  • Advertisement
Sign in to follow this  

Vector class, overriding the - operator

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

Hi, I'm still trying to find the problem with my messed up normals, and I've managed to trace the problem to my vector class. I'm using the following code to override the minus operator:
	Temp.i = i - Vector.i;
	Temp.k = j - Vector.j;
	Temp.j = k - Vector.k;

	return Temp;

Very simple. However, the following two expressions give me different results, yet in practice they are exactly the same:
SYM_VECTOR v1, v2, v3, b1, b2;

b1 = v2 - v1;
b2 = v3 - v1;

SYM_VECTOR v1, v2, v3, b1, b2;

b1.i = v2.i - v1.i;
b1.j = v2.j - v1.j;
b1.k = v2.k - v1.k;

b2.i = v3.i - v1.i;
b2.j = v3.j - v1.j;
b2.k = v3.k - v1.k;

Any help appreciated.

Share this post

Link to post
Share on other sites
Original post by deadstarI think I need sleep. I've scanned over that function over 20 times :/

Haha. Been there.

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!