Rhino C++ API  8.5
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
ON_SubDMeshFragment Class Reference

#include <opennurbs_subd.h>

Inheritance diagram for ON_SubDMeshFragment:
ON_SubDManagedMeshFragment

Public Types

enum  : unsigned int { MaximumSideSegmentCount = (1U << ON_SubDDisplayParameters::MaximumDensity) }
 
enum  : unsigned { MaximumVertexCount = 0x1000 }
 

Public Member Functions

const ON_BoundingBox BoundingBox (ON_SubDComponentLocation subd_appearance) const
 
const ON_Plane CenterFrame () const
 
const ON_3dVector CenterNormal () const
 
const ON_3dPoint CenterPoint () const
 
const ON_3dPoint CenterTextureCoordinate () const
 
void Clear () ON_NOEXCEPT
 Clear all information except the memory management inforation. More...
 
void ClearColors () const
 
void ClearControlNetQuad ()
 
void ClearCurvatures () const
 
void ClearPackRect ()
 
void ClearSurfaceBoundingBox ()
 
void ClearTextureCoordinates () const
 
const ON_ColorColorArray (ON_SubDComponentLocation subd_appearance) const
 
unsigned ColorArrayCount (ON_SubDComponentLocation subd_appearance) const
 
size_t ColorArrayStride (ON_SubDComponentLocation subd_appearance) const
 
unsigned int ColorCapacity () const
 
unsigned int ColorCount () const
 
bool ColorsExistForExperts () const
 
const ON_BoundingBox ControlNetQuadBoundingBox () const
 
const ON_SubDMeshFragment ControlNetQuadFragmentForExperts () const
 
const ON_3dPoint ControlNetQuadPoint (bool bGridOrder, unsigned point_index) const
 
bool CopyFrom (const ON_SubDMeshFragment &src_fragment)
 
bool CopyFrom (const ON_SubDMeshFragment &src_fragment, unsigned int display_density)
 
const ON_Color CornerColor (unsigned int grid_corner_index) const
 
const ON_SurfaceCurvature CornerCurvature (unsigned int grid_corner_index) const
 
const ON_Plane CornerFrame (unsigned int grid_corner_index) const
 
const ON_3dVector CornerNormal (unsigned int grid_corner_index) const
 
const ON_3dPoint CornerPoint (unsigned int grid_corner_index) const
 
const ON_SurfaceCurvatureCurvatureArray (ON_SubDComponentLocation subd_appearance) const
 
unsigned CurvatureArrayCount (ON_SubDComponentLocation subd_appearance) const
 
size_t CurvatureArrayStride (ON_SubDComponentLocation subd_appearance) const
 
unsigned int CurvatureCapacity () const
 
unsigned int CurvatureCount () const
 
bool CurvaturesExistForExperts () const
 
bool DeleteManagedArrays ()
 
void Dump (ON_TextLog &text_log) const
 
unsigned int FaceCornerIndex () const
 
unsigned int FaceFragmentCount () const
 
const ON_SubDMeshFragmentFirstFaceFragment () const
 
bool GetControlNetQuad (bool bGridOrder, ON_3dPoint quad_points[4], ON_3dVector &quad_normal) const
 
unsigned int GetFaceFragments (const ON_SubDMeshFragment **fragments, size_t fragments_capacity) const
 
unsigned int GetFaceFragments (ON_SimpleArray< const ON_SubDMeshFragment * > &fragments) const
 
unsigned GetNormalCurvatures (const unsigned sample_count, const unsigned comb_count_params, const bool get_first_comb, const bool getKu, const bool getKv, ON_SimpleArray< ON_3dPoint > *P, ON_SimpleArray< ON_3dVector > *Kuv) const
 
bool GetTextureCoordinteCorners (bool bGridOrder, ON_3dPoint texture_coordinate_corners[4]) const
 
const ON_SubDMeshFragmentGridGrid (ON_SubDComponentLocation subd_appearance) const
 
const bool HasValidPointAndNormalGrid () const
 
bool InterlacedArrays () const
 True if the memory for points, normals, textures, colors, and curvatures is interlaced. More...
 
bool IsFaceCornerFragment () const
 
bool IsFullFaceFragment () const
 
const ON_SubDMeshFragmentLastFaceFragment () const
 
bool ManagedArrays () const
 
const ON_SubDMeshFragmentNextFaceFragment (bool bReturnFirstFromLast) const
 
const double * NormalArray (ON_SubDComponentLocation subd_appearance) const
 
unsigned NormalArrayCount (ON_SubDComponentLocation subd_appearance) const
 
size_t NormalArrayStride (ON_SubDComponentLocation subd_appearance) const
 
unsigned int NormalCapacity () const
 
unsigned int NormalCount () const
 
const ON_2dPoint PackRectCenter () const
 
const ON_2dPoint PackRectCorner (unsigned int grid_corner_index) const
 
const double * PointArray (ON_SubDComponentLocation subd_appearance) const
 
unsigned PointArrayCount (ON_SubDComponentLocation subd_appearance) const
 
size_t PointArrayStride (ON_SubDComponentLocation subd_appearance) const
 
unsigned int PointCapacity () const
 
unsigned int PointCount () const
 
const ON_SubDMeshFragmentPreviousFaceFragment (bool bReturnLastFromFirstFirst) const
 
bool ReserveManagedVertexCapacity (size_t vertex_capacity)
 
bool SetColors (ON_Color color) const
 
void SetColorsExistForExperts (bool bSetColorsExist) const
 
bool SetColorsFromCallback (const ON_MappingTag &fragment_colors_mapping_tag, const ON_SubD &subd, ON__UINT_PTR callback_context, const ON_Color(*color_callback)(ON__UINT_PTR callback_context, const ON_MappingTag &mapping_tag, const ON_SubD &subd, ON_SubDComponentPtr cptr, const ON_3dPoint &P, const ON_3dVector &N, const ON_3dPoint &T, const ON_SurfaceCurvature &K)) const
 
void SetControlNetQuad (bool bGridOrder, const ON_3dPoint quad_points[4], ON_3dVector quad_normal)
 
bool SetCurvatures (bool bLazy) const
 
void SetCurvaturesExistForExperts (bool bSetCurvaturesExist) const
 
void SetNgonFaceFragmentPackRectCorners (bool bGridOrder, const ON_2dPoint face_pack_rect_corners[4], ON_2dVector face_pack_rect_size, ON_2udex ngon_grid_size, ON_2dVector ngon_sub_pack_rect_size, ON_2dVector ngon_sub_pack_rect_delta)
 
void SetNgonFaceFragmentTextureCoordinateCorners (bool bGridOrder, const ON_3dPoint face_texture_coordinate_corners[4], ON_2dVector face_pack_rect_size, ON_2udex ngon_grid_size, ON_2dVector ngon_sub_pack_rect_size, ON_2dVector ngon_sub_pack_rect_delta, bool bSetTextureCoordinates) const
 
void SetPackedTextureCoordinates () const
 
void SetPackRectCornersForExperts (bool bGridOrder, const ON_2dPoint fragment_pack_rect_corners[4])
 
void SetQuadOr3gonFaceFragmentPackRectCorners (bool bGridOrder, const ON_2dPoint face_pack_rect_corners[4])
 
void SetQuadOr3gonFaceFragmentTextureCoordinateCorners (bool bGridOrder, const ON_3dPoint face_texture_coordinate_corners[4], bool bSetTextureCoordinates) const
 
void SetTextureCoordinateCornersForExperts (bool bGridOrder, const ON_3dPoint fragment_texture_coordinate_corners[4], bool bSetTextureCoordinates) const
 
void SetTextureCoordinatesExistForExperts (bool bTextureCoordinatesExist) const
 
void SetTextureCoordinatesFromCorners () const
 
bool SetUnmanagedVertexCapacityForExperts (size_t vertex_capacity)
 
void SetUnpackedTextureCoordinates () const
 
bool SetVertexCount (size_t vertex_count)
 
bool SetVertexTextureCoordinate (ON_2udex grid2dex, ON_3dPoint texture_coordinate) const
 
bool SetVertexTextureCoordinate (unsigned grid2dex_i, unsigned grid2dex_j, ON_3dPoint texture_coordinate) const
 
bool SetVertexTextureCoordinate (unsigned grid_point_index, ON_3dPoint texture_coordinate) const
 
const ON_Plane SideFrame (unsigned int grid_side_index) const
 
const ON_3dVector SideNormal (unsigned int grid_side_index) const
 
