Math library

A SIMD-optimized math library for renderers. More...


 Math object types
 Basic math objects.
 Default types
 Default math object types.
 Math utility
 Math functions for various basic types.


 Utility functions for vector and matrix types.


struct  Bound
 Axis-aligned bounding box. More...
class  Distribution1D
 Discrete 1D distribution. More...
class  Random
 Random number generator. More...
class  Sampler
 Utility function for samplers. More...

Detailed Description

A SIMD-optimized math library for renderers.

Math library is the basic constructs for everywhere in the framework. We offer the simple yet moderately optimized math library, specified for implementing various components in the framework. The interface design is heavily inspired by glm. So those who are familiar with glm would find it easy to use this library.


The library offers configuration to the precision of the floating-point types. We can control the underlying floating point types of the framework with build parameters for CMake. Options:

  • -D LM_USE_DOUBLE_PRECISION specifies to use double precision floating-point type.
  • -D LM_USE_SINGLE_PRECISION specifies to use single precision floating-point type.

SIMD optimization

We can use SIMD-optimized functions for various operations. We can control the SIMD optimization for basic math types (e.g., Vec3, Mat3, etc.) with the Opt template argument. The optimization is currently supported only on x86 environment with two modes: (1) SSE for the environment supporting SSE2, SSE3, and SSE4.*, and (2) AVX for the environment supporting AVX and AVX2. These mode can be controlled by the build options for CMake:

  • -D LM_USE_SSE to use SSE types (LM_USE_SINGLE_PRECISION must be defined)
  • -D LM_USE_AVX to use AVX types (LM_USE_DOUBLE_PRECISION must be defined)