shared/types/
point.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use serde::{Deserialize, Serialize};

/// Represents a point in a two-dimensional space.
///
/// Attributes:
/// - `x`: A `f64` representing the x-coordinate of the point.
/// - `y`: A `f64` representing the y-coordinate of the point.
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct Point {
    pub x: f64,
    pub y: f64,
}

impl Point {
    /// Creates a new `Point` with the specified x and y coordinates.
    ///
    /// # Arguments
    ///
    /// * `x` - A `f64` representing the x-coordinate of the point.
    /// * `y` - A `f64` representing the y-coordinate of the point.
    ///
    /// # Returns
    ///
    /// A new `Point` with the specified x and y coordinates.
    pub fn new(x: f64, y: f64) -> Point {
        Point { x, y }
    }
}