---
name: "matrix_to_quat"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/matrix_to_quat/3alleg4"
---

# matrix\_to\_quat(3alleg4)

Constructs a quaternion from a rotation matrix. Allegro game programming library.

## NAME

matrix\_to\_quat - Constructs a quaternion from a rotation matrix. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**void matrix\_to\_quat(const MATRIX\_f \*m, QUAT \*q);**

## DESCRIPTION

Constructs a quaternion from a rotation matrix. Translation is discarded  during the conversion. Use get\_align\_matrix\_f() if the matrix is not  orthonormalized, because strange things may happen otherwise.
