cgmath/
lib.rs

1// Copyright 2013-2014 The CGMath Developers. For a full listing of the authors,
2// refer to the Cargo.toml file at the top-level directory of this distribution.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//     http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! A low-dimensional linear algebra library, targeted at computer graphics.
17//!
18//! # Trait overview
19//!
20//! In order to make a clean, composable API, we divide operations into traits
21//! that are roughly based on mathematical properties. The main ones that we
22//! concern ourselves with are listed below:
23//!
24//! - `VectorSpace`: Specifies the main operators for vectors, quaternions, and
25//!   matrices.
26//! - `MetricSpace`: For types that have a distance function implemented.
27//! - `InnerSpace`: For types that have a dot (or inner) product - ie. vectors or
28//!   quaternions. This also allows for the definition of operations that are
29//!   based on the dot product, like finding the magnitude or normalizing.
30//! - `EuclideanSpace`: Points in euclidean space, with an associated space of
31//!   displacement vectors.
32//! - `Matrix`: Common operations for matrices of arbitrary dimensions.
33//! - `SquareMatrix`: A special trait for matrices where the number of columns
34//!   equal the number of rows.
35//!
36//! Other traits are included for practical convenience, for example:
37//!
38//! - `Array`: For contiguous, indexable arrays of elements, specifically
39//!   vectors.
40//! - `ElementWise`: For element-wise addition, subtraction, multiplication,
41//!   division, and remainder operations.
42//!
43//! # The prelude
44//!
45//! Importing each trait individually can become a chore, so we provide a
46//! `prelude` module to allow you to import the main traits all at once. For
47//! example:
48//!
49//! ```rust
50//! use cgmath::prelude::*;
51//! ```
52
53#![cfg_attr(feature = "simd", feature(specialization))]
54
55#[macro_use]
56extern crate approx;
57
58#[cfg(feature = "mint")]
59pub extern crate mint;
60
61pub extern crate num_traits;
62#[cfg(feature = "rand")]
63extern crate rand;
64
65#[cfg(feature = "serde")]
66#[macro_use]
67extern crate serde;
68
69#[cfg(feature = "simd")]
70extern crate simd;
71
72// Re-exports
73
74pub use approx::*;
75pub use num::*;
76pub use structure::*;
77
78pub use matrix::{Matrix2, Matrix3, Matrix4};
79pub use quaternion::Quaternion;
80pub use vector::{dot, vec1, vec2, vec3, vec4, Vector1, Vector2, Vector3, Vector4};
81
82pub use angle::{Deg, Rad};
83pub use euler::Euler;
84pub use point::{point1, point2, point3, Point1, Point2, Point3};
85pub use rotation::*;
86pub use transform::*;
87
88pub use projection::*;
89
90// Modules
91
92pub mod conv;
93pub mod prelude;
94
95mod macros;
96
97mod num;
98mod structure;
99
100mod matrix;
101mod quaternion;
102
103#[cfg(feature = "simd")]
104mod quaternion_simd;
105
106mod vector;
107
108#[cfg(feature = "simd")]
109mod vector_simd;
110
111mod angle;
112mod euler;
113mod point;
114mod rotation;
115mod transform;
116
117mod projection;