MeshLib Documentation
Loading...
Searching...
No Matches
MR::RectIndexer Class Reference

a class for converting 2D integer coordinates into 1D linear coordinates and backward More...

#include <MRRectIndexer.h>

+ Inheritance diagram for MR::RectIndexer:

Public Member Functions

constexpr RectIndexer () noexcept=default
 
 RectIndexer (const Vector2i &dims)
 
void resize (const Vector2i &dims)
 
const Vector2i & dims () const
 
size_t size () const
 
Vector2i toPos (PixelId id) const
 
Vector2i toPos (size_t id) const
 
PixelId toPixelId (const Vector2i &pos) const
 
size_t toIndex (const Vector2i &pos) const
 
bool areNeigbors (PixelId v0, PixelId v1) const
 returns true if v1 is within at most 4 neighbors of v0
 
bool areNeigbors (const Vector2i &pos0, const Vector2i &pos1) const
 
PixelId getNeighbor (PixelId v, OutEdge2 toNei) const
 returns id of v's neighbor specified by the edge
 
MRMESH_API PixelId getNeighbor (PixelId v, const Vector2i &pos, OutEdge2 toNei) const
 

Protected Attributes

Vector2i dims_
 
size_t size_ = 0
 = dims_.x * dims_.y
 

Detailed Description

a class for converting 2D integer coordinates into 1D linear coordinates and backward

Constructor & Destructor Documentation

◆ RectIndexer()

MR::RectIndexer::RectIndexer ( )
constexprdefaultnoexcept

Member Function Documentation

◆ areNeigbors() [1/2]

bool MR::RectIndexer::areNeigbors ( const Vector2i & pos0,
const Vector2i & pos1 ) const
inline

◆ areNeigbors() [2/2]

bool MR::RectIndexer::areNeigbors ( PixelId v0,
PixelId v1 ) const
inline

returns true if v1 is within at most 4 neighbors of v0

◆ dims()

const Vector2i & MR::RectIndexer::dims ( ) const
inline

◆ getNeighbor() [1/2]

MRMESH_API PixelId MR::RectIndexer::getNeighbor ( PixelId v,
const Vector2i & pos,
OutEdge2 toNei ) const

◆ getNeighbor() [2/2]

PixelId MR::RectIndexer::getNeighbor ( PixelId v,
OutEdge2 toNei ) const
inline

returns id of v's neighbor specified by the edge

◆ size()

size_t MR::RectIndexer::size ( ) const
inline

◆ toPixelId()

PixelId MR::RectIndexer::toPixelId ( const Vector2i & pos) const
inline

◆ toPos()

Vector2i MR::RectIndexer::toPos ( PixelId id) const
inline

Member Data Documentation

◆ dims_

Vector2i MR::RectIndexer::dims_
protected

◆ size_

size_t MR::RectIndexer::size_ = 0
protected

= dims_.x * dims_.y


The documentation for this class was generated from the following file: