# vext Basic Physics 'Vector' Library * [Documentation](https://docs.rs/vext) ### Usage Add the following to your `Cargo.toml`: ```toml [dependencies] vext = "0.1.20" ``` and this to your crate root: ```rust extern crate vext; ``` ### Example ```rust use vext::*; fn main() { let mut vec2 = Vector2::new(25.0, 50.0); vec2.set(125.0, vec2.y()); // Sets x to 125 and y to previous y value: 50 let (x, _y) = vec2.get(); let vec3 = Vector3::new(x, 25.0, 100.0); let vec3_2 = vec2.to_v3(5.0); // Creates Vector3 with xy of v2 and z of 5 let mut vec3_3 = Vector3::from(vec2); // Creates a Vector3 with xy of v2 and z of 0 vec3_3.set(vec3_3.x(), vec3_3.y(), 35.0); // Sets xy to previous and z to 35 let vec3_4 = vec3_2 + vec3_3; let direction = vec3_4.normalize(); // Get pointing direction of Vector3 let string: String = direction.to_string(); // Not required for println!() but you can to_string() if needed println!("vec2: {}\nvec3: {}\nmagnitude: {}", vec2, vec3, string); // Prints whole vectors println!("vec3_2 x: {}", vec3_2.x()); // Prints single vector magnitude } ```