euclidean 0.1.0

A collection of operations for euclidean geometry in three dimensions.
Documentation
  • Coverage
  • 82.61%
    19 out of 23 items documented1 out of 22 items with examples
  • Size
  • Source code size: 31.53 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 466.52 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Makogan

Euclidean

This crate contains a collection of type agnostic euclidean algorithms..

These include, but are not limited to:

  • Triangle box intersection.
  • Segment-segment intersection.
  • Projecting a point onto a line.
  • Projecting a point onto a plane.
  • Find the closest points on two lines.
  • And more.

The crate relies on linear_isomoprhic to abstract over the underlying type, meaning that it can be used with a wide variety of underlying vector types.

Some functions are dimension agnostic. However, many assume $\mathbb{R}^3$.

Example use:

use crate::segment_segment_intersection;

use ::core::f32::consts::PI;
type Vec2 = nalgebra::Vector2<f32>;
type Vec3 = nalgebra::Vector3<f32>;

fn project_onto_polyline() {
    let curve: Vec<_> = (0..50)
        .map(|i| {
            let t = i as f32 / 49.;
            let t = t * PI;

            Vec2::new(t.cos(), t.sin())
        })
        .collect();

    let point = Vec2::new(0., 10.);
    let (proj, param, interval) = project_onto_open_poly_line(&point, &curve);

    assert!((proj - Vec2::new(0., 1.0)).norm() < 0.001,);
    assert!((param - 0.5).abs() < 0.001);
    assert!(interval == 24);
}

The library is tested directly against the Nalgebra crate. If you find that it doesn't work with your own vector type, please open an issue.