talira

vector_math

Vector and matrix maths for 2D and 3D Dart applications

open sourceBSD-3-Clausefree

vector_math is the Flutter team's Dart library of vector and matrix maths for 2D and 3D applications. It has 2D, 3D and 4D vector and matrix types, a quaternion type for animating rotations, collision detection with axis-aligned bounding boxes, rays and spheres, and color and rendering utilities, with GLSL-style swizzling getters and setters such as position.xwz = color.grb. Flutter and the Flame game engine use it.

Problems it solves

  • do 3D vector and matrix maths in Dart
  • rotate and transform points with matrices in a Flutter app
  • detect collisions between boxes, rays and spheres in a Dart game

Features

  • 2D, 3D and 4D vector and matrix types
  • quaternions for rotations
  • collision detection with AABBs, rays and spheres
  • color and rendering utilities
  • GLSL-style swizzling getters and setters

Limitations

  • Requires Dart SDK 3.12 or newer1