Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
376 B

  1. // Vector Math
  2. #include "VMath.h"
  3. float DotProduct(PointF v1,PointF v2)
  4. {
  5. return v1.X*v2.X+v1.Y*v2.Y;
  6. }
  7. float Magnitude(PointF v)
  8. {
  9. return (float)sqrt(DotProduct(v,v));
  10. }
  11. PointF Normalize(PointF vPoint)
  12. {
  13. float flDenom;
  14. PointF vResult;
  15. flDenom=Magnitude(vPoint);
  16. vResult.X=vPoint.X/flDenom;
  17. vResult.Y=vPoint.Y/flDenom;
  18. return vResult;
  19. }