hexagon_map/point/
w_point.rs1use super::*;
2
3#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize)]
5pub struct WPoint {
6 pub x: isize,
8 pub y: isize,
10}
11
12impl WPoint {
13 pub fn new(x: isize, y: isize) -> Self {
14 Self { x, y }
15 }
16 pub fn go(&self, direction: Orientation) -> Self {
17 <WPoint as Into<CubicPoint>>::into(*self).go(direction).into()
18 }
19}
20
21impl From<CubicPoint> for WPoint {
22 fn from(point: CubicPoint) -> Self {
23 WPoint::new(point.p, point.q)
24 }
25}
26
27impl Into<CubicPoint> for WPoint {
28 fn into(self) -> CubicPoint {
29 CubicPoint::new(self.x, self.y)
30 }
31}