HandmadeMath

A simple math library for games and computer graphics. Compatible with both C and C++. Public domain and easy to modify.

CC0-1.0 License

Stars
1.2K

Bot releases are hidden (Show)

HandmadeMath - v2.0.0 Latest Release

Published by bvisness over 1 year ago

After far too long, we are happy to release Handmade Math 2.0. Handmade Math 2.0 introduces the following new features and changes:

  • A concise naming scheme. Handmade Math 1.0 has extremely verbose names. For version 2, we've reworked them to use a terse naming scheme that will make expressions much more readable. Here are some examples:

    • HMM_MultiplyMat4ByVec4 -> HMM_MulM4V4
    • HMM_MultiplyVec3f -> HMM_MulV3F
    • HMM_EqualsVec4 -> HMM_EqV4

    This is obviously an extremely breaking change, but to ease the transition, we provide a tool to automatically rename Handmade Math functions and types in your codebase. See the update folder of the repo.

  • Matrix inverses. We are happy to finally provide our most long-requested feature. We now have a variety of functions for matrix inverses.

  • 2x2 and 3x3 matrices. We now provide types HMM_Mat2 and HMM_Mat3.

  • C11 generics. C programmers can now use "overloaded" functions like HMM_Add instead of HMM_AddV2, HMM_AddV3, etc. Your expressions can now be a little more readable!

  • Consistent (and configurable) angle units. Handmade Math 1.0 used radians for some operations and degrees for others. Handmade Math 2.0 makes all functions use the same angle units - but also makes those units configurable, so you can choose to use radians, degrees, or turns across your codebase. See the documentation in HandmadeMath.h.

  • Left-handed and right-handed operations. Handmade Math 2.0 has both left-handed and right-handed versions of all operations where handedness applies.

This release would not be possible without the help of @dev-dwarf. Many thanks for his contributions!

Other breaking changes:

  • If you use Handmade Math without the standard library, the way you provide custom math functions has changed. You must now #define HANDMADE_MATH_PROVIDE_MATH_FUNCTIONS in addition to #define HMM_SINF etc.
  • HMM_ExpF, HMM_LogF, HMM_Power, and HMM_PowerF have been removed. They were not used internally and provided no benefit.
  • HMM_PREFIX has been removed. If you wish to use a different prefix, find and replace within HandmadeMath.h.
  • Semi-breaking: HMM_InvSqrtF (formerly HMM_RSquareRootF) no longer does a fast inverse square root under any circumstances. It now always does a full-precision square root. This is to ensure consistent results on all platforms.
HandmadeMath - v2.0.0-rc2

Published by bvisness over 1 year ago

This is a release candidate for Handmade Math 2.0. Please try it out and give us feedback.


