Skip to content

Commit

Permalink
Update nalgebra requirement from 0.32 to 0.33
Browse files Browse the repository at this point in the history
  • Loading branch information
astraw committed Jun 24, 2024
1 parent 89f065f commit e7c9fef
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 51 deletions.
4 changes: 2 additions & 2 deletions examples/render-cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ where
NPTS: Dim,
I: IntrinsicParameters<f64>,
S: Storage<f64, NPTS, U3>,
DefaultAllocator: Allocator<f64, NPTS, U3>,
DefaultAllocator: Allocator<f64, NPTS, U2>,
DefaultAllocator: Allocator<NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U2>,
{
// Project the original 3D coordinates to 2D pixel coordinates.
let pixel_coords = cam.world_to_pixel(verts);
Expand Down
10 changes: 5 additions & 5 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ where
where
NPTS: Dim,
InStorage: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U2>,
DefaultAllocator: Allocator<NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U2>,
{
let camera_frame = self.extrinsics.world_to_camera(world);
self.intrinsics.camera_to_pixel(&camera_frame)
Expand All @@ -139,9 +139,9 @@ where
IN: Storage<R, NPTS, U2>,
NPTS: Dim,
I::BundleType: Bundle<R>,
DefaultAllocator: Allocator<R, U1, U2>,
DefaultAllocator: Allocator<R, NPTS, U2>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<U1, U2>,
DefaultAllocator: Allocator<NPTS, U2>,
DefaultAllocator: Allocator<NPTS, U3>,
{
// get camera frame rays
let camera = self.intrinsics.pixel_to_camera(pixels);
Expand Down
12 changes: 4 additions & 8 deletions src/extrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<R: RealField> ExtrinsicParameters<R> {
where
NPTS: Dim,
InStorage: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
let mut world = Points::new(OMatrix::zeros_generic(
NPTS::from_usize(cam_coords.data.nrows()),
Expand Down Expand Up @@ -237,7 +237,7 @@ impl<R: RealField> ExtrinsicParameters<R> {
BType: Bundle<R>,
NPTS: Dim,
StorageCamera: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
camera.to_pose(self.cache.pose_inv.clone())
}
Expand All @@ -250,7 +250,7 @@ impl<R: RealField> ExtrinsicParameters<R> {
where
NPTS: Dim,
InStorage: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
let mut cam_coords = Points::new(OMatrix::zeros_generic(
NPTS::from_usize(world.data.nrows()),
Expand Down Expand Up @@ -432,11 +432,7 @@ mod tests {

// test roundtrip
let camera_actual = e1.world_to_camera(&world_actual);
approx::assert_abs_diff_eq!(
cam_coords.data,
camera_actual.data,
epsilon = epsilon
);
approx::assert_abs_diff_eq!(cam_coords.data, camera_actual.data, epsilon = epsilon);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/intrinsics_orthographic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where
Self::BundleType: Bundle<R>,
IN: Storage<R, NPTS, U2>,
NPTS: Dim,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
let zero: R = convert(0.0);

Expand Down Expand Up @@ -121,7 +121,7 @@ where
where
IN: Storage<R, NPTS, U3>,
NPTS: Dim,
DefaultAllocator: Allocator<R, NPTS, U2>,
DefaultAllocator: Allocator<NPTS, U2>,
{
let mut result = Pixels::new(OMatrix::zeros_generic(
NPTS::from_usize(camera.data.nrows()),
Expand Down
4 changes: 2 additions & 2 deletions src/intrinsics_perspective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ where
Self::BundleType: Bundle<R>,
IN: Storage<R, NPTS, U2>,
NPTS: Dim,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
let one: R = convert(1.0);

Expand Down Expand Up @@ -225,7 +225,7 @@ where
where
IN: Storage<R, NPTS, U3>,
NPTS: Dim,
DefaultAllocator: Allocator<R, NPTS, U2>,
DefaultAllocator: Allocator<NPTS, U2>,
{
let mut result = Pixels::new(OMatrix::zeros_generic(
NPTS::from_usize(camera.data.nrows()),
Expand Down
26 changes: 13 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ where
R: RealField,
NPTS: DimName,
StorageMultiple: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
/// get directions of each ray in bundle
#[inline]
Expand Down Expand Up @@ -368,7 +368,7 @@ where
#[inline]
pub fn point_on_ray(&self) -> Points<Coords, R, NPTS, Owned<R, NPTS, U3>>
where
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
self.bundle_type.point_on_ray(&self.data)
}
Expand All @@ -380,7 +380,7 @@ where
distance: R,
) -> Points<Coords, R, NPTS, Owned<R, NPTS, U3>>
where
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
self.bundle_type
.point_on_ray_at_distance(&self.data, distance)
Expand All @@ -395,7 +395,7 @@ where
R: RealField,
NPTS: Dim,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator<NPTS, U3>,
{
self.bundle_type.to_pose(pose, &self.data)
}
Expand Down Expand Up @@ -447,7 +447,7 @@ where
where
NPTS: DimName,
StorageIn: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>;
DefaultAllocator: Allocator<NPTS, U3>;

/// Get centers of each ray in bundle.
///
Expand All @@ -461,7 +461,7 @@ where
where
NPTS: DimName,
StorageIn: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>;
DefaultAllocator: Allocator<NPTS, U3>;

/// Return points on on the input rays.
///
Expand All @@ -476,7 +476,7 @@ where
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>;
DefaultAllocator: Allocator<NPTS, U3>;

/// Return points on on the input rays at a defined distance from the origin(s).
fn point_on_ray_at_distance<NPTS, StorageIn, OutFrame>(
Expand All @@ -489,7 +489,7 @@ where
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>;
DefaultAllocator: Allocator<NPTS, U3>;

/// Convert the input rays by the pose given.
fn to_pose<NPTS, StorageIn, OutFrame>(
Expand All @@ -503,7 +503,7 @@ where
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>;
DefaultAllocator: Allocator<NPTS, U3>;
}

/// A geometric model of camera coordinates to pixels (and vice versa).
Expand All @@ -523,9 +523,9 @@ where
Self::BundleType: Bundle<R>,
IN: Storage<R, NPTS, U2>,
NPTS: Dim,
DefaultAllocator: Allocator<R, U1, U2>, // needed to make life easy for implementors
DefaultAllocator: Allocator<R, NPTS, U2>, // needed to make life easy for implementors
DefaultAllocator: Allocator<R, NPTS, U3>;
DefaultAllocator: Allocator<U1, U2>, // needed to make life easy for implementors
DefaultAllocator: Allocator<NPTS, U2>, // needed to make life easy for implementors
DefaultAllocator: Allocator<NPTS, U3>;

/// project camera coords to pixel coordinates
fn camera_to_pixel<IN, NPTS>(
Expand All @@ -535,7 +535,7 @@ where
where
IN: Storage<R, NPTS, U3>,
NPTS: Dim,
DefaultAllocator: Allocator<R, NPTS, U2>;
DefaultAllocator: Allocator<NPTS, U2>;
}

#[cfg(test)]
Expand Down
20 changes: 10 additions & 10 deletions src/ray_bundle_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ where
where
NPTS: nalgebra::DimName,
StorageIn: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
// TODO: do this more smartly/efficiently
let mut result = nalgebra::OMatrix::<R, NPTS, U3>::zeros();
Expand All @@ -69,7 +69,7 @@ where
where
NPTS: nalgebra::DimName,
StorageIn: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
// TODO: do this more smartly/efficiently
let mut result = nalgebra::OMatrix::<R, NPTS, U3>::zeros();
Expand All @@ -90,7 +90,7 @@ where
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
let mut result = Points::new(OMatrix::zeros_generic(
NPTS::from_usize(directions.nrows()),
Expand Down Expand Up @@ -119,7 +119,7 @@ where
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
let mut result = Points::new(OMatrix::zeros_generic(
NPTS::from_usize(directions.nrows()),
Expand Down Expand Up @@ -154,7 +154,7 @@ where
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
let bundle_type = Self::new_shared_zero_origin();
let mut reposed = RayBundle::new(
Expand Down Expand Up @@ -214,7 +214,7 @@ impl<R: RealField> Bundle<R> for SharedDirectionRayBundle<R> {
where
NPTS: nalgebra::DimName,
StorageIn: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
// TODO: do this more smartly/efficiently
let mut result = nalgebra::OMatrix::<R, NPTS, U3>::zeros();
Expand All @@ -233,7 +233,7 @@ impl<R: RealField> Bundle<R> for SharedDirectionRayBundle<R> {
where
NPTS: nalgebra::DimName,
StorageIn: Storage<R, NPTS, U3>,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
// TODO: do this more smartly/efficiently
let mut result = nalgebra::OMatrix::<R, NPTS, U3>::zeros();
Expand All @@ -254,7 +254,7 @@ impl<R: RealField> Bundle<R> for SharedDirectionRayBundle<R> {
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
let mut result = Points::new(OMatrix::zeros_generic(
NPTS::from_usize(centers.nrows()),
Expand Down Expand Up @@ -283,7 +283,7 @@ impl<R: RealField> Bundle<R> for SharedDirectionRayBundle<R> {
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
let mut result = Points::new(OMatrix::zeros_generic(
NPTS::from_usize(centers.nrows()),
Expand Down Expand Up @@ -316,7 +316,7 @@ impl<R: RealField> Bundle<R> for SharedDirectionRayBundle<R> {
NPTS: Dim,
StorageIn: Storage<R, NPTS, U3>,
OutFrame: CoordinateSystem,
DefaultAllocator: Allocator<R, NPTS, U3>,
DefaultAllocator: Allocator< NPTS, U3>,
{
let bundle_type = Self::new_plusz_shared_direction();

Expand Down
18 changes: 9 additions & 9 deletions src/ray_intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ pub fn best_intersection_of_rays<Coords, R>(
where
Coords: CoordinateSystem,
R: RealField,
DefaultAllocator: Allocator<R, Dyn, U3>,
DefaultAllocator: Allocator<R, U1, Dyn>,
DefaultAllocator: Allocator<R, U1, U3>,
DefaultAllocator: Allocator<Dyn, U3>,
DefaultAllocator: Allocator<U1, Dyn>,
DefaultAllocator: Allocator<U1, U3>,
{
if rays.len() < 2 {
return Err(Error::MinimumTwoRaysNeeded);
Expand Down Expand Up @@ -96,27 +96,27 @@ where

let minusone: R = na::convert(-1.0);

for (x, xxm1) in nx.into_iter().zip(xxm1.iter_mut()) {
for (x, xxm1) in nx.iter().zip(xxm1.iter_mut()) {
*xxm1 = x.clone().powi(2).add(minusone.clone());
}

for (y, yym1) in ny.into_iter().zip(yym1.iter_mut()) {
for (y, yym1) in ny.iter().zip(yym1.iter_mut()) {
*yym1 = y.clone().powi(2).add(minusone.clone());
}

for (z, zzm1) in nz.into_iter().zip(zzm1.iter_mut()) {
for (z, zzm1) in nz.iter().zip(zzm1.iter_mut()) {
*zzm1 = z.clone().powi(2).add(minusone.clone());
}

for (x, y, xy) in izip!(nx.into_iter(), ny.into_iter(), xy.iter_mut()) {
for (x, y, xy) in izip!(nx.iter(), ny.iter(), xy.iter_mut()) {
*xy = x.clone() * y.clone();
}

for (x, z, xz) in izip!(nx.into_iter(), nz.into_iter(), xz.iter_mut()) {
for (x, z, xz) in izip!(nx.iter(), nz.iter(), xz.iter_mut()) {
*xz = x.clone() * z.clone();
}

for (y, z, yz) in izip!(ny.into_iter(), nz.into_iter(), yz.iter_mut()) {
for (y, z, yz) in izip!(ny.iter(), nz.iter(), yz.iter_mut()) {
*yz = y.clone() * z.clone();
}

Expand Down

0 comments on commit e7c9fef

Please sign in to comment.