NDEVR
API Documentation

Provides static functions to extrude 2D/3D shapes along polyline paths, generating triangulated solid geometry. More...

Static Public Member Functions

template<class t_type>
static void Extrude (Buffer< Vector< 3, uint04 > > &indices, Buffer< Vertex< 3, t_type > > &vertices, const Polyline< 3, t_type > &shape_to_extrude, const Polyline< 3, t_type > &extrude_path, const Vector< 3, t_type > &plane_normal, bool is_path_closed, const Matrix< fltp08 > &transform=Matrix< fltp08 >(1.0))
 Extrudes a cross-section polyline along an extrusion path, generating triangle indices and vertices for a solid mesh.
static void ExtrudePolylineAlongGeo (Geometry &linework, const Polyline< 3, fltp08 > &geo_line, const Matrix< fltp08 > &transform=Matrix< fltp08 >(1.0))
 Extrudes a given polyline cross-section along a linework geometry, producing a triangulated solid stored in the geometry's Solid index channel.
static void ExtrudeRealThickness (Geometry &linework, const Matrix< fltp08 > &transform=Matrix< fltp08 >(1.0))
 Extrudes a flat or circular cross-section along a linework geometry based on its real thickness property (NDPG::thickness).

Detailed Description

Provides static functions to extrude 2D/3D shapes along polyline paths, generating triangulated solid geometry.