const ON_3dPoint SidePoint (unsigned int grid_side_index) const
 
ON_ComponentStatus Status () const
 
const class ON_SubDEdgeSubDEdge (unsigned int grid_side_index) const
 
const class ON_SubDEdgePtr SubDEdgePtr (unsigned int grid_side_index) const
 
const class ON_SubDFaceSubDFace () const
 
const class ON_SubDVertexSubDVertex (unsigned int grid_corner_index) const
 
const class ON_SubDVertexPtr SubDVertexPtr (unsigned int grid_corner_index) const
 
const ON_BoundingBox SurfaceBoundingBox () const
 
const double * TextureCoordinateArray (ON_SubDComponentLocation subd_appearance) const
 
unsigned TextureCoordinateArrayCount (ON_SubDComponentLocation subd_appearance) const
 
size_t TextureCoordinateArrayStride (ON_SubDComponentLocation subd_appearance) const
 
unsigned int TextureCoordinateCapacity () const
 
const ON_3dPoint TextureCoordinateCorner (unsigned int grid_corner_index) const
 
unsigned int TextureCoordinateCount () const
 
bool TextureCoordinatesExistForExperts () const
 
bool Transform (bool bKeepTextures, bool bKeepCurvatures, bool bKeepColors, const ON_Xform &xform)
 
bool Transform (const ON_Xform &xform)
 This simple version transforms the points and normals and unconditionally makes no changes to the curvatures, texture coordinates and colors. More...
 
bool UnmanagedArrays () const
 
void UnsetControlNetQuad ()
 
unsigned VertexCapacity () const
 
const ON_Color VertexColor (ON_2udex grid2dex) const
 
const ON_Color VertexColor (unsigned grid2dex_i, unsigned grid2dex_j) const
 
const ON_Color VertexColor (unsigned grid_point_index) const
 
unsigned VertexCount () const
 
const ON_SurfaceCurvature VertexCurvature (ON_2udex grid2dex) const
 
const ON_SurfaceCurvature VertexCurvature (unsigned grid2dex_i, unsigned grid2dex_j) const
 
const ON_SurfaceCurvature VertexCurvature (unsigned grid_point_index) const
 
const ON_3dVector VertexNormal (ON_2udex grid2dex) const
 
const ON_3dVector VertexNormal (unsigned grid2dex_i, unsigned grid2dex_j) const
 
const ON_3dVector VertexNormal (unsigned grid_point_index) const
 
const ON_3dPoint VertexPoint (ON_2udex grid2dex) const
 
const ON_3dPoint VertexPoint (unsigned grid2dex_i, unsigned grid2dex_j) const
 
const ON_3dPoint VertexPoint (unsigned grid_point_index) const
 
const ON_3dPoint VertexTextureCoordinate (ON_2udex grid2dex) const
 
const ON_3dPoint VertexTextureCoordinate (unsigned grid2dex_i, unsigned grid2dex_j) const
 
const ON_3dPoint VertexTextureCoordinate (unsigned grid_point_index) const
 
const ON_3dPoint VertexTextureCoordinateFromCorners (ON_2udex grid2dex) const
 
const ON_3dPoint VertexTextureCoordinateFromCorners (unsigned grid2dex_i, unsigned grid2dex_j) const
 
const ON_3dPoint VertexTextureCoordinateFromCorners (unsigned grid_point_index) const
 

Static Public Member Functions

static unsigned int DisplayDensityFromSideSegmentCount (unsigned int side_segment_count)
 
static unsigned int FaceCountFromDisplayDensity (unsigned int display_density)
 
static unsigned int FullFragmentMeshPointCountFromDensity (unsigned int mesh_density)
 
static unsigned int FullFragmentMeshQuadCountFromDensity (unsigned int mesh_density)
 
static bool Get3gonFaceFragmentPackRectCorners (bool bFaceGridOrder, const ON_2dPoint face_pack_rect_corners[4], unsigned int fragment_index, bool bFragmentGridOrder, ON_2dPoint fragment_pack_rect_corners[4])
 
static bool GetNgonFaceFragmentPackRectCorners (unsigned int ngon_edge_count, unsigned int ngon_fragment_index, bool bGridOrder, const ON_2dPoint face_pack_rect_corners[4], ON_2dVector face_pack_rect_size, ON_2udex ngon_grid_size, ON_2dVector ngon_sub_pack_rect_size, ON_2dVector ngon_sub_pack_rect_delta, ON_2dPoint fragment_pack_rect_corners[4])
 
static unsigned int HalfFragmentMeshPointCountFromDensity (unsigned int mesh_density)
 
static unsigned int HalfFragmentMeshQuadCountFromDensity (unsigned int mesh_density)
 
static unsigned int PointCountFromDisplayDensity (unsigned int display_density)
 
static unsigned int QuadGridPointCountFromSideCount (unsigned int side_segment_count)
 
static unsigned int QuadGridQuadCountFromSideCount (unsigned int side_segment_count)
 
static bool SealAdjacentSides (bool bTestNearEqual, bool bCopyNormals, const ON_SubDMeshFragment &src_fragment, unsigned int i0, unsigned int i1, ON_SubDMeshFragment &dst_fragment, unsigned int j0, unsigned int j1)
 
static bool SealNormals (bool bTestNearEqual, const double *src, double *dst)
 
static bool SealPoints (bool bTestNearEqual, const double *src, double *dst)
 
static unsigned int SidePointCountFromSideCount (unsigned int side_segment_count)
 
static unsigned int SideSegmentCountFromDisplayDensity (unsigned int display_density)
 
static bool SideSegmentCountIsValid (unsigned int side_segment_count)
 
static size_t SizeofFragment (unsigned int display_density)
 

Public Attributes

const class ON_SubDFacem_face
 
unsigned short m_face_fragment_count
 Number of fragments that will be delivered for this face. More...
 
unsigned short m_face_fragment_index
 First fragment has index = 0. Last fragment has index = m_face_fragment_count-1. More...
 
unsigned short m_face_vertex_index [4]
 
ON_SubDMeshFragmentGrid m_grid
 Information to resolve m_P[], m_N[], and m_T[] into a grid of NxN quads. More...
 
double * m_N
 surface normals More...
 
size_t m_N_stride
 stride between normals for m_N[] as an array of 8 byte doubles (so 0 or >= 3) More...
 
ON_SubDMeshFragmentm_next_fragment
 
double * m_P
 surface points More...
 
size_t m_P_stride
 stride between points for m_P[] as an array of 8 byte doubles (so 0 or >= 3) More...
 
ON_SubDMeshFragmentm_prev_fragment
 
ON_BoundingBox m_surface_bbox
 3d bounding box of grid vertex points. More...
 
double * m_T
 
size_t m_T_stride
 stride between texture points for m_T[] as an array of 8 byte doubles (so 0 or >= 3) More...
 

Static Public Attributes

static const ON_SubDMeshFragment Empty
 Every field of ON_SubDMeshFragment::Empty is zero. More...
 

Friends

class ON_SubDHeap
 
class ON_SubDManagedMeshFragment
 
class ON_SubDMeshImpl
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned int
Enumerator
MaximumSideSegmentCount 

◆ anonymous enum

anonymous enum : unsigned

The mesh fragment is a grid of quads. There are m_side_count quad edges along each side of the tessellation, There are a total of m_side_count X m_side_count quads, and m_P_count = (m_side_count+1)*(m_side_count+1).

Enumerator
MaximumVertexCount 

64x64 grid of points

Member Function Documentation

◆ BoundingBox()

const ON_BoundingBox ON_SubDMeshFragment::BoundingBox ( ON_SubDComponentLocation  subd_appearance) const

◆ CenterFrame()

const ON_Plane ON_SubDMeshFragment::CenterFrame ( ) const

◆ CenterNormal()

const ON_3dVector ON_SubDMeshFragment::CenterNormal ( ) const

◆ CenterPoint()

const ON_3dPoint ON_SubDMeshFragment::CenterPoint ( ) const

Parameters: grid_side_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Limit surface location at the center of the grid side or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ CenterTextureCoordinate()

const ON_3dPoint ON_SubDMeshFragment::CenterTextureCoordinate ( ) const

◆ Clear()

void ON_SubDMeshFragment::Clear ( )

Clear all information except the memory management inforation.

The intent is to be able to clear and reuse the fragment at its current vertex capacity.

Secifically:

