All Projects → olson-sean-k → Plexus

olson-sean-k / Plexus

Licence: mit
Polygonal mesh processing.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Plexus

Three Mesh Bvh
A BVH implementation to speed up raycasting against three.js meshes.
Stars: ✭ 302 (+235.56%)
Mutual labels:  graphics, mesh, geometry
Polylidar
Polylidar3D - Fast polygon extraction from 3D Data
Stars: ✭ 106 (+17.78%)
Mutual labels:  mesh, polygon, geometry
Matgeom
Matlab geometry toolbox for 2D/3D geometric computing
Stars: ✭ 168 (+86.67%)
Mutual labels:  mesh, polygon, geometry
Graphical Debugging
GraphicalDebugging extension for Visual Studio
Stars: ✭ 88 (-2.22%)
Mutual labels:  polygon, geometry
Tinyply
🌍 C++11 ply 3d mesh format importer & exporter
Stars: ✭ 358 (+297.78%)
Mutual labels:  mesh, geometry
Inkkit
Drawing and Geometry made easy on iOS - now in Swift 3.0
Stars: ✭ 367 (+307.78%)
Mutual labels:  graphics, geometry
Point Cloud Utils
A Python library for common tasks on 3D point clouds
Stars: ✭ 281 (+212.22%)
Mutual labels:  mesh, geometry
Mesh Subdivision
A collection of common mesh subdivision algorithms
Stars: ✭ 25 (-72.22%)
Mutual labels:  graphics, mesh
Earcut.hpp
Fast, header-only polygon triangulation
Stars: ✭ 447 (+396.67%)
Mutual labels:  polygon, geometry
3dhop
3D Heritage Online Presenter
Stars: ✭ 89 (-1.11%)
Mutual labels:  graphics, mesh
Geometry2d
Unity3D: A set of helper classes for 2D geometric calculations.
Stars: ✭ 40 (-55.56%)
Mutual labels:  polygon, geometry
3dtilesrendererjs
Renderer for 3D Tiles in Javascript using three.js
Stars: ✭ 333 (+270%)
Mutual labels:  graphics, geometry
Cga.js
CGA 3D 计算几何算法库 | 3D Compute Geometry Algorithm Library webgl three.js babylon.js等任何库都可以使用
Stars: ✭ 313 (+247.78%)
Mutual labels:  graphics, geometry
Touchdesigner shared
TouchDesigner toxes and small projects
Stars: ✭ 385 (+327.78%)
Mutual labels:  graphics, geometry
Sharpmath
A small .NET math library.
Stars: ✭ 36 (-60%)
Mutual labels:  polygon, geometry
Sophus
C++ implementation of Lie Groups using Eigen.
Stars: ✭ 1,048 (+1064.44%)
Mutual labels:  graphics, geometry
Wicket
A modest library for moving between Well-Known Text (WKT) and various framework geometries
Stars: ✭ 484 (+437.78%)
Mutual labels:  polygon, geometry
Pymesh
Geometry Processing Library for Python
Stars: ✭ 1,135 (+1161.11%)
Mutual labels:  graphics, geometry
MeshFrame
A light-weighted, efficient and header-only mesh processing frame work.
Stars: ✭ 18 (-80%)
Mutual labels:  geometry, mesh
Mather
zzllrr mather(an offline tool for Math learning, education and research)小乐数学,离线可用的数学学习(自学或教学)、研究辅助工具。计划覆盖数学全部学科的解题、作图、演示、探索工具箱。目前是演示Demo版(抛转引玉),但已经支持数学公式编辑显示,部分作图功能,部分学科,如线性代数、离散数学的部分解题功能。最终目标是推动专业数学家、编程专家、教育工作者、科普工作者共同打造出更加专业级的Mather数学工具
Stars: ✭ 270 (+200%)
Mutual labels:  topology, geometry
Plexus

Plexus is a highly composable Rust library for polygonal mesh processing. See the website for the most recent API documentation and the user guide.

GitHub docs.rs crates.io Gitter

Primitives

Plexus provides primitive topological structures that can be composed using generators and iterator expressions. Iterator expressions operate over a sequence of polygons with arbitrary vertex data. These polygons can be decomposed, tessellated, indexed, and collected into mesh data structures.

