Skip to content

Commit

Permalink
Remove use of nalgebra-macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Oom committed Mar 24, 2024
1 parent 9b8ea14 commit 58ee778
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 209 deletions.
27 changes: 2 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ assert_approx_eq = "1.1.0"
clap = { version = "4.5.1", default-features = false, features = ["std", "derive"] }
geometry = { version = "1.0.0", path = "geometry" }
image = { version = "0.24.9", default-features = false, features = ["png"] }
nalgebra = { version = "0.32.4", default-features = false, features = ["macros", "std"] }
nalgebra = { version = "0.32.4", default-features = false, features = ["std"] }
rand = { version = "0.8.5", default-features = false, features = ["small_rng", "std"] }
rayon = "1.9.0"
simba = { version = "0.8.1", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion geometry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ version = "1.0.0"
edition = "2021"

[dependencies]
nalgebra = { version = "0.32.4", default-features = false, features = ["macros", "std"] }
nalgebra = { version = "0.32.4", default-features = false, features = ["std"] }
smallvec = { version = "1.13.2", default-features = false }
19 changes: 13 additions & 6 deletions geometry/src/aabb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use nalgebra;
use nalgebra::{vector, Vector3};
use nalgebra::Vector3;

use super::aap::Aap;

Expand Down Expand Up @@ -28,8 +27,8 @@ impl Aabb {

pub fn unit() -> Aabb {
Aabb {
center: vector![0., 0., 0.],
half_size: vector![0.5, 0.5, 0.5],
center: Vector3::new(0., 0., 0.),
half_size: Vector3::new(0.5, 0.5, 0.5),
}
}

Expand Down Expand Up @@ -76,8 +75,16 @@ impl Aabb {
pub fn split(&self, plane: &Aap) -> (Aabb, Aabb) {
let fst_half_axis = (plane.distance - self.min()[plane.axis]) / 2.;
let snd_half_axis = (self.max()[plane.axis] - plane.distance) / 2.;
debug_assert!(fst_half_axis >= 0.0, "fst_half_axis is negative {}", fst_half_axis);
debug_assert!(snd_half_axis >= 0.0, "snd_half_axis is negative {}", snd_half_axis);
debug_assert!(
fst_half_axis >= 0.0,
"fst_half_axis is negative {}",
fst_half_axis
);
debug_assert!(
snd_half_axis >= 0.0,
"snd_half_axis is negative {}",
snd_half_axis
);

let mut fst_center = self.center;
let mut fst_half_size = self.half_size;
Expand Down
8 changes: 4 additions & 4 deletions geometry/src/aap.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nalgebra::{vector, Vector3};
use nalgebra::Vector3;

#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum Axis {
Expand All @@ -19,9 +19,9 @@ impl Axis {

pub fn as_vector3(&self, v: f32) -> Vector3<f32> {
match self {
Axis::X => vector![v, 0.0, 0.0],
Axis::Y => vector![0.0, v, 0.0],
Axis::Z => vector![0.0, 0.0, v],
Axis::X => Vector3::new(v, 0.0, 0.0),
Axis::Y => Vector3::new(0.0, v, 0.0),
Axis::Z => Vector3::new(0.0, 0.0, v),
}
}
}
Expand Down
Loading

0 comments on commit 58ee778

Please sign in to comment.