Set referenced SubDFace to nullptr. Set vertex count to zero. Set existance of textures, curvatures, and colors to false. Set control net quad values to nans. Set the grid to ON_SubDMeshFragmentGrid::Empty. Set the surface bounding box to nan.

Does not change vertex capacity or deallocate managed arrays.

◆ ClearColors()

void ON_SubDMeshFragment::ClearColors ( ) const

Call ClearColors() if vertex colors do not exist or are no longer valid.

◆ ClearControlNetQuad()

void ON_SubDMeshFragment::ClearControlNetQuad ( )

◆ ClearCurvatures()

void ON_SubDMeshFragment::ClearCurvatures ( ) const

Call ClearCurvatures() if the fragment points are changed and any existing curvature values are now invalid.

◆ ClearPackRect()

void ON_SubDMeshFragment::ClearPackRect ( )

Description: Clears the pack rectangle. Remarks: Does not change the value of ON_SubDFace::PackId() or ON_SubDFace::TextureCoordinateType() Use ON_SubDFace::ClearPackId() to clear the pack id.

◆ ClearSurfaceBoundingBox()

void ON_SubDMeshFragment::ClearSurfaceBoundingBox ( )

◆ ClearTextureCoordinates()

void ON_SubDMeshFragment::ClearTextureCoordinates ( ) const

◆ ColorArray()

const ON_Color* ON_SubDMeshFragment::ColorArray ( ON_SubDComponentLocation  subd_appearance) const
Parameters
subd_appearanceSpecifies which array (surface points or control net corners)
Returns
If colors are set, the number of curvatures in the specified array. Otherwise, 0 is returned.


◆ ColorArrayCount()

unsigned ON_SubDMeshFragment::ColorArrayCount ( ON_SubDComponentLocation  subd_appearance) const
Parameters
subd_appearanceSpecifies which array (surface points or control net corners)
Returns
If colors are set, the number of colors in the specified array. Otherwise, 0 is returned.


◆ ColorArrayStride()

size_t ON_SubDMeshFragment::ColorArrayStride ( ON_SubDComponentLocation  subd_appearance) const

◆ ColorCapacity()

unsigned int ON_SubDMeshFragment::ColorCapacity ( ) const

Returns: If the grid has memory to store colors, then VertexCapacity() is returned. Otherwise 0 is returned. Remarks: Use ColorCount() > 0 to determine if the color values are actually set.

◆ ColorCount()

unsigned int ON_SubDMeshFragment::ColorCount ( ) const

Returns: If grid vertex colors are available, then VertexCount() is returned. Otherwise 0 is returned. Remarks: Use ColorCapacity() to get the capacity of m_C[].

◆ ColorsExistForExperts()

bool ON_SubDMeshFragment::ColorsExistForExperts ( ) const

Returns: True if vertex color exist bit is set. This bit is used for control net and color array setting. Remarks: Use ColorCount() to determine if vertex colors are set.

◆ ControlNetQuadBoundingBox()

const ON_BoundingBox ON_SubDMeshFragment::ControlNetQuadBoundingBox ( ) const

◆ ControlNetQuadFragmentForExperts()

const ON_SubDMeshFragment ON_SubDMeshFragment::ControlNetQuadFragmentForExperts ( ) const

Description: Create a one quad fragment with m_P = this->m_ctrlnetP[], m_P_stride = 3 m_N = this->m_ctrlnetN, m_N_stride = 0 m_T = this->m_ctrlnetT, m_T_stride = 3 NOTE WELL: 1) "this" must remain in scope and unchanged while the returned value is used because the returned value references memory in thism_ctrlnetX[] arrays. 2) The next/prev pointers on the returned fragment are copied from this, but the returned value is not reciprocally referenced by next/prev in the linked list. Returns: A control net quad fragment that can be used locally when the SubDAppearance is ON_SubDComponentLocation::ControlNet. The points, normals, and texture_coordinates of the returned fragment are the control net quad points, normals, and texture coordinates of this fragment. m_grid is a single quad grid.

◆ ControlNetQuadPoint()

const ON_3dPoint ON_SubDMeshFragment::ControlNetQuadPoint ( bool  bGridOrder,
unsigned  point_index 
) const

◆ CopyFrom() [1/2]

bool ON_SubDMeshFragment::CopyFrom ( const ON_SubDMeshFragment src_fragment)

No construction for performance reasons. If you require initialization, use = ON_SubDMeshFragment::Empty

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

◆ CopyFrom() [2/2]

bool ON_SubDMeshFragment::CopyFrom ( const ON_SubDMeshFragment src_fragment,
unsigned int  display_density 
)

Parameters: src_fragment - [in] fragment to copy display_density - [in] The desired display density of the copy.

If display_density = ON_UNSET_UINT_INDEX, then this->m_P_capacity must be at least srf_fragment.m_P_count, all points are copied, and this->m_grid = srf_fragment.m_grid.

Otherwise, src_fragment must have enough points to provide the specified denisity and this must have enough point capacity to store the specified density.

this - [out] This must have a point capacity large enough to accommodate the requested display density.

◆ CornerColor()

const ON_Color ON_SubDMeshFragment::CornerColor ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] 0, 1, 2, or 3 Returns: vertex color at the grid corner or ON_Color::UnsetColor if thre are not vertex colors. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ CornerCurvature()

const ON_SurfaceCurvature ON_SubDMeshFragment::CornerCurvature ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] 0, 1, 2, or 3 Returns: vertex surface curvature at the grid corner or ON_SurfaceCurvature::Nan if there are not vertex curvatures. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ CornerFrame()

const ON_Plane ON_SubDMeshFragment::CornerFrame ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Limit surface frame at the grid corner or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ CornerNormal()

const ON_3dVector ON_SubDMeshFragment::CornerNormal ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] 0, 1, 2, or 3 Returns: Limit surface normal at the grid corner or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ CornerPoint()

const ON_3dPoint ON_SubDMeshFragment::CornerPoint ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] 0, 1, 2, or 3 Returns: Limit surface location at the grid corner or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ CurvatureArray()

const ON_SurfaceCurvature* ON_SubDMeshFragment::CurvatureArray ( ON_SubDComponentLocation  subd_appearance) const
Parameters
subd_appearanceSpecifies which array (surface points or control net corners)
Returns
If curvature are set, a pointer to the curvatures in the specified array. Otherwise, nullptr is returned.

◆ CurvatureArrayCount()

unsigned ON_SubDMeshFragment::CurvatureArrayCount ( ON_SubDComponentLocation  subd_appearance) const
Parameters
subd_appearanceSpecifies which array (surface points or control net corners)
Returns
If curvature are set, the number of curvatures in the specified array. Otherwise, 0 is returned.


◆ CurvatureArrayStride()

size_t ON_SubDMeshFragment::CurvatureArrayStride ( ON_SubDComponentLocation  subd_appearance) const

◆ CurvatureCapacity()

unsigned int ON_SubDMeshFragment::CurvatureCapacity ( ) const

Returns: If the grid has memory to store curvatures, then VertexCapacity() is returned. Otherwise 0 is returned. Remarks: Use CurvatureCount() > 0 to determine if the curvature values are actually set.

◆ CurvatureCount()

unsigned int ON_SubDMeshFragment::CurvatureCount ( ) const

Returns: If the grid has set curvatures, then VertexCount() is returned. Otherwise 0 is returned. Remarks: Use CurvatureCapacity() to get capacity of the m_K[] array (set or unset). This function return the number of set curvatures.

◆ CurvaturesExistForExperts()

bool ON_SubDMeshFragment::CurvaturesExistForExperts ( ) const

Returns: True if the curvatures exist bit is set. This bit is used for control net and vertex values. Remarks: Use CurvatureCount() to determine if vertices have set curvature values.

◆ DeleteManagedArrays()

bool ON_SubDMeshFragment::DeleteManagedArrays ( )

True if the memory in the m_P[], m_N[], m_T[], m_K[], and m_C[] arrays is managed by this ON_SubDMeshFragment instance, this function deletes it and zeros the appropriate ponters and strides. Otherwise nothing is done.

◆ DisplayDensityFromSideSegmentCount()

static unsigned int ON_SubDMeshFragment::DisplayDensityFromSideSegmentCount ( unsigned int  side_segment_count)
static

Returns: base 2 log of side_segment_count. Remarks: side_segment_count = 2^display_density

◆ Dump()

void ON_SubDMeshFragment::Dump ( ON_TextLog text_log) const

◆ FaceCornerIndex()

