pub fn decompose_base_vector(left: &HexBlock, right: &HexBlock) -> (Hex2, Hex2) {
		// We assume $left and $right have the same size and are adjacent
		let size = left.size;

		let difference = right.center - left.center;

		let rotation_count = base_directions(size).iter()
			.position(|&x| x == difference)
			.expect("Adjacent HexBlocks are offset by a base vector");
		
		let main_vector = base_directions(size - 1)[rotation_count];
		let side_vector = difference - 2*main_vector; // v == 2 * main_vector + side_vector
		(main_vector, side_vector)
	}
/** Decompose the vector between adjacent HexBlocks `left` to `right`
	
	Because we know how the base vectors are constructed, we can find out which 2 smaller vectors created it.
	See [`base_vector`]'s code for how they are built.
	*/
Decompose the vector between adjacent HexBlocks `left` to `right`
Because we know how the base vectors are constructed, we can find out which 2 smaller vectors created it.
See [`base_vector`]'s code for how they are built.
Decompose the vector between adjacent HexBlocks ` left ` to ` right ` Because we know how the base vectors are constructed we can find out which 2 smaller vectors created it . See [ ` base_vector ` ] ' s code for how they are built .
pub fn decompose_base_vector(left: &HexBlock, right: &HexBlock) -> (Hex2, Hex2) {
		// We assume $left and $right have the same size and are adjacent
		let size = left.size;
		let difference = right.center - left.center;
		let rotation_count = base_directions(size).iter()
			.position(|&x| x == difference)
			.expect("Adjacent HexBlocks are offset by a base vector");
		let main_vector = base_directions(size - 1)[rotation_count];
		let side_vector = difference - 2*main_vector; // v == 2 * main_vector + side_vector
		(main_vector, side_vector)
	}
pub fn decompose_base_vector ( left : & HexBlock , right : & HexBlock ) -> ( Hex2 , Hex2 ) { // We assume $left and $right have the same size and are adjacent let size = left . size ; let difference = right . center - left . center ; let rotation_count = base_directions ( size ) . iter ( ) . position ( | & x | x == difference ) . expect ( " " ) ; let main_vector = base_directions ( size - 1 ) [ rotation_count ] ; let side_vector = difference - 2 * main_vector ; // v == 2 * main_vector + side_vector ( main_vector , side_vector ) }
Decompose the vector between adjacent HexBlocks `left` to `right`
Because we know how the base vectors are constructed, we can find out which 2 smaller vectors created it.
Decompose the vector between adjacent HexBlocks ` left ` to ` right ` Because we know how the base vectors are constructed we can find out which 2 smaller vectors created it .
left
&HexBlock
right
&HexBlock
left
&HexBlock
right
&HexBlock