NxOgre.org

Betajaen’s Math Library

BML is a set of math related header-only C++ files that come with NxOgre. Licensed under the LGPL you can include it in your code if you so wish. This article is concerned however using it with NxOgre, and using it in your code.

The namespace and classes

Since bml is template based, NxOgre automatically sets up and uses several typedef classes;

  • Vec2 (Math vector of 2 real numbers)
  • Vec3 (Math vector of 3 real numbers)
  • Vec4 (Math vector of 4 real numbers)
  • Quat (A quaternion)

Simply put, BML has very flexible functions

using namespace NxOgre;
Vec2 v2(1.0, -2.0f);
v2.set(3.14, 456789);
v2.y = 5;
v2.magnitude();

Using BML with your math classes.

BML has several functions to quickly transfer the values between BML and your classes back and forth.

Using Ogre as an example.


NxOgre::Vec3 bml_vec3(1.0, 2.0, 3.0);
Ogre::Vector3 ogre_vector3(bml_vec3.as<Ogre::Vector3>());

BML to Ogre::Vector3

Ogre::Vector3 ogre_vector3(3.0, 4.0, 5.0);
NxOgre::Vec3 bml_vec3(ogre_vector3);

Ogre::Vector3 to BML

IndexWhat is NxOgre?Guides and TutorialsDownloadForums