unsigned int ON_SubDMeshFragment::FaceCornerIndex ( ) const

Returns: If IsFaceCornerFragment() is true, then the index of the face's vertex for the corner is returned. Otherwise, ON_UNSET_UINT_INDEX is returned.

◆ FaceCountFromDisplayDensity()

static unsigned int ON_SubDMeshFragment::FaceCountFromDisplayDensity ( unsigned int  display_density)
static

Parameters: display_density - [in] >= 0 Returns: total number of faces in the limit mesh fragment.

◆ FaceFragmentCount()

unsigned int ON_SubDMeshFragment::FaceFragmentCount ( ) const

Returns: Number of fragments that cover this face. 1 for quads and N>= 3 for faces with N sides when N != 4.

◆ FirstFaceFragment()

const ON_SubDMeshFragment* ON_SubDMeshFragment::FirstFaceFragment ( ) const

Returns: First fragment for this->m_face.

◆ FullFragmentMeshPointCountFromDensity()

static unsigned int ON_SubDMeshFragment::FullFragmentMeshPointCountFromDensity ( unsigned int  mesh_density)
static

Returns: Number of mesh points in a full sized fragment with the specified mesh density.

◆ FullFragmentMeshQuadCountFromDensity()

static unsigned int ON_SubDMeshFragment::FullFragmentMeshQuadCountFromDensity ( unsigned int  mesh_density)
static

Returns: Number of mesh quads in a full sized fragment with the specified mesh density.

◆ Get3gonFaceFragmentPackRectCorners()

static bool ON_SubDMeshFragment::Get3gonFaceFragmentPackRectCorners ( bool  bFaceGridOrder,
const ON_2dPoint  face_pack_rect_corners[4],
unsigned int  fragment_index,
bool  bFragmentGridOrder,
ON_2dPoint  fragment_pack_rect_corners[4] 
)
static

Description: This functions gets the pack rect corners on fragments used to render 3-gon ON_SubDFaces. When an ON_SubDFace is an 3-gon, it is rendered with 3 ON_SubDMeshFragments. Parameters: bFacePackRectGridOrder - [in] Order for face_pack_rect_corners[]. face_pack_rect_corners - [in] The points returned by ON_SubDFace::PackRectCorner(bGridOrder, i) fragment_index - [in] 0 <= ngon_fragment_index < 3 bFragmentPackRectGridOrder - [in] Order for face_pack_rect_corners[]. fragment_pack_rect_corners - [out]

◆ GetControlNetQuad()

bool ON_SubDMeshFragment::GetControlNetQuad ( bool  bGridOrder,
ON_3dPoint  quad_points[4],
ON_3dVector quad_normal 
) const

Parameters: bGridOrder - [in] If true, then points are returned in fragment grid order. Otherwise, points are returned in counter-clockwise quad order. quad_points - [out] quad_normal - [out]

◆ GetFaceFragments() [1/2]

unsigned int ON_SubDMeshFragment::GetFaceFragments ( const ON_SubDMeshFragment **  fragments,
size_t  fragments_capacity 
) const

Parameters: fragments_capacity - in Capacity of the fragments[] array. fragments[] - out Fragments are returned here.

◆ GetFaceFragments() [2/2]

unsigned int ON_SubDMeshFragment::GetFaceFragments ( ON_SimpleArray< const ON_SubDMeshFragment * > &  fragments) const

◆ GetNgonFaceFragmentPackRectCorners()

static bool ON_SubDMeshFragment::GetNgonFaceFragmentPackRectCorners ( unsigned int  ngon_edge_count,
unsigned int  ngon_fragment_index,
bool  bGridOrder,
const ON_2dPoint  face_pack_rect_corners[4],
ON_2dVector  face_pack_rect_size,
ON_2udex  ngon_grid_size,
ON_2dVector  ngon_sub_pack_rect_size,
ON_2dVector  ngon_sub_pack_rect_delta,
ON_2dPoint  fragment_pack_rect_corners[4] 
)
static

Description: This functions gets the pack rect corners for fragments used to render n-gon ON_SubDFaces when n >= 5. When an ON_SubDFace is an n-gon, it is rendered with n ON_SubDMeshFragments. Parameters: ngon_fragment_index - [in] 0 <= ngon_fragment_index < ngon_edge_count bGridOrder - [in] Order for face_pack_rect_corners[]. face_pack_rect_corners - [in] The points returned by ON_SubDFace::PackRectCorner(bGridOrder, i) face_pack_rect_size - [in] The n-gon face's ON_SubDFace::PackRectSize() value. ngon_grid_size - [in] ngon_sub_pack_rect_size - [in] ngon_sub_pack_rect_delta - [in] These three parameters are values from ON_SubDFace::GetNgonSubPackRectSizeAndDelta(). ngon_grid_size, ngon_sub_pack_rect_size, and ngon_sub_pack_rect_delta are identical for all the ON_SubDMeshFragments used to render the n-gon face. The value of m_face_fragment_index determines which sub pack rect is assigned to each of the n ON_SubDMeshFragments use to render the n-gon face. fragment_pack_rect_corners - [out]

◆ GetNormalCurvatures()

unsigned ON_SubDMeshFragment::GetNormalCurvatures ( const unsigned  sample_count,
const unsigned  comb_count_params,
const bool  get_first_comb,
const bool  getKu,
const bool  getKv,
ON_SimpleArray< ON_3dPoint > *  P,
ON_SimpleArray< ON_3dVector > *  Kuv 
) const

Description: Computes normal curvature values for this fragment. Evaluation points are uniformly spaced over the fragment to fill the N, Ku, Kv arrays. Parameters: sample_count - [in] How many samples to get in both directions. comb_count_params - [in] How many combs to get in both directions (+1 if get_first_comb is false). get_first_comb - [in] Wheter to skip combs at u = 0 and v = 0. The parameters at which to get the combs are the same when:

  • get_first_comb is true and comb_count is n
  • get_first_comb is false and comb_count is n getKu, getKv - [in] Should the curvature be computed along u-isos, v-isos, or both. P, Kuv - [out] Arrays of size (getKu + getKv) * sample_count * comb_count_arrays where Points and Curvatures along u-isos or along v-isos are stored. Sample (i, j) in u direction, on u-dir comb j at sample i is stored at index i + (j - get_first_comb ? 0 : 1) * sample_count. Sample (i, j) in v direction, on v-dir comb i at sample j is stored at index (getKu * sample_count * comb_count_arrays) + j + (i - get_first_comb ? 0 : 1) * sample_count. Direction u (indexed with i) refers to the Fragment's grid 1st index (from face->Vertex(0) to face->Vertex(1)). Direction v (indexed with j) refers to the Fragment's grid 2nd index (from face->Vertex(0) to face->Vertex(3)). comb_count_arrays = comb_count_params - get_first_comb ? 1 : 0 Returns: Number of points sampled

◆ GetTextureCoordinteCorners()

bool ON_SubDMeshFragment::GetTextureCoordinteCorners ( bool  bGridOrder,
ON_3dPoint  texture_coordinate_corners[4] 
) const

Description: Get the texture coordinate corners. Parameters: bGridOrder - [in] If true, then points are returned in fragment grid order. Otherwise, points are returned in counter-clockwise quad order. texture_coordinate_corners - [out]

◆ Grid()

const ON_SubDMeshFragmentGrid& ON_SubDMeshFragment::Grid ( ON_SubDComponentLocation  subd_appearance) const

◆ HalfFragmentMeshPointCountFromDensity()

static unsigned int ON_SubDMeshFragment::HalfFragmentMeshPointCountFromDensity ( unsigned int  mesh_density)
static

Returns: Number of mesh points in a half sized fragment with the specified mesh density.

◆ HalfFragmentMeshQuadCountFromDensity()

static unsigned int ON_SubDMeshFragment::HalfFragmentMeshQuadCountFromDensity ( unsigned int  mesh_density)
static

Returns: Number of mesh quads in a half sized fragment with the specified mesh density.

◆ HasValidPointAndNormalGrid()

const bool ON_SubDMeshFragment::HasValidPointAndNormalGrid ( ) const

◆ InterlacedArrays()

bool ON_SubDMeshFragment::InterlacedArrays ( ) const

True if the memory for points, normals, textures, colors, and curvatures is interlaced.

◆ IsFaceCornerFragment()

bool ON_SubDMeshFragment::IsFaceCornerFragment ( ) const

Returns: True if the fragment covers a corner of the SubD face.

◆ IsFullFaceFragment()

bool ON_SubDMeshFragment::IsFullFaceFragment ( ) const

Returns: True if the fragment covers the entire SubD face.

◆ LastFaceFragment()

const ON_SubDMeshFragment* ON_SubDMeshFragment::LastFaceFragment ( ) const

Returns: Last fragment for this->m_face.

◆ ManagedArrays()

bool ON_SubDMeshFragment::ManagedArrays ( ) const

Returns: True if the memory in the m_P[], m_N[], m_T[], m_K[], and m_C[] arrays is managed by this ON_SubDMeshFragment instance and can be deleted by calling DeleteManagedArrays(). False if an external agent is managing the memory.

◆ NextFaceFragment()

const ON_SubDMeshFragment* ON_SubDMeshFragment::NextFaceFragment ( bool  bReturnFirstFromLast) const

Parameters: bReturnFirstFromLast - in If false and this is the last fragment, then nullptr is returned. If true and this is the last fragment, then FirstFaceFragment() is returned. Returns: Next fragment for this->m_face.

◆ NormalArray()

const double* ON_SubDMeshFragment::NormalArray ( ON_SubDComponentLocation  subd_appearance) const

◆ NormalArrayCount()

unsigned ON_SubDMeshFragment::NormalArrayCount ( ON_SubDComponentLocation  subd_appearance) const

◆ NormalArrayStride()

size_t ON_SubDMeshFragment::NormalArrayStride ( ON_SubDComponentLocation  subd_appearance) const

◆ NormalCapacity()

unsigned int ON_SubDMeshFragment::NormalCapacity ( ) const

◆ NormalCount()

unsigned int ON_SubDMeshFragment::NormalCount ( ) const

Returns: If grid vertex surface normals are available, then VertexCount() is returned. Otherwise 0 is returned.

◆ PackRectCenter()

const ON_2dPoint ON_SubDMeshFragment::PackRectCenter ( ) const

◆ PackRectCorner()

const ON_2dPoint ON_SubDMeshFragment::PackRectCorner ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Pack rect corner point. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ PointArray()

const double* ON_SubDMeshFragment::PointArray ( ON_SubDComponentLocation  subd_appearance) const

◆ PointArrayCount()

unsigned ON_SubDMeshFragment::PointArrayCount ( ON_SubDComponentLocation  subd_appearance) const

◆ PointArrayStride()

size_t ON_SubDMeshFragment::PointArrayStride ( ON_SubDComponentLocation  subd_appearance) const

◆ PointCapacity()

unsigned int ON_SubDMeshFragment::PointCapacity ( ) const

◆ PointCount()

unsigned int ON_SubDMeshFragment::PointCount ( ) const

Returns: If grid vertex points are available, then VertexCount() is returned. Otherwise 0 is returned.

◆ PointCountFromDisplayDensity()

static unsigned int ON_SubDMeshFragment::PointCountFromDisplayDensity ( unsigned int  display_density)
static

Parameters: display_density - [in] >= 0 Returns: total number of points in the limit mesh fragment. Remarks: The number of points is the same for quad or tri subdivision limit mesh fragments, even though one is a rectanglular collection of quads and the other is a triangular collection of triangles.

◆ PreviousFaceFragment()

const ON_SubDMeshFragment* ON_SubDMeshFragment::PreviousFaceFragment ( bool  bReturnLastFromFirstFirst) const

Parameters: bReturnLastFromFirstFirst - in If false and this is the first fragment, then nullptr is returned. If true and this is the first fragment, then LastFaceFragment() is returned. Returns: Previous fragment for this->m_face.

◆ QuadGridPointCountFromSideCount()

static unsigned int ON_SubDMeshFragment::QuadGridPointCountFromSideCount ( unsigned int  side_segment_count)
static

Returns: If side_segment_count is valid, then (side_segment_count+1)^2 is returned. Otherwise 0 is returned.

◆ QuadGridQuadCountFromSideCount()

static unsigned int ON_SubDMeshFragment::QuadGridQuadCountFromSideCount ( unsigned int  side_segment_count)
static

Returns: If side_segment_count is valid, then side_segment_count^2 is returned. Otherwise 0 is returned.

◆ ReserveManagedVertexCapacity()

bool ON_SubDMeshFragment::ReserveManagedVertexCapacity ( size_t  vertex_capacity)

Description: Sets number of fragment vertices available (number of elements available in the m_P[], m_N[], m_T[], m_K[], and m_C[] arrays). The memory for the arrays is managed by something besides this ON_SubDMeshFragment instance. Parameters: vertex_capacity - [in] A value no larger than ON_SubDMeshFragment::MaximumVertexCount. Returns: True if successful

◆ SealAdjacentSides()

static bool ON_SubDMeshFragment::SealAdjacentSides ( bool  bTestNearEqual,
bool  bCopyNormals,
const ON_SubDMeshFragment src_fragment,
unsigned int  i0,
unsigned int  i1,
ON_SubDMeshFragment dst_fragment,
unsigned int  j0,
unsigned int  j1 
)
static

Description: Copies location and optionally normal information from a side of src_fragment to a side of dst_fragment. This is often used for "sealing" adjacent fragments where the same edge is evaluated from different faces. All evaluations are as accurate as IEEE double precision arithmetic can produce. However there are often tiny differences (last few bits of the coordinate values differ) in vertext locations because we are using finite precision arithmetic with operations in different orders. In general, rendering, mesho topology, and edge analysis calculations perform poorly when tinity differences exist.

Parameters: bTestNearEqual - [in] If true, then the copy is performed only when the points or normals are nearly identical. In this case if the discrepance between coordinates is too large, then this function returns false. bCopyNormals - [in] If true, then normal information is copied along with point information. src_fragment - [in] source fragment i0, i1 - [in] indices for the src_fragment.m_S[] array.
dst_fragment - [in] destination fragment j0, j1 - [in] indices for dst_fragment.m_S[] array. abs(j0-j1) = abs(i0-i1); Remarks: It is required that max(i0,i1) - min(i0,i1) = max(j0,j1) - min(j0,j1) and all indices are valid for the respective fragments. The src_fragment point/normal identified by src_fragment.m_S[i] is copied to he dst_fragment point/normal identified by dst_fragment.m_S[j], where i0->j0, i1->j1.

◆ SealNormals()

static bool ON_SubDMeshFragment::SealNormals ( bool  bTestNearEqual,
const double *  src,
double *  dst 
)
static

Parameters: bTestNearEqual - [in] If true, then the copy is performed only when the points or normals are nearly identical. In this case if the discrepance between coordinates is too large, then this function returns false. src - [in] dst - [in/out] The 3d point (src[0],src[1],src2[2]) is copied to (dst[0],dst[1],dst[2]). Returns: True if a copy occurred.

◆ SealPoints()

static bool ON_SubDMeshFragment::SealPoints ( bool  bTestNearEqual,
const double *  src,
double *  dst 
)
static

Parameters: bTestNearEqual - [in] If true, then the copy is performed only when the points or normals are nearly identical. In this case if the discrepance between coordinates is too large, then this function returns false. src - [in] dst - [in/out] The 3d point (src[0],src[1],src2[2]) is copied to (dst[0],dst[1],dst[2]). Returns: True if a copy occurred.

◆ SetColors()

bool ON_SubDMeshFragment::SetColors ( ON_Color  color) const

Description: Set all vertex colors in m_C[] to color. Parameters: color - [in]

◆ SetColorsExistForExperts()

void ON_SubDMeshFragment::SetColorsExistForExperts ( bool  bSetColorsExist) const

Parameters: bSetColorsExist - [in] True if vertex colors exist. False vertex colors do not exist or are no longer valid. SetColorsExist(false) and ClearColors() are two ways to do the same thing.

◆ SetColorsFromCallback()

bool ON_SubDMeshFragment::SetColorsFromCallback ( const ON_MappingTag fragment_colors_mapping_tag,
const ON_SubD subd,
ON__UINT_PTR  callback_context,
const ON_Color(*)(ON__UINT_PTR callback_context, const ON_MappingTag &mapping_tag, const ON_SubD &subd, ON_SubDComponentPtr cptr, const ON_3dPoint &P, const ON_3dVector &N, const ON_3dPoint &T, const ON_SurfaceCurvature &K)  color_callback 
) const

Description: Set the vertex colors in m_C[] from a callback function. Parameters:

◆ SetControlNetQuad()

