pub fn cartesian_offsets(&self, hex_side_length: f64) -> (Vector2<f64>, Vector2<f64>) {
        match self {
            GridDirection { q: -1, r: 0 } => {
                (Vector2::new(-hex_side_length, 0.0),
                 Vector2::new(-hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length))
            },
            GridDirection { q: -1, r: 1 } => {
                (Vector2::new(-hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length),
                 Vector2::new(-hex_side_length, 0.0))
            },
            GridDirection { q:  0, r: 1 } => {
                (Vector2::new(hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length),
                 Vector2::new(-hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length))
            },
            GridDirection { q:  1, r: 0 } => {
                (Vector2::new(hex_side_length, 0.0),
                 Vector2::new(hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length))
            },
            GridDirection { q: 1, r: -1 } => {
                (Vector2::new(hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length),
                 Vector2::new(hex_side_length, 0.0))
            },
            GridDirection { q: 0, r: -1 } => {
                (Vector2::new(-hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length),
                 Vector2::new(hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length))
            },
            _ => {
                panic!("Invalid GridDirection specified: {:?}", self);
            }
        }
    }
// Returns direction vectors from a hex cell center to the vertices that define the hexagon edge
// in the direction specified by this GridDirection.
Returns direction vectors from a hex cell center to the vertices that define the hexagon edge
in the direction specified by this GridDirection.
Returns direction vectors from a hex cell center to the vertices that define the hexagon edge in the direction specified by this GridDirection .
pub fn cartesian_offsets(&self, hex_side_length: f64) -> (Vector2<f64>, Vector2<f64>) {
        match self {
            GridDirection { q: -1, r: 0 } => {
                (Vector2::new(-hex_side_length, 0.0),
                 Vector2::new(-hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length))
            },
            GridDirection { q: -1, r: 1 } => {
                (Vector2::new(-hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length),
                 Vector2::new(-hex_side_length, 0.0))
            },
            GridDirection { q:  0, r: 1 } => {
                (Vector2::new(hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length),
                 Vector2::new(-hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length))
            },
            GridDirection { q:  1, r: 0 } => {
                (Vector2::new(hex_side_length, 0.0),
                 Vector2::new(hex_side_length / 2.0, -HALF_ROOT_3 * hex_side_length))
            },
            GridDirection { q: 1, r: -1 } => {
                (Vector2::new(hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length),
                 Vector2::new(hex_side_length, 0.0))
            },
            GridDirection { q: 0, r: -1 } => {
                (Vector2::new(-hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length),
                 Vector2::new(hex_side_length / 2.0, HALF_ROOT_3 * hex_side_length))
            },
            _ => {
                panic!("Invalid GridDirection specified: {:?}", self);
            }
        }
    }
pub fn cartesian_offsets ( & self , hex_side_length : f64 ) -> ( Vector2 < f64 > , Vector2 < f64 > ) { match self { GridDirection { q : - 1 , r : 0 } => { ( Vector2 :: new ( - hex_side_length , 0.0 ) , Vector2 :: new ( - hex_side_length / 2.0 , HALF_ROOT_3 * hex_side_length ) ) } , GridDirection { q : - 1 , r : 1 } => { ( Vector2 :: new ( - hex_side_length / 2.0 , - HALF_ROOT_3 * hex_side_length ) , Vector2 :: new ( - hex_side_length , 0.0 ) ) } , GridDirection { q : 0 , r : 1 } => { ( Vector2 :: new ( hex_side_length / 2.0 , - HALF_ROOT_3 * hex_side_length ) , Vector2 :: new ( - hex_side_length / 2.0 , - HALF_ROOT_3 * hex_side_length ) ) } , GridDirection { q : 1 , r : 0 } => { ( Vector2 :: new ( hex_side_length , 0.0 ) , Vector2 :: new ( hex_side_length / 2.0 , - HALF_ROOT_3 * hex_side_length ) ) } , GridDirection { q : 1 , r : - 1 } => { ( Vector2 :: new ( hex_side_length / 2.0 , HALF_ROOT_3 * hex_side_length ) , Vector2 :: new ( hex_side_length , 0.0 ) ) } , GridDirection { q : 0 , r : - 1 } => { ( Vector2 :: new ( - hex_side_length / 2.0 , HALF_ROOT_3 * hex_side_length ) , Vector2 :: new ( hex_side_length / 2.0 , HALF_ROOT_3 * hex_side_length ) ) } , _ => { panic ! ( " " self ) ; } } }
Returns direction vectors from a hex cell center to the vertices that define the hexagon edge
in the direction specified by this GridDirection.
Returns direction vectors from a hex cell center to the vertices that define the hexagon edge in the direction specified by this GridDirection .
&self
hex_side_length
f64
&self
hex_side_length
f64