Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

class Geo::IdentVertLinkBuilder

A utility for identifying pairs of "identical" vertices in a vertex buffer.

Runs in O(nlogn) time.

This class constructs an IdxArray of pairs that link together "identical" vertices. Note that not every possible pair of links is generated. If 3 vertices are identical, we only need 2 links to join them together. So large numbers of identical vertices are represented efficiently. If you wish to test if two vertices are identical, given the generated link array, it is not sufficient to just find an IdxLink with both vertices in it. The links describe a graph so you need to find a link with one of the vertices you are interested in and walk the graph described by the links to see if there is a path of links that touches the other vertex.

To determine whether two vertices are 'identical' this class uses a mask and does a bit-wise comparison. The mask should cover the stride of a single vertex. Any non-zero value in a byte in the mask indicates that the entire byte should be part of the bit-wise comparison between two vertices. Using this mask you can select the parts of the vertex structure that you consider to be relevant (for example, only masking in the position and normals).

If a bit-wise comparison is not suitable for your application, the code is fairly simple to modify. See the implementation in corresponding cpp file.

Functions

NameDescription
Create(Geo::s32, Geo::s32, const Geo::u8 *, const Geo::u8 *)

Construct this object and find links between identical vertices.

GetIdentGroup(Geo::s32, Geo::GeoArray< Geo::s32 > &)

Get a group of identical vertex indices.

GetLinkArray()

Get the link array. Will not be null.

GetNumIdentGroups()

The number of groups of indentical vertices.

GetNumLinks()

The number of links in the link array.

Release()

Release this object.


Anchor
a712376a3540d7709305de6adeb983c24
a712376a3540d7709305de6adeb983c24

static IdentVertLinkBuilder* Geo::IdentVertLinkBuilder::Create

...

public: IdentVertLinkBuilder * Create
(
    Geo::s32 numVertices,
    Geo::s32 vertexStride,
    const Geo::u8 * vertexMask,
    const Geo::u8 * vertexBufferData
)

...

Construct this object and find links between identical vertices.

Parameters
[in]numVertices

The number of vertices. Must be > 0.

[in]vertexStride

The size in bytes of a single vertex. Must be > 0.

[in]vertexMask

A byte array of length at least vertexStride. Any non-zero value masks in the byte. Cannot be null.

[in]vertexBufferData

The vertex data array. The length and vertex stride must match numVertices and vertexStride respectively. Cannot be null.

Returns

NULL if the parameters are invalid or there is insufficient memory.


Anchor
a7f0ad02a163911ec1b9bbc931f8acd6a
a7f0ad02a163911ec1b9bbc931f8acd6a

bool Geo::IdentVertLinkBuilder::GetIdentGroup

...

public: bool GetIdentGroup
(
    Geo::s32 groupIdx,
    Geo::GeoArray< Geo::s32 > & group
) const

...

Get a group of identical vertex indices.


Anchor
a08e0e2352ac3e169708630733701bacc
a08e0e2352ac3e169708630733701bacc

const IdxLink* Geo::IdentVertLinkBuilder::GetLinkArray

...

public: const IdxLink * GetLinkArray() const

...

Get the link array. Will not be null.


Anchor
a051fab0471f0ee0d874f19cc1646ea18
a051fab0471f0ee0d874f19cc1646ea18

Geo::s32 Geo::IdentVertLinkBuilder::GetNumIdentGroups

...

public: Geo::s32 GetNumIdentGroups() const

...

The number of groups of indentical vertices.


Anchor
aa763232b5eef50f3506a69401686a5c3
aa763232b5eef50f3506a69401686a5c3

...

public: Geo::s32 GetNumLinks() const

...

The number of links in the link array.


Anchor
a64535b6d1f47ae31dd4384bb11575ada
a64535b6d1f47ae31dd4384bb11575ada

void Geo::IdentVertLinkBuilder::Release

...

public: void Release()

...

Release this object.