NDEVR
API Documentation
PolylineSlicer.h
1#pragma once
2#include <NDEVR/Model.h>
3#include <NDEVR/Translator.h>
4#include <NDEVR/ProgressInfo.h>
5#include <NDEVR/Plane.h>
6#include <NDEVR/DesignObjectResourceCache.h>
7#include <NDEVR/Polyline.h>
8namespace NDEVR
9{
10 class Model;
11 class Geometry;
13 template<uint01 t_dims, class t_type> class RTree;
14
32
49
57 {
58 public:
66
75 virtual void cleanupSlicePlanes(const Matrix<fltp08>&, Buffer<SlicePlane>&) { /*Do nothing*/ };
76 };
77
95
134
161
172 {
173 public:
180
185 static constexpr StringView SliceTypeName() { return "polyline_slice"; }
186 protected:
192 static void SliceIntoLineSegments(uint04 slice_index, PolylineSliceCache& args);
193
200 static void SliceIntoNearPoints(uint04 slice_index, PolylineSliceCache& args, fltp08 point_distance);
201
209 static void PrepareTriCache(const Matrix<fltp08>& transform, const Geometry& geo, PolylineSliceCache& params);
210
218 static void PreparePointCache(const Matrix<fltp08>& transform, const Model& model, PolylineSliceCache& params);
219
228 static void FinishSegmenting(const Matrix<fltp08>& transform, Model& model, uint04 slice_index, PolylineSliceCache& params);
229
237 static void AddVertices(Geometry& geo, const SlicePlane& plane, const Matrix<fltp08>& mat);
238 };
239}
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:54
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A cache for reusing Model and Geometry objects to avoid repeated allocation.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:143
Slices geometry into evenly spaced cross sections along a grid defined by a transformation matrix and...
Buffer< SlicePlane > slicePlanes(const Matrix< fltp08 > &trans, const Bounds< 3, fltp08 > &bounds) override
Generates grid-aligned slice planes within the given bounds.
Vector< 3, fltp08 > spacing
Spacing between slices along each axis. Invalid axes are not sliced.
Matrix< fltp08 > transform
Transformation defining the grid orientation and origin.
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
A core class that represents a node on model hierarchy.
Definition Model.h:292
Slices geometry at evenly spaced intervals along a specified polyline path, producing cross-section s...
bool slice_horizontal_parallel
Whether to generate horizontal slices parallel to the path direction.
Polyline< 3, fltp08 > path
The polyline path along which slices are generated.
void cleanupSlicePlanes(const Matrix< fltp08 > &, Buffer< SlicePlane > &) override
Post-processes path-based slice planes after slicing.
fltp08 spacing
Distance between slice stations along the path.
Vector< 2, fltp08 > max_hv_distance
Maximum horizontal and vertical distance from the slice plane for point inclusion.
bool slice_orthogonal
Whether to generate slices orthogonal to the path direction.
bool slice_vertical_orthogonal
Whether to generate vertical slices orthogonal to the path direction.
Polyline< 3, fltp08 > makeCenterlinePath(const Polyline< 3, fltp08 > &path)
Constructs a centerline path from the input polyline, typically by resampling or smoothing to produce...
Buffer< SlicePlane > slicePlanes(const Matrix< fltp08 > &trans, const Bounds< 3, fltp08 > &bounds) override
Generates slice planes at regular intervals along the polyline path.
Matrix< fltp08 > transform
Transformation defining the path coordinate system.
bool slice_vertical_parallel
Whether to generate vertical slices parallel to the path direction.
Logic for a given plane or N-dimensions.
Definition Plane.hpp:53
Abstract interface for generating slice planes from a bounding region.
virtual void cleanupSlicePlanes(const Matrix< fltp08 > &, Buffer< SlicePlane > &)
Post-processes slice planes after slicing is complete.
virtual Buffer< SlicePlane > slicePlanes(const Matrix< fltp08 > &transform, const Bounds< 3, fltp08 > &bounds)=0
Generates the set of slice planes for the given transform and bounding volume.
Logic for slicing one or more Model/Geometry objects into polyline cross-section Model/Geometry objec...
static void AddVertices(Geometry &geo, const SlicePlane &plane, const Matrix< fltp08 > &mat)
Adds the vertices from a SlicePlane into a Geometry object, applying the given transformation matrix.
static void PreparePointCache(const Matrix< fltp08 > &transform, const Model &model, PolylineSliceCache &params)
Extracts and transforms points from a Model into the slice cache and builds the point spatial index.
static void CreateActiveLinework(SlicerArgs &args)
Main entry point that slices the specified models and writes the resulting linework into the output r...
static void FinishSegmenting(const Matrix< fltp08 > &transform, Model &model, uint04 slice_index, PolylineSliceCache &params)
Finalizes segmenting for a slice by organizing polyline segments and writing them into the output mod...
static constexpr StringView SliceTypeName()
Returns the identifier string used to tag polyline slice operations.
static void SliceIntoLineSegments(uint04 slice_index, PolylineSliceCache &args)
Performs plane-triangle intersection for a single slice, producing polyline segments.
static void SliceIntoNearPoints(uint04 slice_index, PolylineSliceCache &args, fltp08 point_distance)
Collects points near a slice plane within the configured distance threshold.
static void PrepareTriCache(const Matrix< fltp08 > &transform, const Geometry &geo, PolylineSliceCache &params)
Extracts and transforms triangles from a Geometry object into the slice cache and builds the triangle...
A sequence of connected line segments defined by ordered vertices along a path.
Definition PolyLine.hpp:55
Used with InfoPipe to signal that the system will be using progress.
The core String View class for the NDEVR API.
Definition StringView.h:58
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
@ transform
A 4x4 transform matrix that maps local coordinates into global space.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Internal cache for storing intermediate data during a polyline slice operation, including collected t...
DesignObjectResourceCache resource_cache
Cache for design object resources.
RTree< 3, fltp08 > * tri_tree
Spatial index for efficient triangle intersection queries.
Bounds< 3, fltp08 > bounds
Accumulated bounding box of all processed geometry.
RTree< 3, fltp08 > * point_tree
Spatial index for efficient point proximity queries.
Buffer< SlicePlane > planes
The slice planes being processed.
Buffer< RGBColor > point_colors
Colors corresponding to collected points.
ProgressInfo log
Progress reporter for the slice operation.
Buffer< Vertex< 3, fltp08 > > points
Collected point vertices from source geometry.
Buffer< Triangle< 3, fltp08 > > triangles
Collected triangles from source geometry for intersection testing.
PolylineSliceIterator * slice_plane
The iterator providing slice plane definitions.
PolylineSliceCache(LogPtr pipe)
Constructs a PolylineSliceCache with the given log pipe for progress reporting.
Matrix< fltp08 > slice_transform
Transformation applied to slice geometry during processing.
Represents a single plane used to slice geometry, along with the resulting slice data (polyline segme...
Buffer< Vertex< 3, fltp04 > > polyline_vertices
Vertices forming the polyline cross-section from triangle intersection.
TranslatedString group
Group name for organizing related slices.
Buffer< Buffer< uint04 > > segments
Indices defining individual polyline segments within the slice.
Dictionary< String, Buffer< fltp04 > > properties
Named property channels associated with the slice data.
TranslatedString name
Display name for this slice (e.g., station label).
Buffer< Vertex< 3, fltp04 > > point_vertices
Vertices of nearby points captured by the slice.
Vertex< 3, fltp04 > center_point
Center point of the slice, or Invalid if not set.
Buffer< RGBColor > point_colors
Colors corresponding to each entry in point_vertices.
Plane< 3, fltp08 > plane
The geometric plane used for this slice.
Arguments for performing a Geometry slice operation.
LogPtr log
Optional log for progress reporting.
const void * lock
Optional lock pointer for thread synchronization.
Buffer< Model > models_to_slice
Collection of models to be sliced.
DesignObjectResourceCache resource_cache
Cache for design object resources used during slicing.
fltp08 point_distance
Maximum distance from a slice plane for a point to be included. Invalid means no point slicing.
Model linework_root
Root model that will contain the generated linework output.
PolylineSliceIterator * slicer
Iterator that defines the slice planes to use.