Solids Engine
The Foresight Solids Engine is a geometric modeling kernel that enables the development of CAD and engineering tools supporting operations like Constructive Solid Geometry (CSG).
Architecture: The Modeling Graph
The solids engine uses a Directed Acyclic Graph (DAG) approach. Every operation, from spawning a primitive to performing a boolean subtraction, is stored as a node in a version-controlled graph.
This architecture enables a persistent modeling workflow. If a user needs to change the diameter of a previously drilled hole, they can update the parameter on the original cylinder node, and the engine re-evaluates the graph to produce the updated result.
Building with Boolean Operations
The core of the solids engine is the ability to compose models from geometric primitives using boolean operations. Models are defined as a tree of expressions, which the engine evaluates to produce a result.
use fdk::libs::prelude::*;
use fdk::libs::solids::evaluators::csg::{CsgExpr, ManualCsg};
// Create a modeling expression: A sphere with a box subtracted from it
let expression = CsgExpr::And(
Box::new(CsgExpr::Classifier(sphere_id)),
Box::new(CsgExpr::Not(Box::new(CsgExpr::Classifier(box_id))))
);
// Evaluators coordinate the transformation of these expressions into renderable data
let evaluator = Evaluator::new(expression);
fse.new_object(evaluator)?;Precise Representations and Evaluators
The engine is built on functional (implicit) representations called Classifiers. Unlike discrete data, a Classifier defines geometry mathematically, such as a sphere or a half-space.
Evaluators vs. Classifiers
- Classifiers: These define primitive geometry with infinite mathematical precision.
- Evaluators: These process a modeling graph (composed of Classifiers) and discretize it into a format suitable for rendering or analysis.
Sampling from Discrete Data
The engine can also bridge the gap with the real world. Evaluators can be extended to sample from discrete data sources, including block models, point clouds, or meshes streamed via Dagger and rendered by Volumesight. This allows for precise modeling operations directly against datasets gathered from the field.