The Extruder class supports multiple extrusion modes including flat ribbon extrusion (based on a geometry's real thickness property) and arbitrary polyline-along-path extrusion. It handles closed and open paths, sharp turns, vertical segments, and degenerate cases.

Author: Tyler Parke

Date: 2019-01-14

See also
Geometry, Polyline, Model

Definition at line 51 of file Extruder.h.

Member Function Documentation

◆ Extrude()

template<class t_type>
void Extruder::Extrude ( Buffer< Vector< 3, uint04 > > & indices,
Buffer< Vertex< 3, t_type > > & vertices,
const Polyline< 3, t_type > & shape_to_extrude,
const Polyline< 3, t_type > & extrude_path,
const Vector< 3, t_type > & plane_normal,
bool is_path_closed,
const Matrix< fltp08 > & transform = Matrix<fltp08>(1.0) )
inlinestatic

Extrudes a cross-section polyline along an extrusion path, generating triangle indices and vertices for a solid mesh.


At each vertex of the extrusion path, the cross-section shape is projected onto a plane perpendicular to the path direction, taking into account the plane normal for orientation. Neighboring projections are connected with triangle pairs (quads split into two triangles).

The winding order of the output triangles matches the winding of the input shape. Reversing the shape vertices will reverse the output winding order.

Note
Passing a path that fully lies in a plane whose normal is perpendicular to the given plane_normal will result in undefined behavior.
The extrusion path should be simplified (no two neighboring vertices identical) before calling this function. Zero-length segments are skipped with a continue.
Parameters
[in,out]indicesBuffer to append triangle index triples into. Each Vector<3, uint04> represents one triangle's vertex indices into the vertices buffer.
[in,out]verticesBuffer to append the projected vertex positions into.
[in]shape_to_extrudeThe cross-section polyline to project at each path vertex.
[in]extrude_pathThe path polyline along which to extrude the shape. Must contain at least 2 vertices.
[in]plane_normalThe "up" direction used to orient the cross-section relative to the path direction. Typically (0, 0, 1).
[in]is_path_closedWhether the extrusion path is closed (last vertex connects back to the first vertex).
[in]transformOptional transformation matrix applied to each projected cross-section vertex. Defaults to the identity matrix.

< Stores the last vertices of the shape_to_extrude along the path

< Stores most recently calculated vertices of the shape_to_extrude along the path

< Tracks the last valid "right" vector for handling vertical segments

< The vertex we will draw our extrusion about

< Flag for sharp turns exceeding 90 degrees

< The direction vector of our projected shape

< The original direction of the shape (used to determine curvature)

< The vertex on the shape projected via the path direction

Definition at line 219 of file Extruder.h.

References Buffer< t_type, t_memory_manager >::add(), cast(), cross(), dot(), IsInvalid(), IsValid(), plane_normal, Polyline< t_dims, t_type, t_vertex >::segment(), Polyline< t_dims, t_type, t_vertex >::segmentCount(), sqrt(), transform, Polyline< t_dims, t_type, t_vertex >::vertex(), and Polyline< t_dims, t_type, t_vertex >::vertexCount().

Referenced by ExtrudePolylineAlongGeo().

◆ ExtrudePolylineAlongGeo()

void Extruder::ExtrudePolylineAlongGeo ( Geometry & linework,
const Polyline< 3, fltp08 > & geo_line,
const Matrix< fltp08 > & transform = Matrix<fltp08>(1.0) )
inlinestatic

Extrudes a given polyline cross-section along a linework geometry, producing a triangulated solid stored in the geometry's Solid index channel.


Retrieves the plane normal and polylines from the linework, simplifies each polyline, and delegates to the templated Extrude() function. The resulting vertices and triangle indices are written back into the geometry's solid vertex and primitive buffers.

Parameters
[in]lineworkThe linework geometry to extrude along. Must have GeometryType::e_linework. Its Solid index channel will be populated with the extruded result.
[in]geo_lineThe polyline cross-section to extrude along the linework path.
[in]transformOptional transformation matrix applied to the extrusion. Defaults to the identity matrix.

Definition at line 125 of file Extruder.h.

References Geometry::addVertices(), e_linework, e_triangle, Extrude(), DesignObject::get(), Geometry::getGeometryType(), has_closed_primitive, Geometry::indexOffset(), IsInvalid(), Outline, plane_normal, Geometry::polylines(), Position, Geometry::primitiveIndexCount(), Geometry::setPrimitive(), Geometry::setPrimitiveMode(), Geometry::setPrimitiveRange(), Geometry::setSolidVertexCountValue(), Geometry::setSolidVertexOffsetValue(), Geometry::setSolidVertexReservedValue(), Geometry::setVertex(), Solid, Geometry::solidVertexOffset(), Geometry::solidVertexReservedCount(), transform, Geometry::updateModifiedTime(), Geometry::updatePrimitiveColumns(), Geometry::updateSolidVertexColumns(), Geometry::updateVertexColumns(), and Geometry::vertexCount().

Referenced by ExtrudeRealThickness().

◆ ExtrudeRealThickness()

void Extruder::ExtrudeRealThickness ( Geometry & linework,
const Matrix< fltp08 > & transform = Matrix<fltp08>(1.0) )
inlinestatic

Extrudes a flat or circular cross-section along a linework geometry based on its real thickness property (NDPG::thickness).


The extrusion cross-section shape is determined by the geometry's ThicknessMode:

  • e_none / e_pixel: Copies outline primitives directly to solid (no 3D extrusion).
  • e_flat_per_vertex / e_flat_single: Creates a flat ribbon of the given thickness.
  • e_circle_per_vertex / e_circle: Creates a circular tube with 128 radial segments.

Upon completion, the geometry's Solid index channel is filled with the extruded vertices and triangle indices.

Parameters
[in]lineworkThe linework geometry to extrude. Must have GeometryType::e_linework and a valid thickness > 0.0 set via NDPG::thickness.
[in]transformOptional transformation matrix applied to the extrusion cross-section. Defaults to the identity matrix.

< Stores the cross-section shape to extrude along the path

Definition at line 72 of file Extruder.h.

References Polyline< t_dims, t_type, t_vertex >::add(), cast(), cos(), DEGREES, Geometry::e_circle, Geometry::e_circle_per_vertex, Geometry::e_flat_per_vertex, Geometry::e_flat_single, e_linework, Geometry::e_none, Geometry::e_pixel, ExtrudePolylineAlongGeo(), DesignObject::get(), Geometry::getGeometryType(), Geometry::indexOffset(), IsValid(), Geometry::mode(), Outline, Geometry::primitiveCount(), Geometry::setPrimitiveMode(), Geometry::setPrimitiveRange(), Geometry::setSolidVertexCountValue(), sin(), Solid, thickness, Geometry::thicknessMode(), and transform.


The documentation for this class was generated from the following file: