Skip to content

Commit

Permalink
Merge pull request #934 from Andlon/point_dim_name
Browse files Browse the repository at this point in the history
point_dim_name: Fix serde impls and Distribution impl for OPoint
  • Loading branch information
sebcrozet committed Jul 8, 2021
2 parents 16b8f48 + 92c2633 commit e588139
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/geometry/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ where
impl<T: Scalar + Serialize, D: DimName> Serialize for OPoint<T, D>
where
DefaultAllocator: Allocator<T, D>,
<DefaultAllocator as Allocator<T, D>>::Buffer: Serialize
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand All @@ -98,12 +99,13 @@ where
impl<'a, T: Scalar + Deserialize<'a>, D: DimName> Deserialize<'a> for OPoint<T, D>
where
DefaultAllocator: Allocator<T, D>,
<DefaultAllocator as Allocator<T, D>>::Buffer: Deserialize<'a>
{
fn deserialize<Des>(deserializer: Des) -> Result<Self, Des::Error>
where
Des: Deserializer<'a>,
{
let coords = SVector::<T, D>::deserialize(deserializer)?;
let coords = OVector::<T, D>::deserialize(deserializer)?;

Ok(Self::from(coords))
}
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/point_construction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ where
/// Generate a `Point` where each coordinate is an independent variate from `[0, 1)`.
#[inline]
fn sample<'a, G: Rng + ?Sized>(&self, rng: &mut G) -> OPoint<T, D> {
Point::from(rng.gen::<OVector<T, D>>())
OPoint::from(rng.gen::<OVector<T, D>>())
}
}

Expand Down

0 comments on commit e588139

Please sign in to comment.