Rhino C++ API  7.21
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_SubDMeshFragmentGrid Class Reference

#include <opennurbs_subd.h>

Public Member Functions

unsigned int DisplayDensity () const
 
unsigned int DisplayDensityReduction () const
 
bool GetGridParameters (unsigned int grid_point_index, double grid_parameters[2]) const
 
const ON_2udex Grid2dexFromPointIndex (unsigned int grid_point_index) const
 
unsigned int GridFaceCount () const
 
unsigned int GridId () const
 
unsigned int GridPointCount () const
 
unsigned int LevelOfDetail () const
 
unsigned int PointIndexFromGrid2dex (unsigned int i, unsigned int j) const
 
unsigned int SidePointCount () const
 
unsigned int SideSegmentCount () const
 

Static Public Member Functions

static ON_SubDMeshFragmentGrid QuadGridFromDisplayDensity (unsigned int display_density, unsigned int mesh_density_reduction)
 
static ON_SubDMeshFragmentGrid QuadGridFromSideSegmentCount (unsigned int side_segment_count, unsigned int mesh_density_reduction)
 

Public Attributes

const unsigned int * m_F
 
unsigned short m_F_count
 
unsigned short m_F_level_of_detail
 
unsigned short m_F_stride
 
const ON_SubDMeshFragmentGridm_next_level_of_detail
 nullptr or the next level with 1/4 times the number of quads. More...
 
const ON_SubDMeshFragmentGridm_prev_level_of_detail
 nullptr or the previous level with 4 times the number of quads. More...
 
unsigned char m_reserved1 = 0
 
const unsigned int * m_S
 [4*m_side_segment_count + 1] indices that form the polyline boundary. More...
 
unsigned char m_side_segment_count
 = 2^n for non-empty grids (0 <= n <= 8) More...
 

Static Public Attributes

static const ON_SubDMeshFragmentGrid Empty
 
static const ON_SubDMeshFragmentGrid OneQuadGrid
 

Detailed Description

ON_SubDMeshFragment

Meshes of ON_SubD limit surface are calculated in fragments.

Member Function Documentation

◆ DisplayDensity()

unsigned int ON_SubDMeshFragmentGrid::DisplayDensity ( ) const

Returns: A number between 0 and 8 or ON_UNSET_INT_INDEX. SideSegmentCount() = 2^DisplayDensity().

◆ DisplayDensityReduction()

unsigned int ON_SubDMeshFragmentGrid::DisplayDensityReduction ( ) const

Description Each grid set has grids of quads that index the identical set of points (normals, texture coordinates, ...). The grid in the set with the maximum number of quads has DisplayDensityReduction() = 0. Additional grids in the set reduce the number of quads by a factor of 4. The intedger on the left is the DisplayDensityReduction value. The value of the right is the number of quads where M = maximum quad count for that grid set. All nonzero values of M are powers of 4 (4^n). The relationship between P = number of points in the set and M (the maximum number of quads for the point set) is P = (M/2+1)*(M/2+1).

DisplayDensityReduction(): number of quads 0: M 1: M/4 2: M/16 3: M/64 4: M/256 ...

Returns: The display density reduction from the maximum display density for this grid set.

◆ GetGridParameters()

bool ON_SubDMeshFragmentGrid::GetGridParameters ( unsigned int  grid_point_index,
double  grid_parameters[2] 
) const

Parameters: grid_point_index - [in] 0 <= grid_point_index < GridPointCount(). grid_parameters = [out] g2dex = Grid2dexFromPointIndex(grid_point_index). grid_parameters[] = {g2dex.i/SideSegmentCount(), g2dex.j/SideSegmentCount()} Returns: True if grid_point_index was valid and grid_parameters was returned. Remarks: On a SubD quad face, face->Vertex(0), face->Vertex(1), face->Vertex(2), face->Vertex(3) are the SubD quad corners in counter-clockwise order. When a grid comes from a SubD quad face, the associated grid parameters are: grid_parameters[] = (0,0) at face->Vertex(0), grid_parameters[] = (1,0) at face->Vertex(1), grid_parameters[] = (0,1) at face->Vertex(3), grid_parameters[] = (1,1) at face->Vertex(2),

◆ Grid2dexFromPointIndex()

const ON_2udex ON_SubDMeshFragmentGrid::Grid2dexFromPointIndex ( unsigned int  grid_point_index) const

Parameters: grid_point_index - [in] 0 <= grid_point_index < GridPointCount(). Returns: Grid (i,j) for that grid_point_index.
0 <= i < SidePointCount() 0 <= j < SidePointCount() Remarks: On a SubD quad face, face->Vertex(0), face->Vertex(1), face->Vertex(2), face->Vertex(3) are the SubD quad corners in counter-clockwise order.

Set n = grid->GridPointCount()-1 and k = grid->SideSegmentCount() = (grid->SidePointCount()-1). Note that (k+1)*(k+1) = (n+1) = GridPointCount().

When a grid comes from a SubD quad face, the associated grid point indices are

vertex, grid point index, grid point 2dex face->Vertex(0), 0, (0,0) face->Vertex(1), k, (k,0) face->Vertex(2), n-k, (k,k) face->Vertex(3), n, (0,k)

◆ GridFaceCount()

unsigned int ON_SubDMeshFragmentGrid::GridFaceCount ( ) const

◆ GridId()

unsigned int ON_SubDMeshFragmentGrid::GridId ( ) const