use decorum::R64; // See "Integrations".
use nalgebra::Point3;
use plexus::buffer::MeshBuffer;
use plexus::index::Flat3;
use plexus::prelude::*;
use plexus::primitive::generate::Position;
use plexus::primitive::sphere::UvSphere;

use crate::render::pipeline::{Color4, Vertex};

type E3 = Point3<R64>;

// Create a buffer of index and vertex data from a uv-sphere.
let buffer: MeshBuffer<Flat3, Vertex> = UvSphere::new(16, 8)
    .polygons::<Position<E3>>()
    .map_vertices(|position| Vertex::new(position, Color4::white()))
    .triangulate()
    .collect();

The above example uses a generator and iterator expression to transform the positional data of a sphere into a linear buffer for indexed drawing. See the sphere example for a rendered demonstration.

Half-Edge Graphs

The MeshGraph type represents polygonal meshes as an ergonomic half-edge graph that supports arbitrary data in vertices, arcs (half-edges), edges, and faces. Graphs can be traversed and manipulated in many ways that iterator expressions and linear buffers cannot.

use plexus::graph::MeshGraph;
use plexus::prelude::*;
use plexus::primitive::Tetragon;
use ultraviolet::vec::Vec3;

type E3 = Vec3;

// Create a graph of a tetragon.
let mut graph = MeshGraph::<E3>::from(Tetragon::from([
    (1.0, 1.0, 0.0),
    (-1.0, 1.0, 0.0),
    (-1.0, -1.0, 0.0),
    (1.0, -1.0, 0.0),
]));
// Extrude the face of the tetragon.
let key = graph.faces().nth(0).unwrap().key();
let face = graph.face_mut(key).unwrap().extrude_with_offset(1.0).unwrap();

Plexus avoids exposing very basic topological operations like inserting individual vertices into a graph, because they can easily be done incorrectly. Instead, graphs are typically manipulated with more abstract operations like merging and splitting.

See the user guide for more details about graphs.

Geometric Traits

Plexus provides optional traits to support spatial operations by exposing positional data in vertices. If the data exposed by the AsPosition trait supports these geometric traits, then geometric operations become available in primitive and mesh data structure APIs.

use glam::Vec3A;
use plexus::geometry::{AsPosition, Vector};
use plexus::graph::GraphData;
use plexus::prelude::*;

type E3 = Vec3A;

#[derive(Clone, Copy, PartialEq)]
pub struct Vertex {
    pub position: E3,
    pub normal: Vector<E3>,
}

impl GraphData for Vertex {
    type Vertex = Self;
    type Arc = ();
    type Edge = ();
    type Face = ();
}

impl AsPosition for Vertex {
    type Position = E3;

    fn as_position(&self) -> &Self::Position {
        &self.position
    }
}

Data structures like MeshGraph also provide functions that allow user code to compute geometry without requiring any of these traits; the data in these structures may be arbitrary, including no data at all.

Integrations

Plexus integrates with the theon crate to provide geometric traits and support various mathematics crates in the Rust ecosystem. Any mathematics crate can be used and, if it is supported by Theon, Plexus provides geometric APIs by enabling Cargo features.

Feature Default Crate
geometry-cgmath No cgmath
geometry-glam No glam
geometry-mint No mint
geometry-nalgebra No nalgebra
geometry-ultraviolet No ultraviolet

Enabling the corresponding feature is recommended if using one of these supported crates.

Plexus also integrates with the decorum crate for floating-point representations that can be hashed for fast indexing. The R64 type is a (totally ordered) real number with an f64 representation that cannot be NaN nor infinity, for example. Geometric conversion traits are implemented for supported types to allow for implicit conversions of scalar types.

Encodings

Plexus provides support for polygonal mesh encodings. This allows mesh data structures like MeshGraph and MeshBuffer to be serialized and deserialized to and from various formats.

use nalgebra::Point3;
use plexus::encoding::ply::{FromPly, PositionEncoding};
use plexus::graph::MeshGraph;
use plexus::prelude::*;
use std::fs::File;

type E3 = Point3<f64>;

let ply = File::open("cube.ply").unwrap();
let encoding = PositionEncoding::<E3>::default();
let (graph, _) = MeshGraph::<E3>::from_ply(encoding, ply).unwrap();

Encoding support is optional and enabled via Cargo features.

Feature Default Encoding Read Write
encoding-ply No PLY Yes No

See the teapot example for a rendered demonstration of reading a mesh from the file system.

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].