Expand description
Fixed Point Numbers
Fixed point number is designed to provide a memory presentation for real numbers. Currently implemented only for a few cases for purpose of real usages, but will make it flexible enough later.
FPN is the struct which contains a primitive for memory presentation with a specified length of
bits for fractions. Normal F64
(FPN<i64, U12>
) and F32
(FPN<i32, U8>
) should be fine
for usages. But be careful about the range overflow which doing Add
, Mul
and Div
FPN also provides trigonometric functions including sin
, cos
and tan
.
Vector2
and Vector3
provides the graphic computation containers for 2D and 3D, while
F64Vector2
(Vector2<F64>
), F64Vector3
, F32Vector2
and F32Vector3
for fixed numbers.
Dot
trait and Cross
provides the dot product and cross product, while Polar
trait
provides the function convert a Cartesian Coordinate to a Polar/Spherical Coordinates.
Rotate2
trait and Rotate3
trait provides the function to rotate Vector2
around the origin
point and rotate Vector3
around the axises.
Re-exports§
pub use base::FPN;
pub use base::To;
pub use common::FPN64;
pub use common::FPN32;
pub use common::F64;
pub use common::F32;
pub use cg::Vector2;
pub use cg::Vector3;
pub use cg::FVector2;
pub use cg::FVector3;
pub use cg::F64Vector2;
pub use cg::F64Vector3;
pub use cg::Dot;
pub use cg::Polar;
pub use cg::Cross;
pub use cg::Rotate2;
pub use cg::Rotate3;
Modules§
- base
base
provides basic fixed point numbers and implemented commonops
traits for FPNs with integar primitives.- cg
cg
module provides basicVector2
Vector3
struct with primitive scalars and also provides FPN inegrated version. Commonops
traits are implemented here.- common
- Common FPNs defined including:
F64
andF32
.