Changes from last release candidate:

  • The HANDMADE_MATH_USE_NDC_Z01 define has been removed. NDC options are now explicit in the function names, just like handedness. (#154)
  • Issues with the order of operations for SIMD were resolved. (#152)
  • The update tool was rewritten.

After far too long, we are happy to release Handmade Math 2.0. Handmade Math 2.0 introduces the following new features and changes:

  • A concise naming scheme. Handmade Math 1.0 has extremely verbose names. For version 2, we've reworked them to use a terse naming scheme that will make expressions much more readable. Here are some examples:

    • HMM_MultiplyMat4ByVec4 -> HMM_MulM4V4
    • HMM_MultiplyVec3f -> HMM_MulV3F
    • HMM_EqualsVec4 -> HMM_EqV4

    This is obviously an extremely breaking change, but to ease the transition, we provide a tool to automatically rename Handmade Math functions and types in your codebase. See the update folder of the repo.

  • Matrix inverses. We are happy to finally provide our most long-requested feature. We now have a variety of functions for matrix inverses.

  • 2x2 and 3x3 matrices. We now provide types HMM_Mat2 and HMM_Mat3.

  • C11 generics. C programmers can now use "overloaded" functions like HMM_Add instead of HMM_AddV2, HMM_AddV3, etc. Your expressions can now be a little more readable!

  • Consistent (and configurable) angle units. Handmade Math 1.0 used radians for some operations and degrees for others. Handmade Math 2.0 makes all functions use the same angle units - but also makes those units configurable, so you can choose to use radians, degrees, or turns across your codebase. See the documentation in HandmadeMath.h.

  • Left-handed and right-handed operations. Handmade Math 2.0 has both left-handed and right-handed versions of all operations where handedness applies.

This release would not be possible without the help of @dev-dwarf. Many thanks for his contributions!

Other breaking changes:

  • If you use Handmade Math without the standard library, the way you provide custom math functions has changed. You must now #define HANDMADE_MATH_PROVIDE_MATH_FUNCTIONS in addition to #define HMM_SINF etc.
  • HMM_ExpF, HMM_LogF, HMM_Power, and HMM_PowerF have been removed. They were not used internally and provided no benefit.
  • HMM_PREFIX has been removed. If you wish to use a different prefix, find and replace within HandmadeMath.h.
  • Semi-breaking: Vector length and normalization now uses fast inverse square root by default. This reduces precision, but should still be precise enough for games and graphics applications. (It's also the same level of precision as GLM.)
HandmadeMath - 2.0.0-rc1

Published by bvisness over 1 year ago

This is a release candidate for Handmade Math 2.0. Please try it out and give us feedback.


After far too long, we are happy to release Handmade Math 2.0. Handmade Math 2.0 introduces the following new features and changes:

  • A concise naming scheme. Handmade Math 1.0 has extremely verbose names. For version 2, we've reworked them to use a terse naming scheme that will make expressions much more readable. Here are some examples:

    • HMM_MultiplyMat4ByVec4 -> HMM_MulM4V4
    • HMM_MultiplyVec3f -> HMM_MulV3F
    • HMM_EqualsVec4 -> HMM_EqV4

    This is obviously an extremely breaking change, but to ease the transition, we provide a tool to automatically rename Handmade Math functions and types in your codebase. See the update folder of the repo.

  • Matrix inverses. We are happy to finally provide our most long-requested feature. We now have a variety of functions for matrix inverses.

  • 2x2 and 3x3 matrices. We now provide types HMM_Mat2 and HMM_Mat3.

  • C11 generics. C programmers can now use "overloaded" functions like HMM_Add instead of HMM_AddV2, HMM_AddV3, etc. Your expressions can now be a little more readable!

  • Consistent (and configurable) angle units. Handmade Math 1.0 used radians for some operations and degrees for others. Handmade Math 2.0 makes all functions use the same angle units - but also makes those units configurable, so you can choose to use radians, degrees, or turns across your codebase. See the documentation in HandmadeMath.h.

  • Left-handed and right-handed operations. Handmade Math 2.0 has both left-handed and right-handed versions of all operations where handedness applies.

This release would not be possible without the help of @dev-dwarf. Many thanks for his contributions!

Other breaking changes:

  • If you use Handmade Math without the standard library, the way you provide custom math functions has changed. You must now #define HANDMADE_MATH_PROVIDE_MATH_FUNCTIONS in addition to #define HMM_SINF etc.
  • HMM_ExpF, HMM_LogF, HMM_Power, and HMM_PowerF have been removed. They were not used internally and provided no benefit.
  • HMM_PREFIX has been removed. If you wish to use a different prefix, find and replace within HandmadeMath.h.
  • Semi-breaking: Vector length and normalization now uses fast inverse square root by default. This reduces precision, but should still be precise enough for games and graphics applications. (It's also the same level of precision as GLM.)
HandmadeMath - 1.13.0

Published by StrangeZak about 3 years ago

HandmadeMath - 1.12.0

Published by bvisness over 3 years ago

Added Unary Minus operator for HMM_Vec2, HMM_Vec3, and HMM_Vec4.

HandmadeMath - 1.11.1

Published by bvisness over 4 years ago

  • Added HMM_PREFIX to a few functions that were missing it (#120)
HandmadeMath -

Published by bvisness over 4 years ago

  • Added ability to customize or remove the default HMM_ prefix on function names by defining a macro called HMM_PREFIX(name).
HandmadeMath - 1.10.0

Published by bvisness over 5 years ago

  • Made HMM_Perspective use vertical FOV instead of horizontal FOV for consistency with other graphics APIs.
HandmadeMath - 1.9.0

Published by bvisness over 5 years ago

  • Added SSE versions of quaternion operations.

Thanks to @AntonDan for his contributions.

HandmadeMath - 1.8.0

Published by bvisness over 5 years ago

  • Added fast vector normalization routines that use fast inverse square roots.
HandmadeMath - 1.7.1

Published by bvisness almost 6 years ago

  • Changed operator[] to take a const ref int instead of an int.
HandmadeMath - 1.7.0

Published by bvisness about 6 years ago

  • Renamed the Rows member of hmm_mat4 to Columns. Since our matrices are column-major, this should have been named Columns from the start. Rows is still present, but has been deprecated.
HandmadeMath - 1.6.0

Published by bvisness over 6 years ago

  • Added array subscript operators for vector and matrix types in C++. This is provided as a convenience, but be aware that it may incur an extra function call in unoptimized builds.
HandmadeMath - 1.5.1

Published by bvisness over 6 years ago

  • Fixed a bug with uninitialized elements in HMM_LookAt.
HandmadeMath - 1.5.0

Published by bvisness almost 7 years ago

  • Changed internal structure for better performance and inlining.
    • As a result, HANDMADE_MATH_NO_INLINE has been removed and no longer has any effect.
HandmadeMath - 1.2.0

Published by bvisness over 7 years ago

  • Added equality functions for HMM_Vec2, HMM_Vec3, and HMM_Vec4.
    • Added HMM_EqualsVec2, HMM_EqualsVec3, and HMM_EqualsVec4
    • Added C++ overloaded HMM_Equals for all three
    • Added C++ == and != operators for all three
  • SSE'd HMM_MultiplyMat4 (this is WAY faster)
  • SSE'd HMM_Transpose
HandmadeMath - 1.1.5

Published by bvisness over 7 years ago

  • Added Width and Height to HMM_Vec2
  • Made it so you can supply your own SqrtF