NgonBase Class Reference Library » Ngon

#include <lib_ngon.h>

公共成员函数

Bool   CopyTo ( NgonBase *dst)
Bool   Write ( HyperFile *hf)
Bool   读取 ( HyperFile *hf, Int32 id, Int32 level)
Bool   Translate ( VariableChanged *vc)
Bool   Changed ( PolygonObject *op)
UChar   GetEdgeStates ( Int32 id) const
Int32   GetCount () const
Pgon GetNgons ()
Bool   Resize ( Int32 cnt)
Int32   FindPolygon ( Int32 id, Int32 l=-1) const
Bool   CompactPgons ()
void  CheckPoints ( PolygonObject *op)
void  UpdateNgons ( PolygonObject *op)
Bool   ResetPoints ( PolygonObject *op)
void  SetFlags ( Int32 flgs)
Int32   GetFlags () const
Int32   GetDirtyCount () const
void  Dirty ()
void  InitMap ()
void  FreeMap ()
Bool   移除 ( Int32 id, Bool force)
Bool   ToSelect ( BaseSelect *pSelect, Int32 mode)
void  GetCenter ( Int32 id, const CPolygon *vadr, const 向量 *padr, 向量 *ip, 向量 *in)
Bool   RemapEdge ( Int32 oedge, Int32 *nedges, Int32 ncnt)
Bool   创建 ( UInt32 *nedges, Int32 ncnt)
Bool   RemapPolygon ( Int32 oply, Int32 nply)
Bool   拷贝 ( Pgon *src, Pgon *dst)
Bool   Validate ( PolygonObject *op)
Bool   IsValidNgon ( Pgon *pgon, const CPolygon *vadr)
Int32   BuildNgon ( Int32 *inner, Int32 *outer, Int32 icnt, Int32 ocnt, const CPolygon *vadr, const 向量 *padr)
Int32   BuildNgonFromPolys ( Int32 *polys, Int32 *outer, Int32 pcnt, Int32 ocnt, const CPolygon *vadr, const 向量 *padr)
Bool   Verify (const CPolygon *vadr, Int32 vcnt, UInt32 flags, Pgon *pgon=nullptr)
Pgon AllocNgon ( Int32 edge_cnt)
void  FreeNgon ( Pgon *&pgon)
Bool   SetNgon ( Int32 index, Pgon *src)
Bool   SetNgon ( Int32 index, UInt32 *edges, Int32 edge_cnt)

静态公共成员函数

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

私有成员函数

  NgonBase ()
  ~NgonBase ()

Private Attributes

NgonCache *  m_pNgonBase

Friends

class  ModelingKernelBase

构造函数 & 析构函数文档编制

◆  NgonBase()

NgonBase () private

◆  ~NgonBase()

~ NgonBase () private

成员函数文档编制

◆  Alloc()

static NgonBase * Alloc ( )
static

Allocates a N-gon base instance. Destroy the allocated N-gon base instance with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

注意
Normally this function is not needed, since the PolygonObject manages its own NgonBase .
返回
The allocated N-gon base instance, or nullptr if the allocation failed.

◆  Free()

static void Free ( NgonBase *&  p )
static

Destructs N-gon base instances allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] p The N-gon base 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 .

参数
[in] dst The destination N-gon base.
返回
true if successful, otherwise false .

◆  Write()

Bool Write ( HyperFile hf )

Private .

◆  Read()

Bool 读取 ( HyperFile hf ,
Int32   id ,
Int32   level  
)

Private .

◆  Translate()

Bool Translate ( VariableChanged vc )

Private .

◆  Changed()

Bool Changed ( PolygonObject op )

Private .

◆  GetEdgeStates()

UChar GetEdgeStates ( Int32   id ) const

Retrieves the edge states for the polygon id .
.

参数
[in] id A polygon ID.
返回
The edge state flags: PGONEDGE

◆  GetCount()

Int32 GetCount ( ) const

Retrieves the number of N-gons.

返回
The N-gon count.

◆  GetNgons()

Pgon * GetNgons ( )

Retrieves the array of Pgon data.

返回
The N-gon array.

◆  Resize()

Bool Resize ( Int32   cnt )

Resizes the Pgon data array.

参数
[in] cnt The new N-gon count.
返回
true if successful, otherwise false .

◆  FindPolygon()

Int32 FindPolygon ( Int32   id ,
Int32   l = -1  
) const

Searches for polygon index id in all N-gons.

参数
[in] id A polygon ID.
[in] l Private .
返回
The found N-gon id, or NOTOK if the polygon was not found in any N-gon.

◆  CompactPgons()

Bool CompactPgons ( )

Compacts the Pgon array, removing any dead (empty) Pgon .

返回
true if successful, otherwise false .

◆  CheckPoints()

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).

另请参阅
UpdateNgons() because this can change the object if an update is needed.
参数
[in] op A polygon object. The caller owns the pointed object.

