33#include <NDEVR/DesignObject.h>
34#include <NDEVR/Triangle.h>
35#include <NDEVR/Polygon.h>
40 template<u
int01 t_dims,
class t_type>
115 return object->m_base->geometry_properties[eint01(property)];
122 return object->m_design_index;
244 void copyFrom(
const Geometry& geo,
bool copy_tree =
true,
bool copy_vertices =
true);
574 return m_base->primitive_index_column;
581 return m_base->primitive_index_column;
588 return m_base->primitive_fan_column;
595 return m_base->primitive_fan_column;
602 return m_base->primitive_flag_column;
609 return m_base->primitive_flag_column;
616 return *
m_base->face_to_edge_column;
623 return *
m_base->face_to_edge_column;
630 return *
m_base->edge_to_face_column;
637 return *
m_base->edge_to_face_column;
660 return m_base->primitive_index_column.size() > 0;
667 return m_base->primitive_fan_column.size() > 0;
711 template<
class t_type>
728 template<
class t_type>
736 lib_assert(index_value[A] <
vertexCount(),
"index for geometry out of range A");
737 lib_assert(index_value[B] <
vertexCount(),
"index for geometry out of range B");
744 switch (
mode(property))
747 column.set(index_offset +
index + A, index_value[A]);
748 column.set(index_offset +
index + B, index_value[B]);
751 column.set(index_offset + 2 *
index + A, index_value[A]);
752 column.set(index_offset + 2 *
index + B, index_value[B]);
755 lib_assert(
false,
"Unknown Primitive Mode for vertex<2>");
761 struct OptimizedPrimitiveDef
763 OptimizedPrimitiveDef()
793 ref.max_vertex_index = ref.min_vertex_index +
vertexCount();
803 template<
class t_vec_type>
807 lib_assert(
index < ref.index_max_offset,
"Index out of bounds");
808 for (
uint01 i = 0; i < 3; i++)
810 lib_assert(
IsInvalid(index_value) || index_value >= ref.min_vertex_index,
"Index out of bounds");
811 lib_assert(
IsInvalid(index_value) || index_value < ref.max_vertex_index,
"Index out of bounds");
820 template<
class t_vec_type>
824 lib_assert(
index < ref.index_max_offset,
"Index out of bounds");
825 for (
uint01 i = 0; i < 3; i++)
827 lib_assert(
IsInvalid(index_value[i]) || index_value[i] >= ref.min_vertex_index,
"Index out of bounds");
828 lib_assert(
IsInvalid(index_value[i]) || index_value[i] < ref.max_vertex_index,
"Index out of bounds");
846 if (
IsValid(index_fan_location))
848 (*ref.
column)[index_fan_location] = index_value[A];
854 lib_assert(
false,
"Unknown Primitive Mode for vertex<3>");
861 template<
class t_vec_type>
864 lib_assert(
index < ref.index_max_offset,
"Index out of bounds");
865 t_vec_type index_value;
891 index_value = Constant<t_vec_type>::Invalid;
896 lib_assert(index_fan_location >= ref.
index_offset && index_fan_location - ref.
index_offset < ref.index_max_offset,
"bad fan location");
897 index_value[A] = (*ref.
column)[index_fan_location];
903 lib_assert(
false,
"Unknown Primitive Mode for vertex<3>");
911 template<
class t_type>
921 template<
class t_type>
948 template<
class t_type>
955 return Constant<t_type>::Invalid;
962 template<
class t_type>
966 if (primitive_count == 0)
977 switch (
mode(property))
980 lib_assert(
index < primitive_count,
"Out of bounds index request");
984 lib_assert(
index + 1 < primitive_count,
"Out of bounds index request");
988 lib_assert(
false,
"Bad property fetch mode");
992 return Constant<t_type>::Invalid;
1000 template<
class t_type>
1007 auto v_mode =
mode(property);
1017 index += index_offset;
1027 index_value = Constant<t_type>::Invalid;
1030 column[index_fan_location]
1035 lib_assert(
false,
"Bad property fetch mode");
1038 return Constant<t_type>::Invalid;
1118 template<
class t_type>
1124 return primitive_count;
1135 return primitive_count;
1314 return m_base->vertex_table.get(property_index).label();
1347 template<
class t_type>
1363 template<
class t_type>
1373 template<
class t_type>
1384 template<
class t_type>
1395 template<
class t_type>
1406 template<
class t_type>
1416 template<
class t_type>
1428 template<
class t_type>
1440 template<
class t_type>
1451 template<
class t_type>
1459 col.set(vertex_offset + i,
vertices[i]);
1471 return m_base->vertex_table[property];
1479 return m_base->vertex_table[property];
1631 template<
class t_type>
1637 sorted_vertices.setSize(
indices.size(), Constant<t_type>::Invalid);
1640 if (
indices[i] < original_vals.size())
1641 sorted_vertices[i] = original_vals[
indices[i]];
1643 return sorted_vertices;
1653 template<
class t_type>
1665 template<
class t_type>
1676 template<
class t_type>
1681 auto& col =
column(property);
1684 col.set(vertex_offset + i,
vertices[i]);
1693 template<
class t_type,
class t_matrix_type>
1698 auto& col =
column(property);
1701 col.set(vertex_offset + i, matrix *
vertices[i].
template as<t_type::NumberOfDimensions(), t_matrix_type>());
1709 template<
class t_type>
1712 lib_assert(offset + size <=
vertexCount(),
"Out of bounds vertex set");
1714 auto& col =
column(property);
1715 for (
uint04 i = 0; i < size; i++)
1717 col.set(vertex_offset + i,
vertices[i]);
1724 template<
class t_type>
1735 template<u
int01 t_dims,
class t_type>
1750 template<u
int01 t_dims,
class t_type>
1771 template<
class t_type>
1781 template<
class t_type>
1784 lib_assert(start + size <=
vertexCount(),
"Out of bounds vertex selection");
1786 return m_base->vertex_table[property].getAll<t_type>(vertex_offset + start, size);
1791 template<
class t_type>
1802 template<
class t_type>
1805 lib_assert(start + size <=
vertexCount(),
"Out of bounds vertex selection");
1807 return column(property).getAll<t_type>(vertex_offset + start, size);
1813 template<
class t_type>
1823 template<
class t_type>
1826 lib_assert(start + size <=
vertexCount(),
"Out of bounds vertex selection");
1828 return propertyColumn(property).getAll<t_type>(vertex_offset + start, size);
1835 template<u
int01 t_dims,
class t_type>
1839 switch (
mode(primitive_property))
1847 lib_assert(
false,
"Bad property fetch mode");
1850 for (
uint04 i = 0; i < size; ++i)
1858 template<u
int01 t_dims,
class t_type>
1870 template<u
int01 t_dims,
class t_type>
1873 lib_assert(start + size <=
primitiveCount(primitive_property),
"Out of bounds triangle selection");
1881 for (
uint04 i = start; i < size + start; i++)
1888 index_column.
get<
uint04>(index_offset + 3 * i + 0)
1889 , index_column.
get<
uint04>(index_offset + 3 * i + 1)
1890 , index_column.
get<
uint04>(index_offset + 3 * i + 2) };
1894 index_column.
get<
uint04>(i + index_offset + 0)
1895 , index_column.
get<
uint04>(i + index_offset + 1)
1896 , index_column.
get<
uint04>(i + index_offset + 2) };
1908 lib_assert(index_fan_location >= index_offset && index_fan_location - index_offset <
primitiveCount(primitive_property),
"bad fan location");
1910 index_column.
get<
uint04>(index_fan_location)
1911 , index_column.
get<
uint04>(i + index_offset - 1)
1912 , index_column.
get<
uint04>(i + index_offset) };
1916 lib_assert(
false,
"Bad property fetch mode");
1947 template<u
int01 t_dims,
class t_type>
1959 template<u
int01 t_dims,
class t_type>
1962 lib_assert(start + size <=
primitiveCount(primitive_property),
"Out of bounds polygon selection");
1977 for (
uint04 i = start; i < size + start; i++)
1984 index_column.
get<
uint04>(index_offset + 3 * i + 0)
1985 , index_column.
get<
uint04>(index_offset + 3 * i + 1)
1986 , index_column.
get<
uint04>(index_offset + 3 * i + 2) };
1990 index_column.
get<
uint04>(i + index_offset + 0)
1991 , index_column.
get<
uint04>(i + index_offset + 1)
1992 , index_column.
get<
uint04>(i + index_offset + 2) };
2001 index_column.
get<
uint04>(index_fan_location)
2002 , index_column.
get<
uint04>(i + index_offset - 1)
2003 , index_column.
get<
uint04>(i + index_offset) };
2006 lib_assert(
false,
"Bad property fetch mode");
2021 for (
uint04 i = start; i < size + start; i++)
2052 template<u
int01 t_dims,
class t_type>
2056 if(primitive_count == 0)
2067 template<u
int01 t_dims,
class t_type>
2071 lib_assert(primitive_count == 0 || start + size <= primitive_count,
"Out of bounds polyline selection");
2083 if (primitive_count == 0)
2087 for (
uint04 i = start; i < size + start; i++)
2094 index_column.
get<
uint04>(index_offset + 3 * i + 0)
2095 , index_column.
get<
uint04>(index_offset + 3 * i + 1)
2096 , index_column.
get<
uint04>(index_offset + 3 * i + 2) };
2100 index_column.
get<
uint04>(i + index_offset + 0)
2101 , index_column.
get<
uint04>(i + index_offset + 1)
2102 , index_column.
get<
uint04>(i + index_offset + 2) };
2111 index_column.
get<
uint04>(index_fan_location)
2112 , index_column.
get<
uint04>(i + index_offset - 1)
2113 , index_column.
get<
uint04>(i + index_offset) };
2116 lib_assert(
false,
"Bad property fetch mode");
2132 for (
uint04 i = start; i < size + start; i++)
2134 uint04 index = primitive_count > 0 ? index_column.
get<
uint04>(index_offset + i) : i + index_offset;
2160 if (primitive_count == 0)
2162 for (
uint04 i = start; i < size + start; i++)
2165 if (primitive_count == 0)
2173 index_column.
get<
uint04>(index_offset + 2 * i + 0)
2174 , index_column.
get<
uint04>(index_offset + 2 * i + 1));
2243 return m_base->vertex_table.get(property);
2251 return m_base->vertex_table.get(property);
2295 template<
class t_index_type,
class t_vec_type>
2303 lib_assert(index_value[A] < vertex_count,
"Bad vertex A");
2304 lib_assert(index_value[B] < vertex_count,
"Bad vertex B");
2305 lib_assert(index_value[C] < vertex_count,
"Bad vertex C");
2311 index_value = Constant<t_vec_type>::Invalid;
2414 lib_assert(vert_mode !=
e_index,
"Not yet supported");
2423 void reserveVertexSpace(
uint04 count,
uint04 current_reserve_count);
2472 ,
m_column(&geo.column(vertex_property))
2485 ,
m_column(&geo.propertyColumn(vertex_property))
2496 template<
class t_type>
2526 template<
class t_type>
2541 m_geo.ensureFlagColumnExists();
2564 template<
class t_type>
2597 template<u
int01 t_dims,
class t_type>
2634 lib_assert(
false,
"Unknown point type");
2664 for (
uint01 i = 0; i < 2; i++)
2667 index_vert[i] = Constant<uint04>::Invalid;
2676 template<
class t_line_type>
2735 template<u
int01 t_dims,
class t_type>
2776 template<
class t_tri_type>
2781 for (
uint01 i = 0; i < 3; i++)
2784 tri[i] = Constant<t_tri_type>::Invalid;
2805 for (
uint01 i = 0; i < 3; i++)
2821 for (
uint01 i = 0; i < 3; i++)
2924 struct hash<Geometry>
2929 std::size_t operator()(
const Geometry& d)
const noexcept
2932 std::size_t value = 0;
2933 for (
uint01 i = 0; i < 8; i++)
2934 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
2939#include <NDEVR/Model.h>
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
A specification of upper and lower bounds in N-dimensions.
The equivelent of std::vector but with a bit more control.
void add(t_type &&object)
Adds object to the end of the buffer.
Base information class for all design objects in the NDEVR property database.
uint04 m_index
Row index of this object within the property database.
uint04 m_design_index
Index of the parent design that owns this object.
DesignObjectBase * m_base
Pointer to the owning DesignObjectBase property database.
Provides the underlying data storage for the NDEVR Scene Model hierarchy.
DesignObject()=default
Creates an "invalid" design object.
constexpr decltype(auto) get(t_property_type property) const
Retrieves a property value from the database, cast to the requested type.
uint04 index() const
Returns the primary row index of this object within the DesignObjectBase property table.
bool isValid() const
Checks whether this design object has a valid index into the database.
DesignObjectBase & base() const
Returns a reference to the underlying DesignObjectBase database.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
GeometryPositionModRestore()
Default constructor.
void restoreNormals(const void *lock, LogPtr ptr=LogPtr())
Restores previously stored normal data.
bool restore_smooth
Whether to restore smoothing data.
String m_smoothing_algo
The stored smoothing algorithm name.
void restoreAll(const void *lock, LogPtr ptr=LogPtr())
Restores all previously stored calculated data (normals, closed, smooth).
void restoreClosed(const void *lock, LogPtr ptr=LogPtr())
Restores previously stored closed-solid state.
NormalMode normal_mode
The stored normal mode.
bool restore_normals
Whether to restore normal data.
bool m_has_tangent
Whether the geometry had tangent data.
bool m_has_bitangent
Whether the geometry had bitangent data.
GeometryPositionModRestore(const Geometry &geo)
Constructs and immediately stores the geometry state for later restoration.
uint04 m_smoothing_times
The stored number of smoothing iterations.
void restoreClosed(Geometry &geo, const void *lock, LogPtr ptr=LogPtr())
Internal: restores closed-solid state for a specific geometry.
bool restore_closed
Whether to restore the closed-solid state.
void store(const Geometry &geo)
Captures the current calculated state of the geometry.
Geometry m_geo
The geometry being restored.
bool m_is_closed
Whether the geometry was a closed solid.
void restoreNormals(Geometry &geo, const void *lock, LogPtr ptr=LogPtr())
Internal: restores normals for a specific geometry.
fltp04 smoothing_angle
The stored normal smoothing angle.
void restoreSmooth(const void *lock, LogPtr ptr=LogPtr())
Restores previously stored smoothing data.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
StringView getGeometryIcon() const
Retrieves the icon identifier string for this geometry type.
void updateVertexColumn(VertexProperty property)
Notifies the system that a standard vertex column has been modified.
Buffer< Polyline< t_dims, t_type > > polylines(PrimitiveProperty primitive_property, VertexProperty vertex_property) const
Retrieves all polylines from the geometry.
void updateGeometryTransform(const Matrix< fltp08 > &transform, const void *lock_ptr=nullptr)
Updates geometry after a transform change, recalculating derived data.
ThicknessMode thicknessMode() const
Retrieves the current thickness mode.
Buffer< Polygon< t_type, Vertex< t_dims, t_type > > > polygons(PrimitiveProperty primitive_property, VertexProperty vertex_property, uint04 start, uint04 size) const
Retrieves a range of polygons from the geometry.
Buffer< Polyline< t_dims, t_type > > polylines(PrimitiveProperty primitive_property, VertexProperty vertex_property, uint04 start, uint04 size) const
Retrieves a range of polylines from the geometry.
Ray< 3, fltp08 > surfaceNormal() const
Calculates and returns the surface normal ray for this geometry.
bool validate() const
Validates the internal consistency of the geometry data.
void updateVertexColumns(bool invalidate_bounds=true, bool erase_kd_tree=true)
Notifies the system that all vertex columns have been modified.
static constexpr uint04 indicesPerPrimitive(PrimitiveMode property)
Returns the number of vertex indices per primitive for a given mode.
void setVertexFlag(uint04 vertex, VertexFlags flag, bool value)
Sets a flag on a single vertex.
void removeTree(PrimitiveProperty property, VertexProperty vertex_property=VertexProperty::Position)
Removes the spatial tree for a specific primitive property.
uint04 indexOffset(PrimitiveProperty property) const
Returns the index offset for a specific primitive property.
ColumnT< uint01 > & primitiveFlagColumn()
Returns a mutable reference to the primitive flag column.
void laplacianSmoothing(const SmoothingParameters &properties)
Applies Laplacian smoothing to the mesh.
void setSolidVertexCountValue(uint04 count)
Sets the solid vertex count value in the database.
void setVertex(VertexProperty property, uint04 index, uint04 sub_index, const t_type &vector)
Sets a sub-component of a standard vertex property at the given index.
Model getParent(uint04 index) const
Retrieves a specific parent Model by index.
VertexMode
Describes the storage format and coordinate system of vertex data.
@ e_bitflag
Bitflag vertex data.
@ e_cartesian_3D
3D Cartesian coordinates, double-precision float.
@ e_color_hsb
HSB color data.
@ e_cartesian_3F
3D Cartesian coordinates, single-precision float.
@ e_cartesian_3S
3D Cartesian coordinates, short integer.
@ e_normal_ray_3F
3D normal ray, single-precision float.
@ e_index
Vertices stored as indices into another buffer.
@ e_color_xyz
CIE XYZ color data.
@ e_normal_ray_3D
3D normal ray, double-precision float.
@ e_cartesian_1D
1D Cartesian coordinates, double-precision float.
@ e_color_rgb
RGB color data.
@ e_cartesian_grid_1D
1D Cartesian grid, double-precision float.
@ e_cartesian_3I
3D Cartesian coordinates, integer.
@ e_cartesian_grid_3D
3D Cartesian grid, double-precision float.
@ e_color_aci
AutoCAD Color Index color data.
@ e_cartesian_grid_image
Cartesian grid for image data.
@ e_cartesian_grid_3F
3D Cartesian grid, single-precision float.
@ e_cartesian_2S
2D Cartesian coordinates, short integer.
@ e_cartesian_grid_1F
1D Cartesian grid, single-precision float.
@ e_color_lab
CIELAB color data.
@ e_color_hsl
HSL color data.
@ e_no_vertex
No vertex data present.
@ e_polar_grid_1F
1D polar grid, single-precision float.
@ e_cartesian_1F
1D Cartesian coordinates, single-precision float.
@ e_cartesian_2F
2D Cartesian coordinates, single-precision float.
@ e_cartesian_2D
2D Cartesian coordinates, double-precision float.
@ e_cartesian_2I
2D Cartesian coordinates, integer.
Buffer< Polygon< t_type, Vertex< t_dims, t_type > > > polygons(PrimitiveProperty primitive_property, VertexProperty vertex_property) const
Retrieves all polygons from the geometry.
void setVertices(VertexProperty property, const Buffer< t_type > &vertices, const Matrix< t_matrix_type > &matrix, uint04 offset=0)
Sets vertices with a transformation matrix applied to each value.
bool hasTree(PrimitiveProperty primitive_property, VertexProperty vertex_property=VertexProperty::Position) const
Checks whether a spatial tree exists for the given primitive and vertex property.
void copyFrom(const Geometry &geo, bool copy_tree=true, bool copy_vertices=true)
Copies all data from another geometry into this one.
bool hasIndexFanColumn() const
Checks whether the primitive fan index column has any entries.
TypeInfo vertexPropertyType(uint04 property_index) const
Returns the type information for a vertex property column.
const Buffer< uint04 > & getTreeIndices(PrimitiveProperty primitive_property) const
Retrieves the index mapping used by the spatial tree.
void removeVertices(Buffer< uint04 > vertices)
Removes vertices at the specified indices.
void updateVertexColumn(VertexProperty property, uint04 index, uint04 size, bool invalidate_bounds=true, bool erase_kd_tree=true)
Notifies the system that a range within a standard vertex column was modified.
void setSolidVertexReservedValue(uint04 count)
Sets the solid vertex reserved count value in the database.
void invalidateBounds()
Invalidates cached bounding box, forcing recalculation on next access.
void updateSolidVertexColumns(bool invalidate_bounds=true, bool erase_kd_tree=true)
Notifies the system that all solid vertex columns have been modified.
uint04 parentCount() const
Returns the number of parent Models referencing this geometry.
t_type primitive(PrimitiveProperty property, typename std::enable_if< ObjectInfo< t_type >::Dimensions<=1, uint04 >::type index) const
Retrieves a scalar (1D) primitive index value, adjusted for vertex offset.
bool canBeClosedSolid(const void *lock=nullptr) const
Checks whether this geometry can form a closed solid (watertight mesh).
Buffer< t_type > vertices(const StringView &property) const
Retrieves all vertex values for a named custom property.
GeometryBuffer explode() const
Explodes this geometry into individual primitive geometries.
ModelBuffer getParents() const
Retrieves all parent Models of this geometry.
void setNormalMode(NormalMode mode, Angle< fltp08 > max_sep_angle, const void *lock=nullptr, LogPtr log=LogPtr())
Sets the normal calculation mode and recalculates normals.
uint01 provokingPrimitiveOffset() const
Returns the provoking primitive offset for flat shading.
bool hasVertexProperty(const StringView &property_name) const
Checks whether a named vertex property exists.
uint04 createVertexProperty(const StringView &property_name, const TypeInfo &type)
Creates a new custom vertex property column with a runtime type.
void setVertexReservedValue(uint04 count)
Sets the vertex reserved count in the database.
uint04 solidVertexReservedCount() const
Returns the reserved capacity for solid vertices.
TableColumn & faceToEdgeColumn()
Returns a mutable reference to the face-to-edge mapping column.
void removeVertices(uint04 location, uint04 size)
Removes a contiguous range of vertices.
void setVerticesFlag(const Buffer< bool > &selection_mask, VertexFlags flag, bool value)
Sets a flag on vertices indicated by a boolean mask.
void setPrimitive(PrimitiveProperty property, uint04 index, Vector< 3, t_type > index_value)
Sets a triangle primitive (3-vertex index vector).
bool hasColumn(VertexProperty property) const
Checks whether the underlying column exists for a standard vertex property.
Buffer< t_type > getTreeSortedVertices(PrimitiveProperty primitive_property, VertexProperty vertex_property) const
Retrieves vertices sorted according to the spatial tree index order.
Plane< 3, fltp08 > calculatePlaneAtVertex(uint04 vertex_index) const
Calculates the best-fit plane at a given vertex position.
Buffer< Buffer< uint04 > > polyIndices(PrimitiveProperty primitive_property) const
Retrieves all polygon index buffers for a primitive property.
const TableColumn & column(VertexProperty property) const
Returns a const reference to the column for a standard vertex property.
Geometry(DesignObjectBase *base)
Constructs a new Geometry and allocates it in the given design database.
Buffer< Triangle< t_dims, t_type > > triangles(PrimitiveProperty primitive_property, VertexProperty vertex_property, uint04 start, uint04 size) const
Retrieves a range of triangles from the geometry.
uint04 solidVertexCount() const
Returns the number of solid vertices.
bool operator!=(const Geometry &geo) const
Checks inequality with another Geometry.
void splitDuplicateVertices()
Splits shared vertices so each primitive has its own unique vertex data.
void closePolyline(PrimitiveProperty property)
Closes an open polyline by connecting the last vertex to the first.
void setModeValue(PrimitiveProperty property, PrimitiveMode mode)
Sets the primitive mode for a property in the database.
fltp08 calculateSurfaceArea(const Matrix< fltp08 > &parent_transform) const
Calculates the surface area of the geometry in the given coordinate space.
uint04 indexFanCount() const
Returns the number of fan indices for this geometry.
Bounds< 3, fltp08 > getBounds() const
Retrieves the 3D bounding box of this geometry.
void setVerticesFlags(const Buffer< bool > &selection_mask, BitFlag on_flags, BitFlag off_flags)
Sets multiple flags on vertices using a boolean mask with on/off flag pairs.
void setGeometryTransform(const Matrix< fltp08 > &transform)
Applies a transformation matrix to all geometry vertices.
void createDrapedMaterialCoordinates(const Matrix< fltp08 > &mat=Matrix< fltp08 >())
Creates material (texture) coordinates by draping them onto the geometry surface.
uint04 vertexOffset() const
Returns the offset of this geometry's vertices within the shared vertex table.
void updateModifiedTime(Time time=Time::SystemTime())
Updates the modified timestamp for this geometry.
void updatePrimitiveColumns(bool remove_tree=true)
Notifies the system that all primitive columns have been modified.
uint04 vertexReservedCount() const
Returns the total reserved (allocated) vertex capacity.
bool canExplode() const
Checks whether this geometry can be exploded into individual primitives.
void setupVertexTable(uint04 vertex_size, VertexMode position, VertexMode normal=VertexMode::e_no_vertex, VertexMode color=VertexMode::e_no_vertex, VertexMode texture=VertexMode::e_no_vertex, VertexMode tangent=VertexMode::e_no_vertex, VertexMode bitangent=VertexMode::e_no_vertex, VertexMode bones=VertexMode::e_no_vertex)
Configures the vertex table with the specified modes for standard properties.
ColumnT< uint04 > & primitiveFanColumn()
Returns a mutable reference to the primitive fan column.
void cotangentLaplacianSmoothing(const SmoothingParameters &properties)
Applies cotangent-weighted Laplacian smoothing to the mesh.
Buffer< uint04 > primitiveIndices(PrimitiveProperty primitive_property) const
Retrieves all raw primitive indices for a given property.
Geometry(const DesignObject &obj)
Constructs a Geometry from a generic DesignObject.
void fillHolesByNeighbor(PrimitiveProperty property, const void *lock=nullptr, LogPtr log=LogPtr())
Fills holes in the mesh by interpolating from neighboring primitives.
const String & vertexPropertyName(uint04 property_index) const
Returns the name of a vertex property by its column index.
void removeTrees(VertexProperty vertex_property=VertexProperty::Position)
Removes all spatial trees for the given vertex property.
uint04 addVertex()
Adds a single vertex to the geometry.
void setVerticesFlagAll(uint01 on_flags, uint01 off_flags)
Sets on/off flag masks for all vertices.
TableColumn & edgeToFaceColumn()
Returns a mutable reference to the edge-to-face mapping column.
void updateGeometryTime(Time time=Time::SystemTime())
Updates the geometry-specific timestamp.
static void SetTriangulationMethod(std::function< void(Geometry &geo, const Matrix< fltp08 > &matrix, const void *lock, LogPtr log)> function)
Sets the global triangulation method used by autoCalculateIndices.
Buffer< t_type > vertices(const StringView &property, uint04 start, uint04 size) const
Retrieves a range of vertex values for a named custom property.
Buffer< Vector< 3, uint04 > > triIndices(PrimitiveProperty primitive_property, uint04 start, uint04 size) const
Retrieves a range of triangle index triples.
Buffer< Vector< 3, uint04 > > triIndices(PrimitiveProperty primitive_property) const
Retrieves all triangle index triples for a primitive property.
const ColumnT< uint04 > & primitiveColumn() const
Returns a const reference to the primitive index column.
void setVertexCountValue(uint04 count)
Sets the vertex count in the database.
Buffer< Buffer< uint04 > > polyIndices(PrimitiveProperty primitive_property, uint04 start, uint04 size) const
Retrieves a range of polygon index buffers.
void removePrimitive(PrimitiveProperty property, uint04 location)
Removes a single primitive at the given location.
Vector< 3, fltp08 > calculateAverageDirection(const Matrix< fltp08 > &mat) const
Calculates the average direction vector of linework geometry.
void combine(Geometry &geo, const Matrix< fltp08 > &conversion=Matrix< fltp08 >(1.0))
Combines another geometry into this one.
const ColumnT< uint01 > & primitiveFlagColumn() const
Returns a const reference to the primitive flag column.
uint04 solidVertexOffset() const
Returns the offset of solid (thickness-expanded) vertices in the vertex table.
ThicknessMode
Describes how line/edge thickness is applied to geometry rendering.
@ e_none
No thickness applied.
@ e_pixel
Thickness in screen pixels.
@ e_flat_single
Flat thickness, single value for all vertices.
@ e_circle_per_vertex
Circular cross-section thickness, per-vertex value.
@ e_flat_per_vertex
Flat thickness, per-vertex value.
@ e_circle
Circular cross-section thickness, single value.
VertexMode mode(VertexProperty property) const
Retrieves the vertex storage mode for a standard vertex property.
TableColumn & column(VertexProperty property)
Returns a mutable reference to the column for a standard vertex property.
void autoCalculateIndices(PrimitiveProperty property, const void *lock=nullptr, const Matrix< fltp08 > &transform=Matrix< fltp08 >(1.0), LogPtr log=LogPtr())
Automatically calculates primitive indices (e.g.
void setVertexOffsetValue(uint04 count)
Sets the vertex offset in the database.
void updateVertexColumn(const StringView &property, uint04 index, uint04 size)
Notifies the system that a range within a named custom vertex column was modified.
void setPrimitiveMode(PrimitiveProperty property, PrimitiveMode mode)
Sets the primitive mode for a given property.
void setIndexCountValue(uint04 count)
Sets the total index count in the database.
TreeMode
Describes the type of spatial index tree used for acceleration.
@ e_quad_tree
Quad-tree spatial index.
@ e_r_tree
R-tree spatial index.
@ e_no_tree
No spatial tree.
@ e_kd_tree
KD-tree spatial index.
void removeVertex(uint04 location)
Removes a single vertex at the given location.
static t_vec_type OptimizedGetPrimitiveVec(const OptimizedPrimitiveDef &ref, uint04 index)
Retrieves a vector primitive using pre-computed offsets for maximum performance.
Buffer< LineSegment< 3, fltp08 > > faceEdges(uint04 index) const
Retrieves all edges of a face at the given index.
void setVerticesFlagAll(VertexFlags flag, bool value)
Sets a flag value for all vertices in this geometry.
void calculateNormals(NormalMode mode, Angle< fltp08 > max_difference, const void *lock=nullptr, LogPtr log=LogPtr())
Calculates vertex normals using the specified mode.
Buffer< t_type > vertices(VertexProperty property) const
Retrieves all vertex values for a standard property.
void split(Geometry &other_geo, const Buffer< bool > &vertex_mask)
Splits this geometry into two based on a vertex mask.
t_type primitive(PrimitiveProperty property, typename std::enable_if< ObjectInfo< t_type >::Dimensions==2, uint04 >::type index) const
Retrieves a line (2D) primitive index pair, adjusted for vertex offset.
void updateVertexColumn(const uint04 &property)
Notifies the system that a custom vertex column was modified by index.
void optimizeVertexLocations()
Reorders vertices to optimize spatial locality for rendering.
void ensureFlagColumnExists()
Ensures a bitflag column exists in the vertex table, creating one if necessary.
void setPrimitive(PrimitiveProperty property, uint04 index, t_type index_value)
Sets a single primitive index value.
void centerAlign()
Translates all vertices so that the geometry center aligns with the origin.
void setTree(DynamicPointer< RTree< 3, fltp04 > > tree, PrimitiveProperty primitive_property, VertexProperty vertex_property=VertexProperty::Position) const
Sets (replaces) the spatial R-tree for the given properties.
bool primitiveIndexFlag(PrimitiveProperty property, uint04 primitive_index, PrimitiveBitFlags flag) const
Retrieves a flag value from a specific primitive index.
static std::function< void(Geometry &geo, const Matrix< fltp08 > &matrix, const void *lock, LogPtr log)> s_geometry_triangulation
The global triangulation callback.
Vector< 2, fltp08 > calculateVolumeAndSurfaceArea(const Matrix< fltp08 > &transform, const void *lock) const
Calculates both volume and surface area simultaneously.
void copyTraitsFrom(const Geometry &geo)
Copies traits (properties) from another geometry without copying vertices or primitives.
uint04 primitiveCount(PrimitiveProperty property) const
Returns the number of primitives for a specific property.
t_type vertexProperty(const StringView &property, uint04 vertex_index, uint04 sub_index) const
Retrieves a sub-component of a custom vertex property by name.
void removeVertices(uint04 mask_offset, const Buffer< bool > &selection_mask)
Removes vertices indicated by a boolean mask with an offset.
void setWindingMode(WindingMode mode)
Sets the winding mode for face orientation.
void removeParent(Model &parent)
Removes a parent Model from this geometry.
const TableVectorType< 1, uint01 > * vertexFlagColumn() const
Returns a const pointer to the vertex flag column, or nullptr if none exists.
void setPrimitive(PrimitiveProperty property, uint04 index, Triangle< 1, t_type > index_value)
Sets a triangle primitive from a Triangle index type.
void setVerticesFlag(const Buffer< uint04 > &vertices, VertexFlags flag, bool value)
Sets a flag on a list of vertices by index.
bool hasIndexColumn() const
Checks whether the primitive index column has any entries.
void calculateIndexNeighborList(PrimitiveProperty primitive_property)
Builds a neighbor list for primitive indices to accelerate adjacency queries.
uint04 addVertices(uint04 size)
Adds multiple vertices to the geometry.
Buffer< uint04 > getSelectedVertices() const
Retrieves indices of all currently selected vertices.
void setIndexFanOffsetValue(uint04 offset)
Sets the fan index offset in the database.
void clearVerticesAndPrimitives()
Removes all vertex and primitive data from this geometry.
decltype(auto) vertex(VertexProperty property, uint04 index) const
Retrieves a single vertex value for a standard property.
void setVertices(VertexProperty property, const Buffer< t_type > &vertices, uint04 offset=0)
Sets a standard vertex property for multiple vertices from a buffer.
fltp08 calculateVolume(const Matrix< fltp08 > &parent_transform) const
Calculates the volume of the geometry in the given coordinate space.
void setIndexOffsetValue(uint04 offset)
Sets the base index offset in the database.
void removePrimitive(PrimitiveProperty property, const Buffer< bool > &selection_mask)
Removes primitives indicated by a boolean mask.
uint04 createVertexProperty(const StringView &property_name)
Creates a new custom vertex property column with a compile-time type.
const TableColumn & edgeToFaceColumn() const
Returns a const reference to the edge-to-face mapping column.
ColumnT< uint04 > & primitiveColumn()
Returns a mutable reference to the primitive index column.
Buffer< Vector< 2, uint04 > > lineIndices(PrimitiveProperty primitive_property) const
Retrieves all line index pairs for a primitive property.
Buffer< t_type > propertyVertices(uint04 property, uint04 start, uint04 size) const
Retrieves a range of custom vertex property values.
bool hasParent(const Model &model) const
Checks whether a given Model is a parent of this geometry.
void convertPolarToCartesian(const StringView &roll_column, const StringView &pitch_column, const StringView &distance_column)
Converts polar coordinate vertex properties to Cartesian coordinates.
void setVertexProperty(uint04 property, uint04 index, uint04 sub_index, const t_type &vector)
Sets a sub-component of a custom vertex property by column index.
void sortVertices(Buffer< uint04 > new_order)
Reorders vertices according to the given index mapping.
void setSolidVertexOffsetValue(uint04 count)
Sets the solid vertex offset value in the database.
void setThicknessMode(ThicknessMode mode)
Sets how thickness is interpreted during rendering.
uint04 vertexPropertyCount() const
Returns the number of vertex property columns.
Buffer< t_type > vertices(VertexProperty property, uint04 start, uint04 size) const
Retrieves a range of vertex values for a standard property.
void addVertices(uint04 location, uint04 size)
Inserts vertices at a specific location.
uint01 parity(const Matrix< fltp08 > &parent_matrix, PrimitiveMode mode) const
Calculates the parity (orientation) of the geometry relative to a transformation.
Buffer< Triangle< t_dims, t_type > > triangles(PrimitiveProperty primitive_property, VertexProperty vertex_property) const
Retrieves all triangles from the geometry.
void setVerticesFlags(const Buffer< bool > &selection_mask, BitFlag selected_on_flags, BitFlag selected_off_flags, BitFlag unselected_on_flags, BitFlag unselected_off_flags, uint04 bitmask_offset=0)
Sets different flag combinations for selected and unselected vertices.
void updateVertexColumn(const uint04 &property, uint04 index, uint04 size)
Notifies the system that a range within a custom vertex column was modified by index.
void setupIndexFanColumn()
Ensures the index fan column is initialized and allocated.
PrimitiveMode mode(PrimitiveProperty property) const
Retrieves the primitive mode for a given primitive property.
void setPrimitive(PrimitiveProperty property, uint04 index, Vector< 2, t_type > index_value)
Sets a line primitive (2-vertex index pair).
void updateVertexColumns(uint04 index, uint04 size, bool invalidate_bounds=true, bool erase_kd_tree=true)
Notifies the system that a range across all vertex columns was modified.
void removeVertices(const Buffer< bool > &selection_mask)
Removes vertices indicated by a boolean mask.
void reservePrimitiveIndexSpace(uint04 index_size)
Pre-allocates space in the primitive index column.
bool hasProperty(PrimitiveProperty property) const
Checks whether a given primitive property has index data.
uint04 indexOffset() const
Returns the base index offset for this geometry within the shared index column.
bool operator==(const Geometry &geo) const
Checks equality with another Geometry by comparing base and index.
Buffer< LineSegment< t_dims, t_type > > lineSegments(PrimitiveProperty primitive_property, VertexProperty vertex_property) const
Retrieves all line segments from the geometry.
t_type primitive(PrimitiveProperty property, typename std::enable_if< ObjectInfo< t_type >::Dimensions==3, uint04 >::type index) const
Retrieves a triangle (3D) primitive index triple, adjusted for vertex offset.
uint04 vertexCount() const
Returns the number of vertices in this geometry.
void setModeValue(VertexProperty property, VertexMode vert_mode)
Sets the vertex mode for a standard property in the database.
DynamicPointer< RTree< 3, fltp04 > > tree(PrimitiveProperty primitive_property, VertexProperty vertex_property=VertexProperty::Position) const
Retrieves the spatial R-tree for the given properties.
void setVertexProperties(const StringView &property, const Buffer< t_type > &vertices, uint04 offset=0)
Sets a named vertex property for multiple vertices from a buffer.
void setBounds(const Bounds< 3, fltp08 > &bounds)
Manually sets the bounding box for this geometry.
void setCountValue(PrimitiveProperty property, uint04 count)
Sets the primitive count for a specific property in the database.
void addFromParent(Model &parent)
Registers a parent Model for this geometry.
void updateVertexColumn(const StringView &property)
Notifies the system that a named custom vertex column was modified.
void setVertexProperty(const StringView &property, uint04 index, const t_type &property_value)
Sets a custom vertex property value by name.
void setVertexProperty(const StringView &property, uint04 index, uint04 sub_index, const t_type &vector)
Sets a sub-component of a custom vertex property by name.
bool vertexSelected(uint04 vertex) const
Checks whether a vertex is selected.
uint04 indexFanOffset() const
Returns the offset into the fan index column for this geometry.
void normalExpansion(const Vector< 3, fltp04 > &expansion_vector)
Expands vertex positions along their normals by a given vector.
void setVertices(VertexProperty property, const t_type *vertices, uint04 size, uint04 offset=0)
Sets vertices from a raw pointer array.
uint04 primitiveIndexCount() const
Returns the total number of primitive indices across all properties.
uint04 addVertexWithExtraReservedSpace()
Adds a single vertex with extra reserved space for future growth.
void removePrimitive(PrimitiveProperty property, Buffer< uint04 > vertices)
Removes primitives at the specified indices.
TableVectorType< 1, uint01 > * vertexFlagColumn()
Returns a mutable pointer to the vertex flag column, or nullptr if none exists.
BitFlag vertexFlag(uint04 vertex_index) const
Retrieves all flags for a vertex as a BitFlag.
void setIndexFanCountValue(uint04 count)
Sets the fan index count in the database.
bool hasVertexProperty(const VertexProperty &property) const
Checks whether a standard vertex property exists.
LineSegment< t_dims, t_type > lineSegment(PrimitiveProperty primitive_property, VertexProperty vertex_property, uint04 line_index) const
Retrieves a line segment from the geometry using primitive and vertex properties.
void setVertexMode(VertexProperty property, VertexMode mode)
Sets the vertex storage mode for a standard property.
Matrix< fltp08 > getCompleteTransform(const Model &parent) const
Computes the complete transformation matrix from geometry space to world space via a parent Model.
const ColumnT< uint04 > & primitiveFanColumn() const
Returns a const reference to the primitive fan column.
void removeDuplicateVertices(fltp08 epsilon, const void *lock, LogPtr log=LogPtr())
Removes vertices that are within epsilon distance of each other.
bool hasHoles(PrimitiveProperty property) const
Checks whether the mesh has holes for the given primitive property.
Vertex< 3, fltp08 > faceCenter(uint04 index) const
Calculates the center point of a face at the given index.
void outline()
Converts the geometry to its outline representation.
void setGeometryType(GeometryType geometry_type)
Sets the geometry type identifier.
t_type vertexProperty(const StringView &property, uint04 vertex_index) const
Retrieves a custom vertex property value by name.
uint01 parity(const Matrix< fltp04 > &parent_matrix, PrimitiveMode mode) const
Calculates the parity (orientation) of the geometry relative to a transformation.
void removeHoleFill(const void *lock=nullptr, LogPtr log=LogPtr())
Removes any previously applied hole fill data.
uint04 primitiveIndexCount(PrimitiveProperty property) const
Returns the total number of index entries for a specific property.
void setVertex(VertexProperty property, uint04 index, const t_type &vector)
Sets a standard vertex property value at the given index.
TableColumn & propertyColumn(uint04 property)
Returns a mutable reference to a custom vertex property column by index.
void setPrimitiveRange(PrimitiveProperty mode, uint04 start, uint04 primitive_count)
Sets the start offset and count for a primitive property range.
void clearSmoothing(const SmoothingParameters &properties)
Removes smoothing and restores original vertex positions.
uint04 addPrimitive(PrimitiveProperty index_property, const t_type &primitive)
Adds a single primitive and sets its index data.
const TableColumn & propertyColumn(const StringView &property) const
Returns a const reference to a named custom property column.
void calculateTangentSpace(bool calc_tan, bool calc_bitan)
Calculates tangent and/or bitangent vectors for texture mapping.
t_type vertexProperty(uint04 property_index, uint04 vertex_index) const
Retrieves a custom vertex property value by column index.
void removePrimitive(PrimitiveProperty property, uint04 location, uint04 size)
Removes a contiguous range of primitives.
void setPrimitiveVec(PrimitiveProperty property, uint04 index, t_vec_type &index_value)
Internal method to set a vector primitive with offset adjustment and fan handling.
uint04 addPrimitives(PrimitiveProperty index_property, uint04 insersion_size)
Adds multiple uninitialized primitives to the geometry.
void deleteGeometry()
Deletes this geometry and removes it from the design database.
static void OptimizedSetPrimitiveVec(const OptimizedPrimitiveDef &ref, uint04 index, t_vec_type index_value)
Sets a vector primitive (triangle/line) using pre-computed offsets for maximum performance.
Vector< 2, fltp08 > calculateHVLength(const Matrix< fltp08 > &mat) const
Calculates the horizontal and vertical length components of linework.
uint04 vertexPropertyIndex(const StringView &property_name) const
Finds the column index of a named vertex property.
void setVertexCount(uint04 size, bool deallocate_if_possible=true)
Sets the total vertex count, resizing vertex data columns.
Time getAscModifiedTime(bool include_self, bool include_layer=false) const
Gets the most recent ascending modified time across hierarchy.
t_type vertexProperty(uint04 property_index, uint04 vertex_index, uint04 sub_index) const
Retrieves a sub-component of a custom vertex property by column index.
void setRealThickness(fltp08 real_thickness, const Matrix< fltp08 > &transform, const void *lock, LogPtr log=LogPtr())
Sets a real-world thickness value and generates thickness geometry.
fltp08 calculateLength(const Matrix< fltp08 > &transform) const
Calculates the total length of linework geometry.
const TableColumn & propertyColumn(uint04 property) const
Returns a const reference to a custom vertex property column by index.
static void OptimizedSetPrimitive(const OptimizedPrimitiveDef &ref, uint04 index, t_vec_type index_value)
Sets a single primitive index using pre-computed offsets for maximum performance.
void setOffsetValue(PrimitiveProperty property, uint04 offset)
Sets the primitive property offset in the database.
bool hasProperty(VertexProperty property) const
Checks whether a standard vertex property has data.
void setVertexProperty(uint04 property, uint04 index, const t_type &vector)
Sets a custom vertex property value by column index.
GeometryType getGeometryType() const
Retrieves the geometry type identifier.
Buffer< t_type > propertyVertices(uint04 property) const
Retrieves all values of a custom vertex property as a buffer.
Buffer< Vector< 2, uint04 > > lineIndices(PrimitiveProperty primitive_property, uint04 start, uint04 size) const
Retrieves a range of line index pairs.
void updatePrimitiveColumn(PrimitiveProperty property, bool remove_tree=true)
Notifies the system that a primitive column has been modified.
void flipNormals()
Reverses the direction of all vertex normals.
Buffer< uint04 > indices(PrimitiveProperty primitive_property, uint04 start, uint04 size) const
Retrieves a range of raw primitive indices.
OptimizedPrimitiveDef optimizedPrimitiveDef(PrimitiveProperty property)
Creates a pre-computed primitive definition for fast repeated access.
bool vertexFlag(uint04 vertex_index, VertexFlags flag) const
Retrieves whether a specific flag is set on a vertex.
Geometry(uint04 index, DesignObjectBase *base)
Constructs a Geometry referencing an existing entry in the design database.
Triangle< t_dims, t_type > triangle(PrimitiveProperty primitive_property, VertexProperty vertex_property, uint04 tri_index) const
Retrieves a triangle from the geometry using primitive and vertex properties.
const TableColumn & faceToEdgeColumn() const
Returns a const reference to the face-to-edge mapping column.
void setPrimitiveIndexFlag(PrimitiveProperty property, uint04 primitive_index, PrimitiveBitFlags flag, bool value)
Sets a flag on a specific primitive index.
TableColumn & propertyColumn(const StringView &property)
Returns a mutable reference to a named custom property column.
A light-weight base class for Log that allows processes to update, without the need for additional in...
A class to easily iterate each line segment over a Geometry of lines.
Geometry::OptimizedPrimitiveDef m_primitive_def
Pre-computed primitive definition for fast access.
Vector< 2, uint04 > vertexIndex(uint04 index) const
Returns the local vertex indices (offset-adjusted) for a line primitive.
uint04 m_vertex_offset
The vertex offset in the shared table.
LineSegment< t_dims, t_type > operator[](uint04 index) const
Array-style access to a line segment.
LineIterator(PrimitiveProperty primitive_property, VertexProperty vertex_property, Geometry geo)
Constructs a line iterator from a geometry's primitive and vertex properties.
LineIterator()
Default constructor creating an empty iterator.
TableColumn * m_vertex_column
Pointer to the vertex data column.
LineIterator(const LineIterator< t_dims, t_type > &iter)
Copy constructor.
uint04 size() const
Returns the number of line primitives available.
bool isHidden(uint04 index) const
Checks whether a vertex is hidden via its flag.
LineSegment< t_dims, t_line_type > get(uint04 index) const
Retrieves the line segment at the given index.
TableColumn * m_flag_column
Pointer to the vertex flag column (may be nullptr).
VertexProperty m_vertex_property
The vertex property being accessed.
Vector< 2, uint04 > rawIndex(uint04 index) const
Returns raw (non-offset-adjusted) vertex indices for a line primitive.
uint04 m_primitive_count
The number of line primitives.
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Templated logic for doing matrix multiplication.
Logic for a given plane or N-dimensions.
uint04 vertexCount() const
void add(const t_vertex &vertex)
A sequence of connected line segments defined by ordered vertices along a path.
uint04 vertexCount() const
void add(const t_vertex &vertex)
static constexpr TableColumn * column(const DesignInfo *object, NDPG property)
Retrieves the TableColumn storing the given NDPG property.
static constexpr uint04 index(const DesignInfo *object, NDPG)
Retrieves the design index for geometry property access.
Provides access to the TableColumn and row index for a given property enum value.
Represents a color in the RGB space with optional alpha transparency.
The root Model that is responsible for storing the underlying data for all Scene Models.
Responsible for turning a user interaction into a selection within a DesignObjectLookup.
Logic for reading or writing to a string or a user friendly, TranslatedString.
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
A virtual storage type that is used with Table class to store data where the actual mechanism for sto...
void get(uint04 index, Vector< 1, t_class > &vector) const
Retrieves a 1D vector value at the given row index by delegating to the scalar get.
A TableColumnBuffer that also has some number of defined rows stored in a Vector object Allows for vi...
Represents a timestamp with utilities for manipulation and conversion.
static Time SystemTime()
Retrieves the current system time which is a combination of std::chrono::steady_clock to ensure smoot...
TableColumn * m_vertex_column
Pointer to the vertex data column.
TriangleIterator(PrimitiveProperty primitive_property, const StringView &vertex_property, Geometry mesh)
Constructs a triangle iterator using a named custom vertex property.
uint04 m_vertex_offset
The vertex offset in the shared table.
TriangleIterator(PrimitiveProperty primitive_property, VertexProperty vertex_property, Geometry mesh)
Constructs a triangle iterator from a geometry's primitive and vertex properties.
Geometry::OptimizedPrimitiveDef m_primitive_def
Pre-computed primitive definition for fast access.
Triangle< t_dims, t_tri_type > get(uint04 index) const
Retrieves the triangle at the given index.
uint04 size() const
Returns the number of triangle primitives available.
Vector< 3, BitFlag > flag(uint04 index) const
Retrieves the vertex flags for all three vertices of a triangle.
uint04 m_primitive_count
The number of triangle primitives.
Triangle< t_dims, t_type > operator[](uint04 index) const
Array-style access to a triangle.
Vector< 3, uint04 > vertexIndex(uint04 index) const
Returns the local vertex indices (offset-adjusted) for a triangle.
Vector< 3, uint04 > rawIndex(uint04 index) const
Returns raw (non-offset-adjusted) vertex indices for a triangle primitive.
TableColumn * m_flag_column
Pointer to the vertex flag column (may be nullptr).
TriangleIterator()
Default constructor creating an empty iterator.
A three-vertex polygon representing a triangle in N-dimensional space.
Stores information about a type, relevant for certain templated functions.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
VertexIterator(VertexProperty vertex_property, Geometry geo)
Constructs a typed iterator for a standard vertex property.
VertexIterator(const StringView &vertex_property, Geometry geo)
Constructs a typed iterator for a named custom vertex property.
t_type operator[](uint04 index) const
Array-style access to a vertex value.
uint04 m_vertex_offset
The offset of this geometry's vertices in the shared table.
VertexLookup(VertexProperty vertex_property, Geometry geo)
Constructs a lookup for a standard vertex property.
uint04 m_vertex_count
The number of vertices in this geometry.
TableColumn * m_column
Pointer to the vertex data column.
BitFlag flag(uint04 index) const
Retrieves the vertex flags at the given index.
t_type get(uint04 index) const
Retrieves a vertex value at the given index.
VertexLookup(const StringView &vertex_property, Geometry geo)
Constructs a lookup for a named custom vertex property.
Geometry m_geo
The geometry being iterated.
void swap(uint04 a, uint04 b)
Swaps two vertex entries in the column.
void setFlag(uint04 index, const BitFlag &value)
Sets the flag value for a vertex, creating the flag column if necessary.
VertexProperty m_vertex_property
The vertex property being accessed.
void setVertex(uint04 index, const t_type &value)
Sets a vertex value at the given index.
VertexLookup()
Default constructor creating an empty lookup.
uint04 size() const
Returns the number of vertices available for iteration.
TableColumn * m_flag_column
Pointer to the vertex flag column (may be nullptr).
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
NormalMode
Describes how surface normals are computed or stored for a Geometry object.
@ e_no_normals
No normals are provided.
@ type
The type identifier string for this model node.
VertexProperty
Per-vertex data channels that can be stored in the vertex table to be used by Geometry.
@ Position
XYZ position of the vertex.
@ BitFlag
Per-vertex bit flags (selected, hidden, etc.).
PrimitiveMode
Used with Geometry to describe how vertices and indices are used to form shapes.
@ e_no_index
No index buffer is used; vertices are not indexed.
@ e_triangle_strip
Indices define a triangle strip.
@ e_lines
Each pair of indices defines a line segment.
@ e_polyline
Indices define a connected polyline.
@ e_triangle
Each triplet of indices defines a triangle.
@ e_triangle_fan
Indices define a triangle fan around a central vertex.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
static constexpr bool IsValid(const Angle< t_type > &value)
Checks whether the given Angle holds a valid value.
constexpr std::enable_if<!ObjectInfo< t_type >::Buffer, TypeInfo >::type GetTypeInfo()
Constructs a TypeInfo for a non-buffer type at compile time using ObjectInfo traits.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
GeometryType
Describes the high-level geometric topology of a Geometry object.
double fltp08
Defines an alias representing an 8 byte floating-point number.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
static constexpr bool IsInvalid(const Angle< t_type > &value)
Checks whether the given Angle holds an invalid value.
@ guid
A 128-bit globally unique identifier for the object.
PrimitiveProperty
Describes which rendering property a primitive index buffer corresponds to.
PrimitiveAlignedBuffer< Model, 16 > ModelBuffer
Aligned buffer of Model objects with 16-byte alignment.
WindingMode
Describes the vertex winding order used to determine front-facing direction of polygons.
PrimitiveAlignedBuffer< Geometry, 16 > GeometryBuffer
Aligned buffer of Geometry objects with 16-byte alignment.
VertexFlags
Bit flags that can be set on individual vertices to control selection, visibility,...
@ e_is_hidden
Vertex is hidden from display.
PrimitiveBitFlags
Bit flags that can be set on individual primitives (triangles, lines, etc.) to control their selectio...
NDPG
Forward declaration for Geometry design object.
@ normal_mode
Normal calculation mode (smooth, no normal, or hard).
@ is_clipping_geo
Whether this geometry should be treated as a clipping region. Default: false.
@ has_closed_primitive
Whether primitives are closed, enabling volume calculations.
@ is_smooth
Whether vertices should be ignored and surfaces treated as smooth (circles, spheres,...
@ preserve_vertex_order
Whether vertex order must be preserved. If false, order may be automatically optimized....
@ is_surface
Whether the geometry represents a surface relative to some plane.
@ normal_smoothing_angle
The maximum angle threshold for normal smoothing between adjacent faces.
@ thickness
The thickness value applied to geometry rendering.
@ smooth_level
How smoothed the surface is, based on the argument passed to the smoothing algorithm.
@ thickness_mode
How thickness is interpreted (pixel, flat, circle, etc.).
@ plane_offset
The offset distance of the surface plane from the origin.
@ poly_holes
Whether surfacing should check for holes in polygons.
@ plane_normal
The normal ray of the surface plane.
@ is_closed_solid
Whether the geometry forms a closed solid (watertight mesh).
@ preserve_primitive_order
Whether primitive order must be preserved. If false, order may be automatically optimized....
@ no_auto_tree_creation
Whether automatic spatial tree creation is disabled.
@ geometry_type
The type identifier string for this geometry.
@ shape_type
A string identifier describing the shape type.
@ smooth_algorithm
The algorithm used for smoothing (e.g. Cotangent, Laplacian).
@ property_fields
Bitmask of which property fields are active.
@ winding
The winding order used for face orientation.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Describes special options/parameters for a GeometryFilter engine.
Pre-computed offsets and references for fast primitive index access without repeated lookups.
PrimitiveMode mode
The primitive mode for this definition.
ColumnT< uint04 > * fan_column
Pointer to the primitive fan column.
uint04 index_offset
The computed offset into the index column.
ColumnT< uint04 > * column
Pointer to the primitive index column.
OptimizedPrimitiveDef(ColumnT< uint04 > &column, ColumnT< uint04 > &fan_column)
Constructs with references to the index and fan columns.
uint04 fan_offset
The computed offset into the fan column.
Parameters controlling mesh smoothing operations.
fltp08 grow_rate
The grow factor per smoothing pass (negative to counteract shrinkage).
const void * lock
Optional thread lock pointer.
uint04 iterations
The number of smoothing iterations to perform.
LogPtr log
Optional log for progress reporting.
fltp08 shrink_rate
The shrink factor per smoothing pass.
PrimitiveProperty property
The primitive property to smooth over.
static const bool Color
Not a color type.
static const bool Pointer
Not a pointer type.
static const uint01 Dimensions
Geometry is not a dimensional type.
static const bool String
Not a string type.
static const bool Boolean
Not a boolean type.
static const bool Enum
Not an enum type.
static const bool Buffer
Not a buffer type.
static const bool Primitive
Is a primitive design type.
static const bool Integer
Not an integer type.
static const bool Vector
Not a vector type.
static const bool Unsigned
Not an unsigned numeric type.
static const bool Float
Not a floating-point type.
static const bool Number
Not a numeric type.
Information about the object.
Maps a compile-time property enum value to its corresponding C++ storage type.