diff --git a/examples/render-cube.rs b/examples/render-cube.rs index 5db4963..3c038bd 100644 --- a/examples/render-cube.rs +++ b/examples/render-cube.rs @@ -152,8 +152,8 @@ where NPTS: Dim, I: IntrinsicParameters, S: Storage, - DefaultAllocator: Allocator, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { // Project the original 3D coordinates to 2D pixel coordinates. let pixel_coords = cam.world_to_pixel(verts); diff --git a/src/camera.rs b/src/camera.rs index bfe3d5b..dc9a102 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -115,8 +115,8 @@ where where NPTS: Dim, InStorage: Storage, - DefaultAllocator: Allocator, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let camera_frame = self.extrinsics.world_to_camera(world); self.intrinsics.camera_to_pixel(&camera_frame) @@ -139,9 +139,9 @@ where IN: Storage, NPTS: Dim, I::BundleType: Bundle, - DefaultAllocator: Allocator, - DefaultAllocator: Allocator, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, + DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { // get camera frame rays let camera = self.intrinsics.pixel_to_camera(pixels); diff --git a/src/extrinsics.rs b/src/extrinsics.rs index b06db43..2f1246e 100644 --- a/src/extrinsics.rs +++ b/src/extrinsics.rs @@ -203,7 +203,7 @@ impl ExtrinsicParameters { where NPTS: Dim, InStorage: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let mut world = Points::new(OMatrix::zeros_generic( NPTS::from_usize(cam_coords.data.nrows()), @@ -237,7 +237,7 @@ impl ExtrinsicParameters { BType: Bundle, NPTS: Dim, StorageCamera: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { camera.to_pose(self.cache.pose_inv.clone()) } @@ -250,7 +250,7 @@ impl ExtrinsicParameters { where NPTS: Dim, InStorage: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let mut cam_coords = Points::new(OMatrix::zeros_generic( NPTS::from_usize(world.data.nrows()), @@ -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] diff --git a/src/intrinsics_orthographic.rs b/src/intrinsics_orthographic.rs index 056cc57..2340c98 100644 --- a/src/intrinsics_orthographic.rs +++ b/src/intrinsics_orthographic.rs @@ -84,7 +84,7 @@ where Self::BundleType: Bundle, IN: Storage, NPTS: Dim, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let zero: R = convert(0.0); @@ -121,7 +121,7 @@ where where IN: Storage, NPTS: Dim, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let mut result = Pixels::new(OMatrix::zeros_generic( NPTS::from_usize(camera.data.nrows()), diff --git a/src/intrinsics_perspective.rs b/src/intrinsics_perspective.rs index 11cae9e..e5c9e23 100644 --- a/src/intrinsics_perspective.rs +++ b/src/intrinsics_perspective.rs @@ -188,7 +188,7 @@ where Self::BundleType: Bundle, IN: Storage, NPTS: Dim, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let one: R = convert(1.0); @@ -225,7 +225,7 @@ where where IN: Storage, NPTS: Dim, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let mut result = Pixels::new(OMatrix::zeros_generic( NPTS::from_usize(camera.data.nrows()), diff --git a/src/lib.rs b/src/lib.rs index 03dbcdf..6eabef5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,7 +267,7 @@ where R: RealField, NPTS: DimName, StorageMultiple: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { /// get directions of each ray in bundle #[inline] @@ -368,7 +368,7 @@ where #[inline] pub fn point_on_ray(&self) -> Points> where - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { self.bundle_type.point_on_ray(&self.data) } @@ -380,7 +380,7 @@ where distance: R, ) -> Points> where - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { self.bundle_type .point_on_ray_at_distance(&self.data, distance) @@ -395,7 +395,7 @@ where R: RealField, NPTS: Dim, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { self.bundle_type.to_pose(pose, &self.data) } @@ -447,7 +447,7 @@ where where NPTS: DimName, StorageIn: Storage, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; /// Get centers of each ray in bundle. /// @@ -461,7 +461,7 @@ where where NPTS: DimName, StorageIn: Storage, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; /// Return points on on the input rays. /// @@ -476,7 +476,7 @@ where NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; /// Return points on on the input rays at a defined distance from the origin(s). fn point_on_ray_at_distance( @@ -489,7 +489,7 @@ where NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; /// Convert the input rays by the pose given. fn to_pose( @@ -503,7 +503,7 @@ where NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; } /// A geometric model of camera coordinates to pixels (and vice versa). @@ -523,9 +523,9 @@ where Self::BundleType: Bundle, IN: Storage, NPTS: Dim, - DefaultAllocator: Allocator, // needed to make life easy for implementors - DefaultAllocator: Allocator, // needed to make life easy for implementors - DefaultAllocator: Allocator; + DefaultAllocator: Allocator, // needed to make life easy for implementors + DefaultAllocator: Allocator, // needed to make life easy for implementors + DefaultAllocator: Allocator; /// project camera coords to pixel coordinates fn camera_to_pixel( @@ -535,7 +535,7 @@ where where IN: Storage, NPTS: Dim, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; } #[cfg(test)] diff --git a/src/ray_bundle_types.rs b/src/ray_bundle_types.rs index b637244..c19ef65 100644 --- a/src/ray_bundle_types.rs +++ b/src/ray_bundle_types.rs @@ -50,7 +50,7 @@ where where NPTS: nalgebra::DimName, StorageIn: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { // TODO: do this more smartly/efficiently let mut result = nalgebra::OMatrix::::zeros(); @@ -69,7 +69,7 @@ where where NPTS: nalgebra::DimName, StorageIn: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { // TODO: do this more smartly/efficiently let mut result = nalgebra::OMatrix::::zeros(); @@ -90,7 +90,7 @@ where NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { let mut result = Points::new(OMatrix::zeros_generic( NPTS::from_usize(directions.nrows()), @@ -119,7 +119,7 @@ where NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { let mut result = Points::new(OMatrix::zeros_generic( NPTS::from_usize(directions.nrows()), @@ -154,7 +154,7 @@ where NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { let bundle_type = Self::new_shared_zero_origin(); let mut reposed = RayBundle::new( @@ -214,7 +214,7 @@ impl Bundle for SharedDirectionRayBundle { where NPTS: nalgebra::DimName, StorageIn: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { // TODO: do this more smartly/efficiently let mut result = nalgebra::OMatrix::::zeros(); @@ -233,7 +233,7 @@ impl Bundle for SharedDirectionRayBundle { where NPTS: nalgebra::DimName, StorageIn: Storage, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { // TODO: do this more smartly/efficiently let mut result = nalgebra::OMatrix::::zeros(); @@ -254,7 +254,7 @@ impl Bundle for SharedDirectionRayBundle { NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { let mut result = Points::new(OMatrix::zeros_generic( NPTS::from_usize(centers.nrows()), @@ -283,7 +283,7 @@ impl Bundle for SharedDirectionRayBundle { NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { let mut result = Points::new(OMatrix::zeros_generic( NPTS::from_usize(centers.nrows()), @@ -316,7 +316,7 @@ impl Bundle for SharedDirectionRayBundle { NPTS: Dim, StorageIn: Storage, OutFrame: CoordinateSystem, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator< NPTS, U3>, { let bundle_type = Self::new_plusz_shared_direction(); diff --git a/src/ray_intersection.rs b/src/ray_intersection.rs index d4c07f0..327a774 100644 --- a/src/ray_intersection.rs +++ b/src/ray_intersection.rs @@ -46,9 +46,9 @@ pub fn best_intersection_of_rays( where Coords: CoordinateSystem, R: RealField, - DefaultAllocator: Allocator, - DefaultAllocator: Allocator, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, + DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { if rays.len() < 2 { return Err(Error::MinimumTwoRaysNeeded); @@ -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(); }