Skip to content

Commit

Permalink
Refactor vector types (#69)
Browse files Browse the repository at this point in the history
This is a fairly large SemVer-breaking overhaul of the vector types
provided by this crate which still largel manages to preserve the
original API while dramatically simplifying the implementation.

It removes all usage of `generic-array`. The original intention starting
this refactor was to leverage `min_const_generics` in its place, but it
turns out that const generics really aren't necessary and the previous
usage of `GenericArray` was largely superfluous.

It replaces all previous use of macros with `Vector2d`/`Vector3d` types
which are generic over coordinates. The previous concrete vector structs
such as `I32x2`, `I32x3`, `F32x2`, `F32x3` etc are now implemented as
type aliases for the generic structs.

It also eliminates the `VectorExt` trait as what it provided can be
implemented in terms of trait bounds on the individual methods.
  • Loading branch information
tarcieri committed Mar 28, 2021
1 parent f657fb0 commit d520055
Show file tree
Hide file tree
Showing 8 changed files with 541 additions and 440 deletions.
9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "micromath"
version = "1.1.1" # Also update html_root_url in lib.rs when bumping this
version = "2.0.0-pre" # Also update html_root_url in lib.rs when bumping this
description = """
Embedded-friendly math library featuring fast floating point approximations
(with small code size) for common arithmetic operations, trigonometry,
Expand All @@ -15,15 +15,10 @@ edition = "2018"
categories = ["embedded", "mathematics", "science", "no-std"]
keywords = ["math", "quaternions", "statistics", "trigonometry", "vector"]

[dependencies.generic-array]
version = "0.14"
optional = true
default-features = false

[features]
quaternion = []
statistics = []
vector = ["generic-array"]
vector = []

[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage:
status:
project: off
patch: off
8 changes: 1 addition & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/tarcieri/micromath/main/img/micromath-sq.png",
html_root_url = "https://docs.rs/micromath/1.1.1"
html_root_url = "https://docs.rs/micromath/2.0.0-pre"
)]
#![forbid(unsafe_code)]
#![warn(
Expand Down Expand Up @@ -110,9 +110,3 @@ pub use crate::f32ext::F32Ext;

#[cfg(feature = "quaternion")]
pub use crate::quaternion::Quaternion;

#[cfg(feature = "vector")]
pub use {
crate::vector::{Vector, VectorExt},
generic_array,
};
Loading

0 comments on commit d520055

Please sign in to comment.