void ON_SubDMeshFragment::SetControlNetQuad ( bool  bGridOrder,
const ON_3dPoint  quad_points[4],
ON_3dVector  quad_normal 
)

Parameters: bGridOrder - [in] If true, then points are returned in fragment grid order. Otherwise, points are returned in counter-clockwise quad order. quad_points - [in]

◆ SetCurvatures()

bool ON_SubDMeshFragment::SetCurvatures ( bool  bLazy) const

Description: Computes curvature values at grid points for this fragment. Note that fragment curvature values are a mutable property and can be set at any time after the fragment's points are set. Parameters: bLazy - [in] If bLazy is true and if CurvaturesExist() is true, then no changes are made. If bLazy is false, the curvature values are unconditionally calculated from the fragment's surface and saved in m_K[]. Returns: True if curvatures are set. False if curvatures cannot be set.

◆ SetCurvaturesExistForExperts()

void ON_SubDMeshFragment::SetCurvaturesExistForExperts ( bool  bSetCurvaturesExist) const

Parameters: bSetCurvaturesExist - [in] True if curvatures exist. False vertex curvatures do not exist or are no longer valid. Note that SetCurvaturesExist(false) and ClearCurvatures() are two ways to do the same thing. Remarks: When curvatures exist, CurvatureCount() = CurvatureCapacity(). When curvatures do not exist, CurvatureCount() = 0. Typically

◆ SetNgonFaceFragmentPackRectCorners()

void ON_SubDMeshFragment::SetNgonFaceFragmentPackRectCorners ( bool  bGridOrder,
const ON_2dPoint  face_pack_rect_corners[4],
ON_2dVector  face_pack_rect_size,
ON_2udex  ngon_grid_size,
ON_2dVector  ngon_sub_pack_rect_size,
ON_2dVector  ngon_sub_pack_rect_delta 
)

Description: This functions sets the pack rect corners on fragments used to render n-gon ON_SubDFaces when n >= 5. When an ON_SubDFace is an n-gon, it is rendered with n ON_SubDMeshFragments. Parameters: bGridOrder = [in] Order for face_pack_rect_corners[]. face_texture_coordinate_corners - [in] The points returned by ON_SubDFace::PackRectCorner(bGridOrder, i) face_pack_rect_size - [in] The n-gon face's ON_SubDFace::PackRectSize() value. ngon_grid_size - [in] ngon_sub_pack_rect_size - [in] ngon_sub_pack_rect_delta - [in] These three parameters are values from ON_SubDFace::GetNgonSubPackRectSizeAndDelta(). ngon_grid_size, ngon_sub_pack_rect_size, and ngon_sub_pack_rect_delta are identical for all the ON_SubDMeshFragments used to render the n-gon face. The value of m_face_fragment_index determines which sub pack rect is assigned to each of the n ON_SubDMeshFragments use to render the n-gon face. Remarks: It is critical that m_face_fragment_count and m_face_fragment_index be set correctly before calling this function. A ON_SubDMeshFragment used to render an n-gon ON_SubDFace has m_face_fragment_count = n and m_face_fragment_index = 0, ..., n-1.

◆ SetNgonFaceFragmentTextureCoordinateCorners()

void ON_SubDMeshFragment::SetNgonFaceFragmentTextureCoordinateCorners ( bool  bGridOrder,
const ON_3dPoint  face_texture_coordinate_corners[4],
ON_2dVector  face_pack_rect_size,
ON_2udex  ngon_grid_size,
ON_2dVector  ngon_sub_pack_rect_size,
ON_2dVector  ngon_sub_pack_rect_delta,
bool  bSetTextureCoordinates 
) const

Description: When an ON_SubDFace is an n-gon with n >= 5, it is rendered with n ON_SubDMeshFragments. This functions sets the texture coordinates on those fragments.
Parameters: bGridOrder = [in] Order for face_pack_rect_corners[]. face_texture_coordinate_corners - [in] The points returned by ON_SubDFace::TextureCoordinateCorner(bGridOrder, i, false) face_pack_rect_size - [in] The n-gon face's ON_SubDFace::PackRectSize() value. ngon_grid_size - [in] ngon_sub_pack_rect_size - [in] ngon_sub_pack_rect_delta - [in] These three parameters are values from ON_SubDFace::GetNgonSubPackRectSizeAndDelta(). ngon_grid_size, ngon_sub_pack_rect_size, and ngon_sub_pack_rect_delta are identical for all the ON_SubDMeshFragments used to render the n-gon face. The value of m_face_fragment_index determines which sub pack rect is assigned to each of the n ON_SubDMeshFragments use to render the n-gon face. Remarks: It is critical that m_face_fragment_count and m_face_fragment_index be set correctly before calling this function. A ON_SubDMeshFragment used to render an n-gon ON_SubDFace has m_face_fragment_count = n and m_face_fragment_index = 0, ..., n-1.

◆ SetPackedTextureCoordinates()

void ON_SubDMeshFragment::SetPackedTextureCoordinates ( ) const

Description: Set the texture coordinates in m_T[] from the values in m_pack_rect[].

◆ SetPackRectCornersForExperts()

void ON_SubDMeshFragment::SetPackRectCornersForExperts ( bool  bGridOrder,
const ON_2dPoint  fragment_pack_rect_corners[4] 
)

◆ SetQuadOr3gonFaceFragmentPackRectCorners()

void ON_SubDMeshFragment::SetQuadOr3gonFaceFragmentPackRectCorners ( bool  bGridOrder,
const ON_2dPoint  face_pack_rect_corners[4] 
)

Description: This functions sets the pack rect corners on fragments used to render quad and 3-gon ON_SubDFaces. When an ON_SubDFace is a quad, it is rendered with one ON_SubDMeshFragment. When an ON_SubDFace is a 3-gon, it is rendered with three ON_SubDMeshFragments. Remarks: It is critical that m_face_fragment_count and m_face_fragment_index be set correctly before calling this function. A ON_SubDMeshFragment used to render a quad ON_SubDFace has m_face_fragment_count = 1 and m_face_fragment_index = 0. A ON_SubDMeshFragment used to render a 3-gon ON_SubDFace has m_face_fragment_count = 3 and m_face_fragment_index = 0, 1 or 2.

◆ SetQuadOr3gonFaceFragmentTextureCoordinateCorners()

void ON_SubDMeshFragment::SetQuadOr3gonFaceFragmentTextureCoordinateCorners ( bool  bGridOrder,
const ON_3dPoint  face_texture_coordinate_corners[4],
bool  bSetTextureCoordinates 
) const

Description: This functions sets the texture coordinates on fragments used to render quad and 3-gon ON_SubDFaces. A quad ON_SubDFace is rendered with one ON_SubDMeshFragment. A 3-gon ON_SubDFace is rendered with three ON_SubDMeshFragments. Remarks: It is critical that m_face_fragment_count and m_face_fragment_index be set correctly before calling this function. A ON_SubDMeshFragment used to render a quad ON_SubDFace has m_face_fragment_count = 1 and m_face_fragment_index = 0. A ON_SubDMeshFragment used to render a 3-gon ON_SubDFace has m_face_fragment_count = 3 and m_face_fragment_index = 0, 1 or 2.

◆ SetTextureCoordinateCornersForExperts()

void ON_SubDMeshFragment::SetTextureCoordinateCornersForExperts ( bool  bGridOrder,
const ON_3dPoint  fragment_texture_coordinate_corners[4],
bool  bSetTextureCoordinates 
) const

Description: Sets the values of each fragment's m_ctrlnetT[] member. Parameters: bSetTextureCoordinates If true, the texture coordinate corners are used ti set the fragment's m_T[] values after m_ctrlnetT[] is set.

◆ SetTextureCoordinatesExistForExperts()

void ON_SubDMeshFragment::SetTextureCoordinatesExistForExperts ( bool  bTextureCoordinatesExist) const

◆ SetTextureCoordinatesFromCorners()

void ON_SubDMeshFragment::SetTextureCoordinatesFromCorners ( ) const

Description: Set the texture coordinates in m_T[] from the values in m_ctrlnetT[].

◆ SetUnmanagedVertexCapacityForExperts()

bool ON_SubDMeshFragment::SetUnmanagedVertexCapacityForExperts ( size_t  vertex_capacity)

Description: Sets number of fragment vertices available (number of elements available in the m_P[], m_N[], m_T[], m_K[], and m_C[] arrays). The memory for the arrays is managed by something besides this ON_SubDMeshFragment instance. Parameters: vertex_capacity - [in] A value no larger than ON_SubDMeshFragment::MaximumVertexCount. Returns: True if successful

