Skip to content

Commit

Permalink
Finish adding serde derives
Browse files Browse the repository at this point in the history
  • Loading branch information
zheylmun committed Mar 21, 2024
1 parent 7450541 commit 7e00ad7
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ellipsoidal/ellipsoid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{

/// An ellipsoid.
#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Ellipsoid {
equatorial_radius: Length,
polar_radius: Length,
Expand Down
2 changes: 1 addition & 1 deletion src/positions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl LatLong {
/// - z-axis points to the North Pole along the body's rotation axis,
/// - x-axis points towards the point where latitude = longitude = 0
#[derive(PartialEq, Clone, Copy, Debug, Default)]

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct NVector(Vec3);

impl NVector {
Expand Down
1 change: 1 addition & 0 deletions src/spherical/cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use super::Sphere;
/// A [spherical cap](https://en.wikipedia.org/wiki/Spherical_cap): a portion of a sphere cut off by a plane.
/// This struct and implementation is very much based on [S2Cap](https://github.com/google/s2geometry/blob/master/src/s2/s2cap.h).
#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Cap {
centre: NVector,
chord_radius2: f64,
Expand Down
1 change: 1 addition & 0 deletions src/spherical/great_circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use super::base::easting;
/// It is internally represented as its normal vector - i.e. the normal vector
/// to the plane containing the great circle.
#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct GreatCircle {
normal: Vec3,
}
Expand Down
1 change: 1 addition & 0 deletions src/spherical/minor_arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::base::{angle_radians_between, exact_side};
/// Oriented minor arc of a great circle between two positions: shortest path between positions
/// on a great circle.
#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct MinorArc {
start: NVector,
end: NVector,
Expand Down
3 changes: 3 additions & 0 deletions src/spherical/rectangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use super::MinorArc;
///
/// This struct and implementation is very much based on [S2LatLngRect](https://github.com/google/s2geometry/blob/master/src/s2/s2latlng_rect.h).
#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Rectangle {
lat: LatitudeInterval,
lng: LongitudeInterval,
Expand Down Expand Up @@ -317,6 +318,7 @@ impl Rectangle {

/// latitude interval: {@link #lo} is assumed to be less than {@link #hi}, otherwise the interval is empty.
#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
struct LatitudeInterval {
lo: Angle,
hi: Angle,
Expand Down Expand Up @@ -450,6 +452,7 @@ impl LatitudeInterval {
}

#[derive(PartialEq, Clone, Copy, Debug, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
struct LongitudeInterval {
lo: Angle,
hi: Angle,
Expand Down
2 changes: 1 addition & 1 deletion src/spherical/sloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ impl Loop {
}

/// Triangulates this loop using the [Ear Clipping](https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf) method.
///
///
/// This method returns either ([loop number vertices](crate::spherical::Loop::num_vertices) - 2) triangles - as triples of [NVector]s, if
/// the triangulation succeeds, or [empty](Vec::new) if the triangulation fails - which should only occur for [non simple](crate::spherical::Loop::is_simple) loops.
///
Expand Down

0 comments on commit 7e00ad7

Please sign in to comment.