Vector Normalising Problems

This is an old ar­ti­cle from 2012. I was a kid. I learned a lot since then, so please do think twice when tak­ing ad­vice from me as a kid.

Yeah, sure, this guy can’t even do such a sim­ple thing as nor­mal­iz­ing vec­tors?

No, the math was not the prob­lem, trust me ;)

I kept get­ting a vec­tor with 2 nan com­po­nents. Sad­ly I spent about 3 hours look­ing for the prob­lem, think­ing this could not be pos­si­ble, un­til I re­al­ized, that the length was 0 in most cas­es…

So: To­day I learned that the re­sult of a di­vi­sion by 0 is nan.

… bet­ter late than nev­er ;P

This post was im­port­ed from tum­blr

Tumblr

Archived blog posts from squareys.tum­blr.com.