◆  UpdateNgons()

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.

◆  ResetPoints()

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.
返回
true if successful, otherwise false .

◆  SetFlags()

void SetFlags ( Int32   flgs )

Sets the flags.

注意
Generally the forced "ignore" for the internal checks are used if modifying the N-gon data and needing to call functions that send changed messages to the object, such as adding a tag or resizing the object.
They are mainly a time saver since running N-gon checks takes time.
参数
[in] flgs The new flags: NGON_FLAG

◆  GetFlags()

Int32 GetFlags ( ) const

Gets the flags.

返回
The current flags: NGON_FLAG

◆  GetDirtyCount()

Int32 GetDirtyCount ( ) const

Retrieves the dirty count.

返回
The dirty count.

◆  Dirty()

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.

◆  InitMap()

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.

◆  FreeMap()

void FreeMap ( )

Private .

◆  Remove()

Bool 移除 ( Int32   id ,
Bool   force  
)

Removes the n-gon id from the array.

参数
[in] id The ID of the N-gon to remove.
[in] force true then CompactPgons() is called. Usually it is faster to remove the N-gons then compact the array at the end.
返回
true if successful, otherwise false .

◆  ToSelect()

Bool ToSelect ( BaseSelect pSelect ,
Int32   mode  
)

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
返回
true if successful, otherwise false .

◆  GetCenter()

void GetCenter ( Int32   id ,
const CPolygon vadr ,
const 向量 padr ,
向量 ip ,
向量 in  
)

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.

◆  RemapEdge()

Bool RemapEdge ( Int32   oedge ,
Int32 nedges ,
Int32   ncnt  
)

Private .

◆  Create()

Bool 创建 ( UInt32 nedges ,
Int32   ncnt  
)

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.
返回
true if successful, otherwise false .

◆  RemapPolygon()

Bool RemapPolygon ( Int32   oply ,
Int32   nply  
)

Searches the N-gons for oply and remaps this to nply .

参数
[in] oply The old polygon ID.
[in] nply The new polygon ID.
返回
true if successful, otherwise false .

◆  Copy()

Bool 拷贝 ( Pgon src ,
Pgon dst  
)

Copes a Pgon .

注意
The memory allocation for the Pgon objects uses its own internal memory manager and cannot be allocated using the Cinema 4D memory allocation calls. The function will fail if dst is not within the allocated space of the NgonBase .
参数
[in] src The source Pgon . The caller owns the pointed Pgon .
[in] dst The destination Pgon . The caller owns the pointed Pgon .
返回
true if successful, otherwise false .

◆  Validate()

Bool Validate ( PolygonObject op )

Checks if the N-gons are valid. If they are not then any invalid ones are removed.

注意
Usually not needed. This function is used internally to check for N-gons that get damaged if the polygons are modified without updating the N-gons.
参数
[in] op A polygon object. The caller owns the pointed polygon object.
返回
true if successful, otherwise false .

◆  IsValidNgon()

Bool IsValidNgon ( Pgon pgon ,
const CPolygon vadr  
)

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.
返回
The N-gon to validate.

◆  BuildNgon()

Int32 BuildNgon ( Int32 inner ,
Int32 outer ,
Int32   icnt ,
Int32   ocnt ,
const CPolygon vadr ,
const 向量 padr  
)

Helper function to build an N-gon from a list of edges.
The arrays inner and outer 可以是 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.
返回
The index of the added N-gon, or NOTOK if the operation failed.

◆  BuildNgonFromPolys()

Int32 BuildNgonFromPolys ( Int32 polys ,
Int32 outer ,
Int32   pcnt ,
Int32   ocnt ,
const CPolygon vadr ,
const 向量 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.
返回
The index of the added N-gon, or NOTOK if the operation failed.

◆  Verify()

Bool Verify ( const CPolygon vadr ,
Int32   vcnt ,
UInt32   flags ,
Pgon pgon = nullptr  
)

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.
返回
true if N-gons are valid, false if there are illegal N-gons.

◆  AllocNgon()

Pgon * AllocNgon ( Int32   edge_cnt )

Allocates an N-gon. Destroy the allocated N-gon with FreeNgon() .

参数
[in] edge_cnt The number of edges of the N-gon.
返回
The allocated N-gon, or nullptr if the allocation failed.

◆  FreeNgon()

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.

◆  SetNgon() [1/2]

Bool SetNgon ( Int32   index ,
Pgon src  
)

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.
返回
true if successful, otherwise false .

◆  SetNgon() [2/2]

Bool SetNgon ( Int32   index ,
UInt32 edges ,
Int32   edge_cnt  
)

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.
返回
true if successful, otherwise false .

Friends And Related Function Documentation

◆  ModelingKernelBase

friend class ModelingKernelBase friend

Member Data Documentation

◆  m_pNgonBase

NgonCache* m_pNgonBase private