NgonBase Class Reference

#include <c4d_ngonbase.h>

Public Member Functions

Bool CopyTo (NgonBase *dst)
 
Bool Write (HyperFile *hf)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Int32 GetCount ()
 
PgonGetNgons ()
 
Bool Resize (Int32 cnt)
 
Int32 FindPolygon (Int32 id)
 
Bool Create (UInt32 *nedges, Int32 ncnt)
 
Int32 BuildNgonFromPolys (Int32 *polys, Int32 *outer, Int32 pcnt, Int32 ocnt, const CPolygon *vadr, const Vector *padr, Int32 *hpolys=nullptr, Int32 *inner=nullptr, Int32 hpcnt=0, Int32 icnt=0)
 

Static Public Member Functions

static NgonBaseAlloc ()
 
static void Free (NgonBase *&p)
 

Private Member Functions

 NgonBase ()
 
 ~NgonBase ()
 
void FreeData ()
 

Private Attributes

Pgonm_pNgons
 
Int32 m_nCount
 

Detailed Description

Contains functions for handling N-gons.

Constructor & Destructor Documentation

◆ NgonBase()

NgonBase ( )
private

◆ ~NgonBase()

~NgonBase ( )
private

Member Function Documentation

◆ FreeData()

void FreeData ( )
private

◆ Alloc()

static NgonBase* Alloc ( )
static

Allocates an NgonBase instance. Destroy the allocated NgonBase instance with Free().

Note
Normally this function is not needed, since the PolygonObject manages its own NgonBase.
Returns
The allocated NgonBase instance, or nullptr if the allocation failed.

◆ Free()

static void Free ( NgonBase *&  p)
static

Destructs NgonBase instances allocated with Alloc().

Parameters
[in,out]pThe NgonBase instance to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ CopyTo()

Bool CopyTo ( NgonBase dst)

Copies the N-gon data to another NgonBase.

Parameters
[in,out]dstDestination N-gon helper.
Returns
true if successful, otherwise false.

◆ Write()

Bool Write ( HyperFile hf)

Private.

◆ Read()

Bool Read ( HyperFile hf,
Int32  id,
Int32  level 
)

Private.

◆ GetCount()

Int32 GetCount ( )

Gets the number of N-gons.

Returns
The N-gon count.

◆ GetNgons()

Pgon* GetNgons ( )

Gets the array of Pgon data.

Returns
The N-gon array. The N-gon base owns the pointed array.

◆ Resize()

Bool Resize ( Int32  cnt)

Resizes the Pgon data array.

Parameters
[in]cntNew N-gon count.
Returns
true if successful, otherwise false.

◆ FindPolygon()

Int32 FindPolygon ( Int32  id)

Searches for polygon index id in all N-gons.

Parameters
[in]idA polygon ID.
Returns
The found N-gon index, or NOTOK if the polygon was not found in any N-gon.

◆ Create()

Bool Create ( UInt32 nedges,
Int32  ncnt 
)

Creates a new N-gon (appended to the N-gon array) from the edge array passed. The marker bits for the segment end and no edges must be correctly set.

Parameters
[in]nedgesNew edge array. The caller owns the pointed array.
[in]ncntEdge array nedges size.
Returns
true if successful, otherwise false.

◆ BuildNgonFromPolys()

Int32 BuildNgonFromPolys ( Int32 polys,
Int32 outer,
Int32  pcnt,
Int32  ocnt,
const CPolygon vadr,
const Vector padr,
Int32 hpolys = nullptr,
Int32 inner = nullptr,
Int32  hpcnt = 0,
Int32  icnt = 0 
)

Builds an N-gon from a list of polygons and optionally the outer edges.

Parameters
[in]polysAn array of polygons that form the N-gon. The caller owns the pointed array.
[in]outerAn array of the outline of the N-gon. Use the internal mark (PGONEDGE_ENDSEGMENT) to mark segments in the N-gon outline. The caller owns the pointed array.
[in]pcntSize of polys array.
[in]ocntSize of outer array.
[in]vadrPolygon array. The caller owns the pointed array.
[in]padrPoint array. The caller owns the pointed array.
[in]hpolysAn array of polygons that surround holes in an N-gon. The caller owns the pointed array.
[in]innerAn array of point indices that form the outline of holes in an N-gon. The caller owns the pointed array.
[in]hpcntNumber of polygons in hpolys array.
[in]icntNumber of point indices in inner array.
Returns
Index of the added N-gon, or NOTOK if the operation failed.

Member Data Documentation

◆ m_pNgons

Pgon* m_pNgons
private

◆ m_nCount

Int32 m_nCount
private