◆ SetUnpackedTextureCoordinates()

void ON_SubDMeshFragment::SetUnpackedTextureCoordinates ( ) const

Description: Set the this fragments texture coordinates in m_T[] to cover (0,1)x(0,1)

◆ SetVertexCount()

bool ON_SubDMeshFragment::SetVertexCount ( size_t  vertex_count)

Description: Sets number of fragment vertices being used (number of elements being used in the m_P[], m_N[], and m_T[] arrays). Parameters: vertex_count - [in] A value no larger than ON_SubDMeshFragment::MaximumVertexCount.

◆ SetVertexTextureCoordinate() [1/3]

bool ON_SubDMeshFragment::SetVertexTextureCoordinate ( ON_2udex  grid2dex,
ON_3dPoint  texture_coordinate 
) const

◆ SetVertexTextureCoordinate() [2/3]

bool ON_SubDMeshFragment::SetVertexTextureCoordinate ( unsigned  grid2dex_i,
unsigned  grid2dex_j,
ON_3dPoint  texture_coordinate 
) const

Description: Set the texture coordinate for the specified fragment grid point. Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() unsigned texture_coordinate_dimension - [in] 2 or 3 texture_coordinate - [in] Texture coordinates are mutable and are often modified on an otherwise const fragment. Returns: True if input was valid and the texture coordinate was set.

◆ SetVertexTextureCoordinate() [3/3]

bool ON_SubDMeshFragment::SetVertexTextureCoordinate ( unsigned  grid_point_index,
ON_3dPoint  texture_coordinate 
) const

◆ SideFrame()

const ON_Plane ON_SubDMeshFragment::SideFrame ( unsigned int  grid_side_index) const

Parameters: grid_side_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Limit surface frame at the grid corner or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ SideNormal()

const ON_3dVector ON_SubDMeshFragment::SideNormal ( unsigned int  grid_side_index) const

Parameters: grid_side_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Limit surface normal at the grid corner or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ SidePoint()

const ON_3dPoint ON_SubDMeshFragment::SidePoint ( unsigned int  grid_side_index) const

Parameters: grid_side_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Limit surface location at the midde of the grid side or ON_3dPoint::NanPoint if the fragment is empty. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ SidePointCountFromSideCount()

static unsigned int ON_SubDMeshFragment::SidePointCountFromSideCount ( unsigned int  side_segment_count)
static

Returns: If side_segment_count is valid, then (side_segment_count+1) is returned. Otherwise 0 is returned.

◆ SideSegmentCountFromDisplayDensity()

static unsigned int ON_SubDMeshFragment::SideSegmentCountFromDisplayDensity ( unsigned int  display_density)
static

Returns: side_segment_count = 2^display_density

◆ SideSegmentCountIsValid()

static bool ON_SubDMeshFragment::SideSegmentCountIsValid ( unsigned int  side_segment_count)
static

Returns: true if side_segment_count is valid. Otherwise 0 is returned.

◆ SizeofFragment()

static size_t ON_SubDMeshFragment::SizeofFragment ( unsigned int  display_density)
static

Parameters: display_density - [in] Determines grid size bCurvatureArray - [in] true to include room for the m_K[] array. Returns: Amount of memory needed for the fragment, the m_P[], m_N[], m_T[], m_C[], and m_K[] arrays.

◆ Status()

ON_ComponentStatus ON_SubDMeshFragment::Status ( ) const

Returns: Status of the face.

◆ SubDEdge()

const class ON_SubDEdge* ON_SubDMeshFragment::SubDEdge ( unsigned int  grid_side_index) const

◆ SubDEdgePtr()

const class ON_SubDEdgePtr ON_SubDMeshFragment::SubDEdgePtr ( unsigned int  grid_side_index) const

Parameters: grid_side_index - [in] 0 to 3 for quad grids. 0 to 2 for tri grids Returns: The subd edge that is on the identified side of the grid.

◆ SubDFace()

const class ON_SubDFace* ON_SubDMeshFragment::SubDFace ( ) const

◆ SubDVertex()

const class ON_SubDVertex* ON_SubDMeshFragment::SubDVertex ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] 0, 1, 2, or 3 Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ SubDVertexPtr()

const class ON_SubDVertexPtr ON_SubDMeshFragment::SubDVertexPtr ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] 0, 1, 2, or 3 Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ SurfaceBoundingBox()

const ON_BoundingBox ON_SubDMeshFragment::SurfaceBoundingBox ( ) const

◆ TextureCoordinateArray()

const double* ON_SubDMeshFragment::TextureCoordinateArray ( ON_SubDComponentLocation  subd_appearance) const

◆ TextureCoordinateArrayCount()

unsigned ON_SubDMeshFragment::TextureCoordinateArrayCount ( ON_SubDComponentLocation  subd_appearance) const

◆ TextureCoordinateArrayStride()

size_t ON_SubDMeshFragment::TextureCoordinateArrayStride ( ON_SubDComponentLocation  subd_appearance) const

◆ TextureCoordinateCapacity()

unsigned int ON_SubDMeshFragment::TextureCoordinateCapacity ( ) const

◆ TextureCoordinateCorner()

const ON_3dPoint ON_SubDMeshFragment::TextureCoordinateCorner ( unsigned int  grid_corner_index) const

Parameters: grid_corner_index - [in] grid side N is between corner index N and corner index (N+1)%4. Returns: Texture coordinate at that corner. Remarks: For partial fragments (IsFaceCornerFragment() = true), grid_corner_index = 2 is the only corner that corresponds to a SubD vertex. For partial fragments (IsFaceCornerFragment() = true), grid_side_index = 1 and grid_side_index = 2 correspond to half of original SuD edges.

◆ TextureCoordinateCount()

unsigned int ON_SubDMeshFragment::TextureCoordinateCount ( ) const

Returns: If grid texture coordinates are available, then VertexCount() is returned. Otherwise 0 is returned.

◆ TextureCoordinatesExistForExperts()

bool ON_SubDMeshFragment::TextureCoordinatesExistForExperts ( ) const

◆ Transform() [1/2]

bool ON_SubDMeshFragment::Transform ( bool  bKeepTextures,
bool  bKeepCurvatures,
bool  bKeepColors,
const ON_Xform xform 
)

Parameters
bKeepTextures
bKeepCurvatures
bKeepColors
xform
Returns

◆ Transform() [2/2]

bool ON_SubDMeshFragment::Transform ( const ON_Xform xform)

This simple version transforms the points and normals and unconditionally makes no changes to the curvatures, texture coordinates and colors.

Typically lots of fragments are being transformed and the type and context of the transformation determines if texture coordinate, curvature and color inforation should be preserved or destroyed. It is better to determine the answers to these questions and call the version of Transform with the bKeepTextures, bKeepCurvatures and bKeepColors parameters. For example if the transformation is an isometry and the colors are set from the curvatures, then curvatures and colors should be kept. If the transformation is not an isometry, the curvatures should be destroyed. If the texture coordinates are set from grid location (fake surface paramaters), the the texture coordinates should be kept. If transform is not an identity and the texture coordinates come from a world object mapping, the should generally be destroyed.

Parameters
xform
Returns

◆ UnmanagedArrays()

bool ON_SubDMeshFragment::UnmanagedArrays ( ) const

Returns: True if the memory in the m_P[], m_N[], m_T[], m_K[], and m_C[] arrays is managed by something besides this ON_SubDMeshFragment instance.

◆ UnsetControlNetQuad()

void ON_SubDMeshFragment::UnsetControlNetQuad ( )

◆ VertexCapacity()

unsigned ON_SubDMeshFragment::VertexCapacity ( ) const

Returns: Capactity for vertices in the mesh fragment grid. VertexCapacity() should be >= VertexCount(). VertexCount() should be identical to m_grid.PointCount().

◆ VertexColor() [1/3]

const ON_Color ON_SubDMeshFragment::VertexColor ( ON_2udex  grid2dex) const

◆ VertexColor() [2/3]

const ON_Color ON_SubDMeshFragment::VertexColor ( unsigned  grid2dex_i,
unsigned  grid2dex_j 
) const

Description: Get the per vertex color assigned to the specified fragment grid point. Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() Returns: The colo for the specified fragment grid point. When per vertex colors are not set, ON_Color::Unset is returned.

◆ VertexColor() [3/3]

