#axis #range #geometry #extract #2d #recursion #1d

no-std axgeom

Library that provides ability to extract 1d ranges out of 2d objects

62 stable releases

1.13.2 Aug 18, 2023
1.13.0 Jun 30, 2023
1.12.1 Apr 28, 2022
1.9.7 Dec 31, 2021
0.1.0 Dec 1, 2017

#295 in Algorithms

Download history 12/week @ 2024-07-21 35/week @ 2024-07-28 57/week @ 2024-08-04 37/week @ 2024-08-11 7/week @ 2024-08-18 27/week @ 2024-08-25 31/week @ 2024-09-01 26/week @ 2024-09-08 55/week @ 2024-09-15 89/week @ 2024-09-22 38/week @ 2024-09-29 78/week @ 2024-10-06 57/week @ 2024-10-13 52/week @ 2024-10-20 28/week @ 2024-10-27 68/week @ 2024-11-03

215 downloads per month
Used in 13 crates (10 directly)

MIT license

39KB
1K SLoC

axgeom

A library that provides a way to easily extract 1d ranges from a 2d container based off of the x or y axis statically through type parameters. This is useful if you have a function that operates on an axis that recursively calls itself but at the same time alternates its axis.

Example

extern crate axgeom;

#[test]
fn test(){
	use axgeom::AxisTrait;

	let a=axgeom::XAXISS;
	let b=a.next();
	let c=b.next();

	assert_eq!(generic(a),1);
	assert_eq!(generic(b),0);
	assert_eq!(generic(c),1);

	fn generic<T:AxisTrait>(a:T)->usize{
		//known at compile time
		if a.is_xaxis(){
			1
		}else{
			0
		}
	}
}

lib.rs:

A library that provides a way to easily extract 1d ranges from a 2d container based off of the x or y axis statically through type parameters. This can help with performance in algorithms where you need to get values for a particular axis often.

Dependencies

~0.5–1.2MB
~26K SLoC