24static_assert(
sizeof(
OutEdge2 ) == 1 );
31 return map[ (size_t)e + 1 ];
34static constexpr int OutEdge2Count = 4;
45 Vector2i
toPos( PixelId
id )
const { assert(
id.valid() );
return toPos(
size_t(
int(
id ) ) ); }
46 Vector2i
toPos(
size_t id )
const;
47 PixelId
toPixelId(
const Vector2i & pos )
const {
return PixelId{ int(
toIndex( pos ) ) }; }
48 size_t toIndex(
const Vector2i & pos )
const;
51 bool areNeigbors(
const Vector2i & pos0,
const Vector2i & pos1 )
const {
return ( pos0 - pos1 ).lengthSq() == 1; }
74 int y = int(
id) /
dims_.x;
75 int x = int(
id) %
dims_.x;
81 return pos.x + pos.y * size_t(
dims_.x);
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
a class for converting 2D integer coordinates into 1D linear coordinates and backward
Definition MRRectIndexer.h:38
PixelId getNeighbor(PixelId v, OutEdge2 toNei) const
returns id of v's neighbor specified by the edge
Definition MRRectIndexer.h:53
const Vector2i & dims() const
Definition MRRectIndexer.h:43
bool areNeigbors(PixelId v0, PixelId v1) const
returns true if v1 is within at most 4 neighbors of v0
Definition MRRectIndexer.h:50
constexpr RectIndexer() noexcept=default
PixelId toPixelId(const Vector2i &pos) const
Definition MRRectIndexer.h:47
bool areNeigbors(const Vector2i &pos0, const Vector2i &pos1) const
Definition MRRectIndexer.h:51
Vector2i toPos(PixelId id) const
Definition MRRectIndexer.h:45
Vector2i dims_
Definition MRRectIndexer.h:57
size_t size() const
Definition MRRectIndexer.h:44
MRMESH_API PixelId getNeighbor(PixelId v, const Vector2i &pos, OutEdge2 toNei) const
size_t size_
= dims_.x * dims_.y
Definition MRRectIndexer.h:58
MRMESH_API void expandPixelMask(PixelBitSet &mask, const RectIndexer &indexer, int expansion=1)
expands PixelBitSet with given number of steps
void resize(const Vector2i &dims)
Definition MRRectIndexer.h:66
OutEdge2 opposite(OutEdge2 e)
Definition MRRectIndexer.h:28
OutEdge2
Definition MRRectIndexer.h:15
MRMESH_API void shrinkPixelMask(PixelBitSet &mask, const RectIndexer &indexer, int shrinkage=1)
shrinks PixelBitSet with given number of steps
size_t toIndex(const Vector2i &pos) const
Definition MRRectIndexer.h:79
Definition MRCameraOrientationPlugin.h:8