33#include <NDEVR/Geometry.h>
34#include <NDEVR/Plane.h>
79 geo_line.
add({ -thickness / 2.0, 0, 0 });
80 geo_line.
add({ thickness / 2.0, 0, 0 });
85 uint04 width_segments = 128;
86 for (
uint04 x = 0; x <= width_segments; x++)
91 geo_line.
add(position);
128 for (
uint04 i = 0; i < polylines.size(); i++)
130 polylines[i].simplify();
135 if (bounds[
X] * bounds[
X] + bounds[
Y] * bounds[
Y] > bounds[
Z] * bounds[
Z])
136 poly_normal = { 0.0, 0.0, 1.0 };
137 else if (bounds[
X] * bounds[
X] > bounds[
Y] * bounds[
Y])
138 poly_normal = { 0.0, 1.0, 0.0 };
140 poly_normal = { 1.0, 0.0, 0.0 };
142 Extrude(indices, vertices, geo_line, polylines[i], poly_normal, is_closed, poly_transform);
153 if (solid_vertex_size < vertices.
size())
155 linework.
addVertices(solid_vertex_offset, vertices.
size() - solid_vertex_size);
166 for (
uint04 i = 0; i < indices.size(); i++)
198 template<
class t_type>
204 ,
bool is_path_closed
218 bool greater_than_90_turn =
false;
223 if (is_path_closed && (i == 0 || i == extrude_path.
segmentCount()))
227 original_dir = extrude_path.
segment(extrude_path.
segmentCount() - 1).ray().template normalized<t_type>();
229 dir = (dir_2 + original_dir).
template normalized<t_type>();
230 greater_than_90_turn =
dot(dir_2, original_dir) < 0;
232 else if (last.
size() == 0)
235 original_dir = extrude_path.
segment(i).ray().template normalized<t_type>();
242 original_dir = extrude_path.
segment(i - 1).ray().template normalized<t_type>();
248 original_dir = extrude_path.
segment(i - 1).ray().template normalized<t_type>();
250 dir = (dir_2 + original_dir).
template normalized<t_type>();
251 greater_than_90_turn =
dot(dir_2, original_dir) < 0;
256 if (dir.template magnitude<fltp08>() == 0.0 ||
IsInvalid(dir))
285 const t_type p_off_original =
cast<t_type>(1.0) -
dot(dir, original_dir) *
dot(dir, original_dir);
287 t_type extra_distance =
sqrt(4 * p_off_original * p_off_original + 1.0);
288 if (greater_than_90_turn)
289 extra_distance = 2.0 / extra_distance;
292 for (
const auto& vertex : shape_to_extrude)
295 projection += vertex[
X] * right;
296 projection += vertex[
Y] * up;
297 projection += vertex[
Z] * dir;
298 projection = projection.template normalized<fltp08>();
299 projection = (transform * projection) * vertex.template magnitude<fltp08>();
300 current.
add((extra_distance * projection) + offset);
305 for (
uint04 n = 0; n < shape_to_extrude.vertexCount() - 1; n++)
311 vertices.add(last[n]);
312 vertices.add(current[n]);
313 vertices.add(current[n + 1]);
314 vertices.add(last[n + 1]);
#define lib_assert(expression, message)
Definition LibAssert.h:61
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
void add(t_type &&object)
Adds object to the end of the buffer.
Definition Buffer.hpp:186
constexpr t_index_type size() const
Definition Buffer.hpp:823
void clear()
Definition Buffer.hpp:422
Matrix< fltp08 > getTransform() const
Class containing static functions that define logic to extrude shapes along some given polyline.
Definition Extruder.h:47
static void ExtrudeRealThickness(Geometry &linework, const Matrix< fltp08 > &transform=Matrix< fltp08 >(1.0))
Definition Extruder.h:63
static void ExtrudePolylineAlongGeo(Geometry &linework, const Polyline< 3, fltp08 > &geo_line, const Matrix< fltp08 > &transform=Matrix< fltp08 >(1.0))
Definition Extruder.h:113
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))
Definition Extruder.h:199
A core class within the model heirarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:64
void setSolidVertexOffsetValue(uint04 count)
Definition Geometry.h:1335
void updateSolidVertexColumns(bool invalidate_bounds=true, bool erase_kd_tree=true)
void updateModifiedTime(Time time=Time::SystemTime())
void updateVertexColumns(bool invalidate_bounds=true, bool erase_kd_tree=true)
void setPrimitive(PrimitiveProperty property, uint04 index, t_type index_value)
Definition Geometry.h:335
uint04 addVertices(uint04 size)
Definition Geometry.h:686
uint04 solidVertexOffset() const
Definition Geometry.h:717
uint04 vertexCount() const
Definition Geometry.h:713
GeometryType getGeometryType() const
void setPrimitiveRange(PrimitiveProperty mode, uint04 start, uint04 primitive_count)
uint04 primitiveCount(PrimitiveProperty property) const
Definition Geometry.h:669
void setSolidVertexCountValue(uint04 count)
Definition Geometry.h:1327
void updatePrimitiveColumns(bool remove_tree=true)
void setVertex(VertexProperty property, uint04 index, const t_type &vector)
Definition Geometry.h:871
@ e_flat_per_vertex
Definition Geometry.h:134
@ e_circle
Definition Geometry.h:135
@ e_none
Definition Geometry.h:131
@ e_flat_single
Definition Geometry.h:133
@ e_circle_per_vertex
Definition Geometry.h:136
@ e_pixel
Definition Geometry.h:132
t_type getGeometryProperty(GeometryProperty property) const
Definition Geometry.h:174
@ e_plane_normal
Definition Geometry.h:107
@ e_has_closed_primitive
Definition Geometry.h:106
@ e_thickness
Definition Geometry.h:101
Buffer< Polyline< t_dims, t_type > > polylines(PrimitiveProperty primitive_property, VertexProperty vertex_property) const
Definition Geometry.h:1170
ThicknessMode thicknessMode() const
void setPrimitiveMode(PrimitiveProperty property, PrimitiveMode mode)
PrimitiveMode mode(PrimitiveProperty property) const
Definition Geometry.h:309
uint04 indexOffset() const
Definition Geometry.h:628
void setSolidVertexReservedValue(uint04 count)
Definition Geometry.h:1331
uint04 primitiveIndexCount() const
Definition Geometry.h:665
uint04 solidVertexReservedCount() const
Definition Geometry.h:721
Definition Matrix.hpp:176
Matrix< t_type, t_cols, t_rows > invert() const
Definition Matrix.hpp:652
A polyline which stores vertex information for many points along a given path.
Definition CoordinateProjectionManager.h:44
uint04 vertexCount() const
Definition PolyLine.hpp:191
uint04 segmentCount() const
Definition PolyLine.hpp:206
LineSegment< t_dims, t_type, t_vertex > segment(uint04 index) const
Definition PolyLine.hpp:161
void add(const t_vertex &vertex)
Definition PolyLine.hpp:241
const t_vertex & vertex(uint04 index) const
Definition PolyLine.hpp:143
Definition Vertex.hpp:317
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:170
t_type dot(const Vector< t_dims, t_type > &v1, const Vector< t_dims, t_type > &v2)
Definition VectorFunctions.hpp:1030
@ DEGREES
Definition Angle.h:58
std::enable_if<!ObjectInfo< t_type >::Float, fltp08 >::type cos(const Angle< t_type > &angle)
Performs optimized cosine operation on the given angle using pre-computed lookup table for optimal sp...
Definition AngleFunctions.h:124
constexpr Vector< 1, t_type > cross(const Vector< 1, t_type > &, const Vector< 1, t_type > &)
Definition VectorFunctions.hpp:898
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
t_type sqrt(const t_type &value)
Definition VectorFunctions.hpp:1225
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
std::enable_if<!ObjectInfo< t_type >::Float, fltp08 >::type sin(const Angle< t_type > &angle)
Performs optimized sine operation on the given angle using pre-computed lookup table for optimal spee...
Definition AngleFunctions.h:79
@ Y
Definition BaseValues.hpp:169
@ X
Definition BaseValues.hpp:167
@ Z
Definition BaseValues.hpp:171
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233