parry2d 0.26.0

2 dimensional collision detection library in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate num_traits as num;

use parry2d::math::Vector;
use parry2d::shape::ConvexPolygon;

fn main() {
    let points = [
        Vector::new(-1.0, 1.0),
        Vector::new(-0.5, -0.5),
        Vector::new(0.0, 0.5),
        Vector::new(0.5, -0.5),
        Vector::new(1.0, 1.0),
    ];

    let convex = ConvexPolygon::from_convex_hull(&points).expect("Invalid convex polygon.");
    assert!(convex.points().len() == 4);
}