Truck CAD Kernel

repository·master·Indexed 23 days ago

https://github.com/ricosjp/truck

An open-source CAD kernel written in Rust focusing on B-rep with NURBS. It utilizes WebGPU for high performance and safety, providing a modular system of crates including truck-geometry for B-splines and NURBS, truck-topology for solids and shells, truck-modeling for integrated algorithms, and truck-js for JavaScript/WASM integration.

Tokens
63.1K
Snippets
123
Records
373
Agent score
80%

What's inside Truck

  1. Overview of Truck crates

    master

    Truck is a modular CAD kernel composed of several specialized crates. Depending on your needs, you can use specific modules for geometry, topology, or modeling:

    • truck-base: Basic structs and traits (e.g., cgmath imports, curve/surface traits, tolerance).
    • truck-geotrait: Defines geometric traits like ParametricCurve and ParametricSurface.
    • truck-geometry: Geometrical structs including knot vectors, B-splines, and NURBS.
    • truck-topology: Topological structs including vertex, edge, wire, face, shell, and solid.
    • truck-polymesh: Polygon data structures and algorithms for handling meshes and meshing shapes.
    • truck-meshalgo: Mesh algorithms, including shape tessellation.
    • truck-modeling: Integrated modeling algorithms combining geometry and topology.
    • truck-shapeops: Boolean operations for Solid objects.
    • truck-platform: Graphic utility library based on wgpu.
    • truck-rendimpl: Visualization of shapes and polygon meshes based on the platform.
    • truck-js: A JavaScript wrapper for truck.
  2. Overview of truck-shapeops

    master

    The truck-shapeops crate provides advanced geometric operations for the Truck CAD kernel. Its primary functions include:

    • Boolean Operations: Performs boolean operations (such as AND, OR, NOT) on Solid objects.
    • Shape Healing: Provides tools to heal and repair shapes when importing them from external CAD systems to ensure geometric integrity.
  3. Overview of truck-base

    master
    The truck-base crate provides the fundamental building blocks for the Truck CAD kernel. It contains essential basic structs and traits required for geometric modeling, including imports for cgmath, definitions for curve and surface traits, and tolerance management.
  4. Use truck-geotrait to access geometric traits

    master

    The truck-geotrait crate provides a set of core geometric traits that define how different geometric entities behave. These traits allow for polymorphic handling of various geometric types. Key traits include:

    • ParametricCurve: Defines behavior for curves that can be evaluated at a parameter value.
    • ParametricSurface: Defines behavior for surfaces that can be evaluated at two parameters.

    By implementing or using these traits, you can write generic geometric algorithms that work across different underlying implementations of curves and surfaces.

  5. Understand material properties in material-samples

    master

    In the material-samples demonstration, material properties are visualized as follows:

    • Reflectance: Higher reflectance is represented by models positioned further to the right.
    • Roughness: Higher roughness is represented by models positioned higher up.

    Note: A model that is both far to the right and low will appear black because it lacks light diffusion and has no roughness in the microfacet model.

  6. Topological primitives in truck-topology

    master
    The truck-topology crate provides the fundamental topological structures used to represent geometric entities in the Truck CAD kernel. These structs define the hierarchy of a geometric model, ranging from individual points to complex volumes.