Description: The GridId() is persistent and unique based on the contents of the grid. It is intended to be used in render applications that store copies of ON_SubDMeshFragmentGrid settings in things like vertex object buffers and want a reliable way to index into them. The Empty grid has id = 0; Returns: 0: when the grid is empty 32*n + 2*lod + t: t = 0 for quads and 1 for tris, (0 <= n <= 8) m_F_count = 2^(2n), (0 <= lod <= 8) m_F_level_of_detail = lod Remarks: m_F_count is always

◆ GridPointCount()

unsigned int ON_SubDMeshFragmentGrid::GridPointCount ( ) const

Returns: Total number of points in the grid = SidePointCount()*SidePointCount().

◆ LevelOfDetail()

unsigned int ON_SubDMeshFragmentGrid::LevelOfDetail ( ) const
Deprecated:
Identical to DisplayDensityReduction(). Use DisplayDensityReduction() instead because its a better name.

◆ PointIndexFromGrid2dex()

unsigned int ON_SubDMeshFragmentGrid::PointIndexFromGrid2dex ( unsigned int  i,
unsigned int  j 
) const

Parameters: i - [in] 0 <= i < SidePointCount() j - [in] 0 <= j < SidePointCount() Returns: 0 <= grid_point_index < GridPointCount(). Remarks: On a SubD quad face, face->Vertex(0), face->Vertex(1), face->Vertex(2), face->Vertex(3) are the SubD quad corners in counter-clockwise order.

Set n = grid->GridPointCount()-1 and k = grid->SideSegmentCount() = (grid->SidePointCount()-1). Note that (k+1)*(k+1) = (n+1) = GridPointCount().

When a grid comes from a SubD quad face, the associated grid point indices are

vertex, grid point index, grid point 2dex face->Vertex(0), 0, (0,0) face->Vertex(1), k, (k,0) face->Vertex(2), n-k, (k,k) face->Vertex(3), n, (0,k)

◆ QuadGridFromDisplayDensity()

static ON_SubDMeshFragmentGrid ON_SubDMeshFragmentGrid::QuadGridFromDisplayDensity ( unsigned int  display_density,
unsigned int  mesh_density_reduction 
)
static

◆ QuadGridFromSideSegmentCount()

static ON_SubDMeshFragmentGrid ON_SubDMeshFragmentGrid::QuadGridFromSideSegmentCount ( unsigned int  side_segment_count,
unsigned int  mesh_density_reduction 
)
static

Description: Get mesh facet quads that index into a grid of points. Parameters: side_segment_count - [in] number quads in each row and column of the quad grid. side_segment_count >= 1 side_segment_count <= ON_SubDMesh::MaximumSideSegmentCount side_segment_count must be a power of 2

mesh_density_reduction - [in] 0: quad count = maximum quad count = (side_count x side_count) 1: quad count = 1/4 maximum quad count 1: quad count = 1/16 maximum quad count ... If 4^mesh_density_reduction > maximum quad count, then a single quad is returned.

◆ SidePointCount()

unsigned int ON_SubDMeshFragmentGrid::SidePointCount ( ) const

Returns: SideSegmentCount() + 1;

◆ SideSegmentCount()

unsigned int ON_SubDMeshFragmentGrid::SideSegmentCount ( ) const

Member Data Documentation

◆ Empty

const ON_SubDMeshFragmentGrid ON_SubDMeshFragmentGrid::Empty
static

No construction for performance reasons. use = ON_SubDMeshFragmentGrid::Empty QuadGridFromSideSegmentCount(...) or QuadGridFromDisplayDensity(...) to initialize.

ON_SubDMeshFragmentGrid() = default; ~ON_SubDMeshFragmentGrid() = default; ON_SubDMeshFragmentGrid(const ON_SubDMeshFragmentGrid&) = default; ON_SubDMeshFragmentGrid& operator=(const ON_SubDMeshFragmentGrid&) = default;

◆ m_F

const unsigned int* ON_SubDMeshFragmentGrid::m_F

◆ m_F_count

unsigned short ON_SubDMeshFragmentGrid::m_F_count

m_F_count = number of quads = m_side_segment_count*m_side_segment_count (0,1,4,16,256,1024,4096) Afer 0, each permitted value is 4x previous value

◆ m_F_level_of_detail

unsigned short ON_SubDMeshFragmentGrid::m_F_level_of_detail

m_F_level_of_detail is poorly named. It should be named m_F_mesh_density_reduction. 0 = no reduction (maximum level of detail) 1 = number of quads reduced by 1/4 2 = number of quads reduced by 1/16 ...

◆ m_F_stride

unsigned short ON_SubDMeshFragmentGrid::m_F_stride

◆ m_next_level_of_detail

const ON_SubDMeshFragmentGrid* ON_SubDMeshFragmentGrid::m_next_level_of_detail

nullptr or the next level with 1/4 times the number of quads.

◆ m_prev_level_of_detail

const ON_SubDMeshFragmentGrid* ON_SubDMeshFragmentGrid::m_prev_level_of_detail

nullptr or the previous level with 4 times the number of quads.

◆ m_reserved1

unsigned char ON_SubDMeshFragmentGrid::m_reserved1 = 0

◆ m_S

const unsigned int* ON_SubDMeshFragmentGrid::m_S

[4*m_side_segment_count + 1] indices that form the polyline boundary.

◆ m_side_segment_count

unsigned char ON_SubDMeshFragmentGrid::m_side_segment_count

= 2^n for non-empty grids (0 <= n <= 8)

◆ OneQuadGrid

const ON_SubDMeshFragmentGrid ON_SubDMeshFragmentGrid::OneQuadGrid
static