#include <lib_ngon.h>
Static Public Member Functions | |
static NgonBase * | Alloc () |
static void | Free (NgonBase *&p) |
Private Member Functions | |
NgonBase () | |
~NgonBase () | |
Private Attributes | |
NgonCache * | m_pNgonBase |
Friends | |
class | ModelingKernelBase |
|
private |
|
private |
|
static |
Allocates a N-gon base instance. Destroy the allocated N-gon base instance with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
|
static |
Copies the N-gon data to another NgonBase.
[in] | dst | The destination N-gon base. |
Bool Translate | ( | VariableChanged * | vc | ) |
Private.
Bool Changed | ( | PolygonObject * | op | ) |
Private.
Retrieves the edge states for the polygon id.
.
[in] | id | A polygon ID. |
Int32 GetCount | ( | ) | const |
Retrieves the number of N-gons.
Resizes the Pgon data array.
[in] | cnt | The new N-gon count. |
Searches for polygon index id in all N-gons.
[in] | id | A polygon ID. |
[in] | l | Private. |
Bool CompactPgons | ( | ) |
void CheckPoints | ( | PolygonObject * | op | ) |
Checks the point of polygon object op to see if any N-gons need updating, e.g. if the point coordinates were changed from any N-gon.
Usually this should be managed manually. This function is normally used for backwards compatibility with older code that does not change N-gons (e.g. XL7, R8 plugins).
[in] | op | A polygon object. The caller owns the pointed object. |
void UpdateNgons | ( | PolygonObject * | op | ) |
Updates any dirty N-gons.
This changes the polygon object and retriangulates any N-gons that need updating. If CheckPoints() is called then this does not need to be called, since it is called if any changes were made.
[in] | op | A polygon object. The caller owns the pointed object. |
Bool ResetPoints | ( | PolygonObject * | op | ) |
Resets the internal tracking data for the N-gons for the current point coordinates.
[in] | op | A polygon object. The caller owns the pointed object. |
void SetFlags | ( | Int32 | flgs | ) |
Sets the flags.
[in] | flgs | The new flags: NGON_FLAG |
Int32 GetDirtyCount | ( | ) | const |
Retrieves the dirty count.
void Dirty | ( | ) |
Makes the internal N-gon tables dirty. Usually this is not needed and InitMap() should be called once changes are completed to update the N-gon tables.
void InitMap | ( | ) |
Forces the internal N-gon table data to be rebuilt. This must be called if any changes are made to the N-gon data.
This should always be called before any update message is sent to the polygon object when changes are completed.
void FreeMap | ( | ) |
Private.
Removes the n-gon id from the array.
[in] | id | The ID of the N-gon to remove. |
[in] | force | If true then CompactPgons() is called. Usually it is faster to remove the N-gons then compact the array at the end. |
Bool ToSelect | ( | BaseSelect * | pSelect, |
Int32 | mode | ||
) | const |
Generates a BaseSelect containing information about the N-gons.
[out] | pSelect | The selection to fill. The caller owns the pointed selection. |
[in] | mode | The mode: NGON_TOSELECTION |
void GetCenter | ( | Int32 | id, |
const CPolygon * | vadr, | ||
const Vector * | padr, | ||
Vector * | ip, | ||
Vector * | in | ||
) | const |
Gets the center of the N-gon id.
[in] | id | An N-gon ID. |
[in] | vadr | The polygons array. The caller owns the pointed array. |
[in] | padr | The points array. The caller owns the pointed array. |
[out] | ip | Assigned the center point. |
[out] | in | Assigned the normal vector. |
Create a new N-gon (appends to the N-gon array) from the edge array passed. Set the marker bits for the segment end and no edges.
[in] | nedges | The new edge array. The caller owns the pointed array. |
[in] | ncnt | The edge array size. |
Searches the N-gons for oply and remaps this to nply.
[in] | oply | The old polygon ID. |
[in] | nply | The new polygon ID. |
Copes a Pgon.
[in] | src | The source Pgon. The caller owns the pointed Pgon. |
[in] | dst | The destination Pgon. The caller owns the pointed Pgon. |
Bool Validate | ( | PolygonObject * | op | ) |
Checks if the N-gons are valid. If they are not then any invalid ones are removed.
[in] | op | A polygon object. The caller owns the pointed polygon object. |
Runs a simple sanity check on the N-gon passed to check if its points link together consistently.
[in] | pgon | The polygon array. The caller owns the pointed array. |
[in] | vadr | The points array. The caller owns the pointed array. |
Int32 BuildNgon | ( | Int32 * | inner, |
Int32 * | outer, | ||
Int32 | icnt, | ||
Int32 | ocnt, | ||
const CPolygon * | vadr, | ||
const Vector * | padr | ||
) |
Helper function to build an N-gon from a list of edges.
The arrays inner and outer can be nullptr, but not both of them at the same time.
[in] | inner | An array of internal (hidden) edges indices. The caller owns the pointed array. If only this is specified the function finds the main outline itself based on the hidden edges, this will also include any holes in the N-gon. |
[in] | outer | An 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] | icnt | The size of the inner array. |
[in] | ocnt | The size of the outer array. |
[out] | vadr | The polygons array. The caller owns the pointed array. |
[out] | padr | The points array. The caller owns the pointed array. |
Int32 BuildNgonFromPolys | ( | Int32 * | polys, |
Int32 * | outer, | ||
Int32 | pcnt, | ||
Int32 | ocnt, | ||
const CPolygon * | vadr, | ||
const Vector * | padr | ||
) |
Helper function to build an N-gon from a list of polygons and outer edges.
[in] | polys | An array of polygons that form the N-gon. |
[in] | outer | An array of the outline of the N-gon. The caller owns the pointed array. Use the internal mark (PGONEDGE_ENDSEGMENT) to mark segments in the N-gon outline. |
[in] | pcnt | The size of the polys array. |
[in] | ocnt | The size of the outer array. |
[in] | vadr | The polygons array. The caller owns the pointed array. |
[in] | padr | The points array. The caller owns the pointed array. |
Verifies N-gons.
[in] | vadr | A pointer to the polygon array. This can be obtained with PolygonObject::GetPolygonR(). The caller owns the pointed array. |
[in] | vcnt | The total number of polygons in the polygon array. This can be obtained with PolygonObject::GetPolygonCount(). |
[in] | flags | The flags: NGON_VERIFY_FLAG |
[in] | pgon | A pointer to a N-gon to verify it or nullptr to verify all N-gons. |
Allocates an N-gon. Destroy the allocated N-gon with FreeNgon().
[in] | edge_cnt | The number of edges of the N-gon. |
void FreeNgon | ( | Pgon *& | pgon | ) |
Destructs N-gons allocated with AllocNgon().
[in,out] | pgon | The N-gon to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards. |
Sets the N-gon specified by index to src.
[in] | index | The index of the N-gon to set. |
[in] | src | The new N-gon data. |
Sets the N-gon specified by index and the edge array edges.
[in] | index | The index of the N-gon to set. |
[in] | edges | The pointer to the edges array. The caller owns the pointed array. |
[in] | edge_cnt | The number of edges, size of the edges array. |
|
friend |
|
private |