# rustgd/cgmath

A linear algebra and mathematics library for computer graphics.

Repository: https://github.com/rustgd/cgmath
Canonical: https://ross.abutalabs.com/products/cgmath
Homepage: https://docs.rs/cgmath
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: rust, linear-algebra, matrix, vector, computer-graphics, simd, simd-vector, mathematics-library
Last push: 2024-12-07T19:29:05+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 4755, "days_push": 634, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1203, forks 160 (observed 2026-08-28T04:03:58.525940+00:00)

## What it is
cgmath is a low-dimensional linear algebra library for Rust targeted at computer graphics applications, providing vectors, square matrices, quaternions, rotation matrices, angle units, points, and perspective/orthographic projection types. It is designed for graphics workloads rather than general-purpose n-dimensional linear algebra, with optional swizzle operators and trait-based APIs like VectorSpace and InnerSpace.

## Use cases
- do vector and matrix math for a Rust game or graphics engine
- compute perspective and orthographic projection matrices for 3D rendering
- represent rotations with quaternions in Rust
- transform points and vectors with affine and 3D spatial transformations
- use swizzle operators like v.xyz() on vectors in Rust
- convert between cgmath types and other math crates via mint
- serialize vectors and matrices with serde in a Rust project

## When to choose
- you are writing a game, renderer, or graphics application in Rust and need 2D/3D/4D vectors, matrices, and quaternions
- you want a small, focused graphics math crate with column-vector conventions familiar from GPU programming
- you need optional serde serialization or mint interoperability for your math types
- you want a mature, widely downloaded crate (11M+ downloads) with a stable 0.18 API

## When to avoid
- you need general-purpose or n-dimensional linear algebra (e.g. arbitrary-size matrices, decompositions, solvers) - use nalgebra or ndarray instead
- you need working SIMD acceleration - the SIMD feature depends on deprecated packages and pre-1.33 nightly Rust and is not usable in its current form
- you require active development or new features - the last release was 0.18.0 in January 2021 and the project is largely in maintenance mode
- you need fully tested, complete functionality - the README notes not everything is implemented and test coverage is incomplete

## Facets
- artifact type: library
- maturity: maintenance
- function: math, graphics, simulation
- domain: graphics, mathematics
- platform: rust, cross-platform, wasm
- tags: linear-algebra, vectors, matrices, quaternions, simd, gamedev, 3d-graphics, column-vectors, swizzling, projections, game-development, algorithms

## Member repositories
- rustgd/cgmath (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:58.525940+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:20:32.451927+00:00, confidence not recorded.
  - readme: https://github.com/rustgd/cgmath (fetched 2026-08-28T04:03:58.525940+00:00, sha 9e8dc7189bbe)
  - homepage: https://docs.rs/cgmath (fetched 2026-08-29T12:27:37.239651+00:00, sha 98f4e85d98f9)
  - site_page: https://docs.rs/ (fetched 2026-08-29T12:27:37.249408+00:00, sha 6260258b1f63)
  - site_page: https://docs.rs/crate/cgmath/latest (fetched 2026-08-29T12:27:37.251732+00:00, sha 3ae3fd835408)
  - site_page: https://docs.rs/crate/cgmath/latest/features (fetched 2026-08-29T12:27:37.254448+00:00, sha 0f8ac38f121a)
  - site_page: https://docs.rs/about (fetched 2026-08-29T12:27:37.256579+00:00, sha 29ab7986fbf5)
  - site_page: https://docs.rs/about/badges (fetched 2026-08-29T12:27:37.258547+00:00, sha 6588cac258af)
  - site_page: https://docs.rs/about/builds (fetched 2026-08-29T12:27:37.260228+00:00, sha 811231ca4680)
  - site_page: https://docs.rs/about/metadata (fetched 2026-08-29T12:27:37.261982+00:00, sha 0dcdccb2b2b2)
  - site_page: https://docs.rs/about/redirections (fetched 2026-08-29T12:27:37.263497+00:00, sha 1b1efd93105f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