const ON_Color ON_SubDMeshFragment::VertexColor ( unsigned  grid_point_index) const

◆ VertexCount()

unsigned ON_SubDMeshFragment::VertexCount ( ) const

Returns: Number of vertices in the mesh fragment grid. VertexCount() should be identical to m_grid.GridPointCount(). VertexCapacity() should be >= VertexCount().

◆ VertexCurvature() [1/3]

const ON_SurfaceCurvature ON_SubDMeshFragment::VertexCurvature ( ON_2udex  grid2dex) const

◆ VertexCurvature() [2/3]

const ON_SurfaceCurvature ON_SubDMeshFragment::VertexCurvature ( unsigned  grid2dex_i,
unsigned  grid2dex_j 
) const

Description: Get the principal surface curvature for the specified fragment grid point. Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() Returns: The principal surface curvature for the specified fragment grid point. When curvatures are not set, ON_SurfaceCurvature::Nan is returned.

◆ VertexCurvature() [3/3]

const ON_SurfaceCurvature ON_SubDMeshFragment::VertexCurvature ( unsigned  grid_point_index) const

◆ VertexNormal() [1/3]

const ON_3dVector ON_SubDMeshFragment::VertexNormal ( ON_2udex  grid2dex) const

◆ VertexNormal() [2/3]

const ON_3dVector ON_SubDMeshFragment::VertexNormal ( unsigned  grid2dex_i,
unsigned  grid2dex_j 
) const

Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() Returns:

◆ VertexNormal() [3/3]

const ON_3dVector ON_SubDMeshFragment::VertexNormal ( unsigned  grid_point_index) const

◆ VertexPoint() [1/3]

const ON_3dPoint ON_SubDMeshFragment::VertexPoint ( ON_2udex  grid2dex) const

◆ VertexPoint() [2/3]

const ON_3dPoint ON_SubDMeshFragment::VertexPoint ( unsigned  grid2dex_i,
unsigned  grid2dex_j 
) const

Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() Returns:

◆ VertexPoint() [3/3]

const ON_3dPoint ON_SubDMeshFragment::VertexPoint ( unsigned  grid_point_index) const

◆ VertexTextureCoordinate() [1/3]

const ON_3dPoint ON_SubDMeshFragment::VertexTextureCoordinate ( ON_2udex  grid2dex) const

◆ VertexTextureCoordinate() [2/3]

const ON_3dPoint ON_SubDMeshFragment::VertexTextureCoordinate ( unsigned  grid2dex_i,
unsigned  grid2dex_j 
) const

Description: Get the texture coordinate for the specified fragment grid point. Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() Returns: The texture coordinate for the specified fragment grid point. TextureCoordinateDimension() reports the number of coordinates to set. When it is 2, the z coordinate of the returned point is 0.0.

◆ VertexTextureCoordinate() [3/3]

const ON_3dPoint ON_SubDMeshFragment::VertexTextureCoordinate ( unsigned  grid_point_index) const

◆ VertexTextureCoordinateFromCorners() [1/3]

const ON_3dPoint ON_SubDMeshFragment::VertexTextureCoordinateFromCorners ( ON_2udex  grid2dex) const

◆ VertexTextureCoordinateFromCorners() [2/3]

const ON_3dPoint ON_SubDMeshFragment::VertexTextureCoordinateFromCorners ( unsigned  grid2dex_i,
unsigned  grid2dex_j 
) const

Parameters: grid2dex_i - [in] 0 <= grid2dex_i < m_grid.SidePointCount() grid2dex_j - [in] 0 <= grid2dex_j < m_grid.SidePointCount() Returns: The texture coordinates calculated by iterpolating the m_ctrlnetT[] values.

◆ VertexTextureCoordinateFromCorners() [3/3]

const ON_3dPoint ON_SubDMeshFragment::VertexTextureCoordinateFromCorners ( unsigned  grid_point_index) const

Friends And Related Function Documentation

◆ ON_SubDHeap

friend class ON_SubDHeap
friend

◆ ON_SubDManagedMeshFragment

friend class ON_SubDManagedMeshFragment
friend

◆ ON_SubDMeshImpl

friend class ON_SubDMeshImpl
friend

Member Data Documentation

◆ Empty

const ON_SubDMeshFragment ON_SubDMeshFragment::Empty
static

Every field of ON_SubDMeshFragment::Empty is zero.

◆ m_face

const class ON_SubDFace* ON_SubDMeshFragment::m_face

◆ m_face_fragment_count

unsigned short ON_SubDMeshFragment::m_face_fragment_count

Number of fragments that will be delivered for this face.

◆ m_face_fragment_index

unsigned short ON_SubDMeshFragment::m_face_fragment_index

First fragment has index = 0. Last fragment has index = m_face_fragment_count-1.

◆ m_face_vertex_index

unsigned short ON_SubDMeshFragment::m_face_vertex_index[4]

m_face_vertex_index[] stores the information needed for the Vertex() and Edge() functions to work.

If m_face is nullptr, then m_face_vertex_index[] has no meaning. If m_face is not nullptr and a corner of the grid is on a face vertex, then the corresponding m_face_vertex_index[] value will be <= ON_SubDFace::MaximumEdgeCount and m_face->Vertex(m_face_vertex_index[]) is the vertex. Otherwise, the corresponding m_face_vertex_index[] value will be > ON_SubDFace::MaximumEdgeCount.
Catmull-Clark limit meshes: When the original SubD face is a quad, a full fragment is created and m_face_vertex_index[4] = {0,1,2,3}. When the original SuD face is an N-gon with N != 4, a partial fragment is delivered and m_face_vertex_index[2] identifies the face vertex for that fragment. m_face_vertex_index[0,1,3] = a value > ON_SubDFace::MaximumEdgeCount

◆ m_grid

ON_SubDMeshFragmentGrid ON_SubDMeshFragment::m_grid

Information to resolve m_P[], m_N[], and m_T[] into a grid of NxN quads.

Normalized grid parameters useful for appling a texture to the grid are available from m_grid functions.

◆ m_N

double* ON_SubDMeshFragment::m_N

surface normals

3-dimensional grid vertex surface normals

The m_N[] and m_P[] arrays are parallel. Depending on the strides, m_P[], m_N[], and m_T[] can be separate or interlaced.

If m_N is not nullptr and m_N_stride>0, then m_N[] can accommodate up to m_P_capacity normals. If m_N is not nullptr and m_N_stride=0, then m_N[] can accommodate a single normal (flat shaded polygon face). The stride m_N_stride and memory m_N references is managed by some other class or function. Never modify m_N_stride, m_N, or the values in m_N. Use m_grid functions to get normal indices and quad face indices. Note well: m_N_stride can be 0 when the normal is constant (control net face normal for example).

◆ m_N_stride

size_t ON_SubDMeshFragment::m_N_stride

stride between normals for m_N[] as an array of 8 byte doubles (so 0 or >= 3)

◆ m_next_fragment

ON_SubDMeshFragment* ON_SubDMeshFragment::m_next_fragment

◆ m_P

double* ON_SubDMeshFragment::m_P

surface points

3-dimensional grid vertex points

Depending on the strides, m_P[], m_N[], and m_T[] can be separate or interlaced.

The stride m_P_stride and memory m_P references is managed by some other class or function. Never modify m_P_stride, m_P, or the values in m_P. Use m_grid functions to get point indices and quad face indices.

◆ m_P_stride

size_t ON_SubDMeshFragment::m_P_stride

stride between points for m_P[] as an array of 8 byte doubles (so 0 or >= 3)

◆ m_prev_fragment

ON_SubDMeshFragment* ON_SubDMeshFragment::m_prev_fragment

◆ m_surface_bbox

ON_BoundingBox ON_SubDMeshFragment::m_surface_bbox

3d bounding box of grid vertex points.

◆ m_T

double* ON_SubDMeshFragment::m_T
mutable

3d vertex texture coordinates.

Depending on the strides, m_P[], m_N[], and m_T[] can be separate or interlaced.

If m_T is not nullptr and m_T_stride>0, then m_T[] can accommodate up to m_P_capacity textures coordinates. Otherwise there are no texture coordinates. Never modify m_T_stride, m_T. Use m_grid functions to get texture indices and quad face indices. Note well: m_T_stride can be 0 when the texture coordinate is constant (one color per face for example)

◆ m_T_stride

size_t ON_SubDMeshFragment::m_T_stride
mutable

stride between texture points for m_T[] as an array of 8 byte doubles (so 0 or >= 3)