Crates.io | coord2d |
lib.rs | coord2d |
version | 0.4.0-1 |
source | src |
created_at | 2021-04-12 18:10:47.40325 |
updated_at | 2024-11-26 12:33:57.422099 |
description | rust lib for coordinate in 2d system |
homepage | |
repository | https://github.com/abdellatif-dev/coord2d |
max_upload_size | |
id | 382505 |
size | 21,263 |
A Rust library for working with 2D coordinates and vectors.
Coord2D
provides a robust and flexible way to manage and manipulate 2D
coordinates and vectors in Rust. It supports various mathematical operations,
type conversions, and vector properties like magnitude and midpoint, making it
ideal for 2D geometry computations.
i32
, f32
, usize
, and more.Vec
formats.Add coord2d
to your Cargo.toml
:
[dependencies]
coord2d = "*"
use coord2d::*;
fn main() {
let a: coord::Coord = new_coord!(1, 2.0);
let b: coord::Coord = new_coord!(3, 4.5);
}
use coord2d::*;
fn main() {
let a: coord::Coord = new_coord!(2.5, 3.3);
let b: coord::Coord = new_coord!(1.0, 1.5);
let vector: vector::Vector = new_vector!(a, b);
let magnitude = vector.get_magnitude(); // Calculate magnitude
let midpoint = vector.get_midpoint(); // Get midpoint
println!("Magnitude: {}", magnitude);
println!("Midpoint: {:?}", midpoint);
}
We welcome contributions to improve coord2d
. If you have ideas or spot issues:
This project is licensed under the GPL License.
Enjoy using coord2d
for your projects? Give us a star! 🌟