About
A Voronoi pattern segments the space into separate cells defined by a list of points. The maxon::Voronoi3DInterface allows to segment 3D space into such Voronoi cells.
Voronoi3DInterface
The maxon::Voronoi3DInterface allows to collect points and to create 3D Voronoi cells around these points.
The points stored in the Voronoi object are handled with:
The calculation of Voronoi cells is divided into two steps:
The created cells are accessed with:
Further functions are:
CellData
A maxon::CellData object represents a single Voronoi cell:
A given cell can be handled with:
Two cells can be merged with:
Further functions are:
An edge within a cell is defined as a maxon::CellEdge :
Example
for (
maxon::Int i = 0; i != points.GetCount(); ++i)
{
}
const maxon::Voronoi3DRef voronoi = maxon::Voronoi3DRef::Create()
iferr_return ;
const
maxon ::
Bool voronoiNotReady = !voronoi.IsReady();
for (auto& cell : curCellData)
{
{
const auto & vertices = cellArg.GetVertices();
{
return false ;
}
return true ;
};
if (CheckCell(cell))
{
if (polygonObject != nullptr )
{
if (modeling == nullptr )
{
modeling->
SetPoint (polygonObject, i, vertices[i]);
}
{
const maxon::Int startEdgeIndex = currentEdgeIndex;
do
{
} while (startEdgeIndex != currentEdgeIndex);
if (ngonIndexCount > 0)
{
}
}
{
color.
x = (randomGen.Get01() * 0.5) + 0.5;
color.
y = (randomGen.Get01() * 0.5) + 0.5;
color.
z = (randomGen.Get01() * 0.5) + 0.5;
return color;
};
doc->InsertObject(polygonObject, nullptr , nullptr );
}
}
}
Further Reading
const Vector64 & GetMin(void) const
Definition: c4d_tools.h:573
@ ID_BASEOBJECT_USECOLOR
Definition: obase.h:16
Bool SetPoint(C4DAtom *op, Int32 index, const Vector &p, Int32 flags=0)
Int32 CreateNgon(C4DAtom *op, Int32 *padr, Int32 cnt, Int32 flags=0)
Int _nextEdgeOfFace
Definition: celldata.h:33
The maxon namespace contains all declarations of the MAXON API.
Definition: c4d_basedocument.h:15
@ ID_BASEOBJECT_COLOR
Definition: obase.h:21
Bool Contains(const T &value) const
Definition: range.h:234
Int _start
Definition: celldata.h:31
#define MODELING_SETNGON_FLAG_TRIANGULATE
Force the N-gon to be created as its polygons (similar to the MODELING_COMMIT_TRINGONS but for a sing...
Definition: lib_modeling.h:383
maxon::Float32 Float32
Definition: ge_sys_math.h:66
void AddPoint(const Vector64 &p)
Definition: c4d_tools.h:505
bool Bool
boolean type, possible values are only false/true, 8 bit
Definition: apibase.h:177
const MAXON_ATTRIBUTE_FORCE_INLINE T * GetFirst() const
Definition: basearray.h:1034
#define iferr_return
Definition: resultbase.h:1434
A class to construct a bounding box around points.
Definition: c4d_tools.h:472
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:66
Definition: basearray.h:366
Definition: celldata.h:15
#define MAXON_UNLIKELY(X)
Definition: compilerdetection.h:482
#define MODELING_COMMIT_TRINGONS
For example, an easy way to triangulate would be to just fetch the polygon selection into the kernel ...
Definition: lib_modeling.h:358
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
MAXON_ATTRIBUTE_FORCE_INLINE Int GetCount() const
Definition: basearray.h:527
MAXON_ATTRIBUTE_FORCE_INLINE ResultRef< T > Append()
Definition: basearray.h:569
CellData struct is a datacontainer that represents a single Voronoi Cell.
Definition: celldata.h:43
int32_t Int32
32 bit signed integer datatype.
Definition: apibase.h:172
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:184
static PolygonObject * Alloc(Int32 pcnt, Int32 vcnt)
const Vector64 & GetMax(void) const
Definition: c4d_tools.h:586
maxon::Int32 Int32
Definition: ge_sys_math.h:58
Bool InitObject(C4DAtom *op, Int32 flags=0)
Bool Commit(C4DAtom *op=nullptr, Int32 flags=0, BaseObject *cobj=nullptr)
T _minValue
The inclusive minimum boundary of this range.
Definition: range.h:256
Definition: c4d_baseobject.h:1597
Definition: ge_autoptr.h:36
T _maxValue
The inclusive maximum boundary of this range. If the minimum boundary is not less than or equal to th...
Definition: range.h:257
maxon::Bool Bool
Definition: ge_sys_math.h:53
@ ID_BASEOBJECT_USECOLOR_ALWAYS
Definition: obase.h:19