All Projects → zesterer → Coord Rs

zesterer / Coord Rs

Licence: mit
[deprecated] A simple, ergonomic vector mathematics crate for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Coord Rs

mightyscape-1.X
A maintained extension collection for Inkscape 1.0+, working on Windows and Linux
Stars: ✭ 23 (+27.78%)
Mutual labels:  math, physics, vector
Bounce
Bounce is a 3D physics engine for games.
Stars: ✭ 300 (+1566.67%)
Mutual labels:  library, math, physics
Sharpmath
A small .NET math library.
Stars: ✭ 36 (+100%)
Mutual labels:  vector, library, math
Cute headers
Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
Stars: ✭ 3,274 (+18088.89%)
Mutual labels:  library, math
vecti
A tiny TypeScript library for 2D vector math.
Stars: ✭ 14 (-22.22%)
Mutual labels:  math, vector
my-math-notes
All of my math stuff from grad school.
Stars: ✭ 41 (+127.78%)
Mutual labels:  math, physics
vector2d
2D Vector Library. Operates using Objects, Array or Float32Array types to allow flexible performance.
Stars: ✭ 28 (+55.56%)
Mutual labels:  math, vector
Mango
mango fun framework
Stars: ✭ 343 (+1805.56%)
Mutual labels:  vector, math
Limonengine
3D FPS game engine with full dynamic lighting and shadows
Stars: ✭ 331 (+1738.89%)
Mutual labels:  game-engine, physics
Rtm
Realtime Math
Stars: ✭ 373 (+1972.22%)
Mutual labels:  game-engine, math
Joml
A Java math library for OpenGL rendering calculations
Stars: ✭ 479 (+2561.11%)
Mutual labels:  vector, math
purescript-quantities
Physical quantities and units
Stars: ✭ 44 (+144.44%)
Mutual labels:  math, physics
arogozhnikov.github.io
'Brilliantly wrong' blog, Machine Learning visualizations live here
Stars: ✭ 120 (+566.67%)
Mutual labels:  math, physics
Pynamical
Pynamical is a Python package for modeling and visualizing discrete nonlinear dynamical systems, chaos, and fractals.
Stars: ✭ 458 (+2444.44%)
Mutual labels:  math, physics
Gamephysicscookbook
Source code for Game Physics Cookbook
Stars: ✭ 484 (+2588.89%)
Mutual labels:  math, physics
Pixel
A hand-crafted 2D game library in Go
Stars: ✭ 3,756 (+20766.67%)
Mutual labels:  game-engine, library
Qlibc
qLibc is a simple and yet powerful C library providing generic data structures and algorithms
Stars: ✭ 614 (+3311.11%)
Mutual labels:  vector, library
cas
Cellular Automata Simulator
Stars: ✭ 22 (+22.22%)
Mutual labels:  math, physics
vec-la-fp
↗️ A tiny (functional) 2d linear algebra library
Stars: ✭ 21 (+16.67%)
Mutual labels:  math, vector
Quaternion
Add built-in support for quaternions to numpy
Stars: ✭ 387 (+2050%)
Mutual labels:  math, physics

coord is deprecated. I recommend using vek, a project with near-identical aims instead.

Coord Coord

Build Status Crates.io Downloads Docs

Description

Coord is a simple, ergonomic vector mathematics crate for Rust designed for use in game development, physics engines and other programs that deal with general-purpose multi-variable mathematics.

Coord is now no_std compatible!

Example

#[macro_use]
extern crate coord;
use coord::prelude::*;

fn main() {
	// Coord supports 4 multi-variable vector types: Vec1, Vec2, Vec3 and Vec4
	let mut v = vec3!(1.0, 2.5, 3.0);

	// Coord supports common mathematical operations for both primitive and vector types
	v += vec3![1.0; 3] * 5.0;
	let _ = v * vec3!([10.0, 10.0, 10.0]);

	// Coord implements many common mathematic functions
	let _ = v.length();
	let _ = v.norm();

	// Coord supports debug and display printing of vectors
	println!("Debug => {:?}", v);
	println!("Display => {}", v);

	// Coord allows arbitrary vector component types
	let _ = vec2!(true, false); // Create a boolean vector
}

For more examples, visit https://docs.rs/coord

Features

  • [x] Generic Vec1, Vec2, Vec3 and Vec4 types
  • [x] Utility macros to make vector manipulation simpler
  • [x] VecXu, VecXi and VecXf default type definitions
  • [x] Basic mathematic operations (Add, Sub, Mul, Div)
  • [x] Mathematic functions (i.e: .length(), .norm(), etc.)
  • [x] Serialization support with the serialize feature
  • [x] 64 bit default type support with the large_defaults feature
  • [x] Hash support
  • [x] .map() method performing arbitrary element-wise vector transformation
  • [x] .convert_to() method allowing element-wise vector conversion
  • [x] .div_floor() method allowing floor-like vector division

Coming Soon

  • [ ] Bitwise operations
  • [ ] More mathematic functions
  • [ ] Modulo operator for integer vector types

Using Coord

To use Coord in your Rust project, add the following line beneath the [dependencies] section in your Cargo.toml file.

coord = "0.11.0"

If you want to enable serialization or 64-bit defaults, you should specify the dependency like the following line instead.

[dependencies.coord]
version = "0.7.0"
features = ["serialize", "large_defaults"]

FAQ

Why does Coord exist?

Coord came about as a result of a general dissatisfaction with existing vector mathematics libraries during development of the Veloren Project. Existing solutions were either too complicated, awkward to use, or required too many dependencies.

Does Coord aim to eventually implement feature X?

Coord does not aim to be a fully-blown N-dimensional mathematics library. It aims to implement a small yet elegant set of features that make it suitable for applications where simple multi-variable mathematics is required.

If you think feature X falls within that scope, and is not yet on the project todo list, you can open an issue on GitHub and I'll consider implementing it.

Why does Coord choose 32 bit values for its default types?

Coord defines a set of 'default' types within the defaults module. They are included within the prelude module too. These default types, such as Vec2f, Vec3u, Vec4b, etc. exist to make writing code with Coord faster. It is still possible to program without them like Vec2<f32>, Vec3<u32>, Vec4<bool>, etc. Coord chooses 32-bit types by default because it is my belief that these are more useful when developing for games and physics engines, which require fast calculations. Additionally, 32 bit floating point types means that Coord is compatible with OpenGL.

Why does Coord not have a general-purpose vec! macro?

Such a macro would conflict with the vec! macro within Rust's standard library.

Why does Coord not rely on the standard library?

It doesn't need to. Why limit the use cases of the library by requiring std?

Bug! Bug! I've found a bug!

Open an issue on Github and I'll fix it as soon as possible.

You can open an issue here

License

Coord is open source software, licensed under the MIT license (See 'LICENSE' or http://opensource.org/licenses/MIT)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].