MeshLib Python Docs
Loading...
Searching...
No Matches
meshlib.mrmeshpy.DistanceMap Class Reference
+ Inheritance diagram for meshlib.mrmeshpy.DistanceMap:

Public Member Functions

None __init__ (self)
 
None __init__ (self, int resX, int resY)
 
None __init__ (self, Matrix_float m)
 
None __init__ (self, DistanceMap arg0)
 
DistanceMap __isub__ (self, DistanceMap rhs)
 
DistanceMap __sub__ (self, DistanceMap rhs)
 
None clear (self)
 
float data (self)
 
float data (self)
 
float get (self, int x, int y)
 
float get (self, int i)
 
DistanceMap getDerivativeMap (self)
 
float getInterpolated (self, float x, float y)
 
std_vector_std_pair_unsigned_long_unsigned_long getLocalMaximums (self)
 
tuple[int, int] getMaxIndex (self)
 
tuple[int, int] getMinIndex (self)
 
tuple[float, float] getMinMaxValues (self)
 
float getValue (self, int x, int y)
 
float getValue (self, int x, int y)
 
float getValue (self, int i)
 
float getValue (self, int i)
 
tuple[DistanceMap, DistanceMapgetXYDerivativeMaps (self)
 
int heapBytes (self)
 
None invalidateAll (self)
 
bool isInBounds (self, int x, int y)
 
bool isInBounds (self, int i)
 
bool isValid (self, int x, int y)
 
bool isValid (self, int i)
 
DistanceMap max (self, DistanceMap rhs)
 
DistanceMap mergeMax (self, DistanceMap rhs)
 
DistanceMap mergeMin (self, DistanceMap rhs)
 
DistanceMap min (self, DistanceMap rhs)
 
None negate (self)
 
int numPoints (self)
 
int resX (self)
 
int resY (self)
 
None set (self, int x, int y, float val)
 
None set (self, int i, float val)
 
None set (self, std_vector_float data)
 
Vector3f unproject (self, int x, int y, AffineXf3f toWorld)
 
Vector3f unprojectInterpolated (self, float x, float y, AffineXf3f toWorld)
 
None unset (self, int x, int y)
 
None unset (self, int i)
 
- Public Member Functions inherited from meshlib.mrmeshpy.RectIndexer
bool areNeigbors (self, PixelId v0, PixelId v1)
 
bool areNeigbors (self, Vector2i pos0, Vector2i pos1)
 
Vector2i dims (self)
 
PixelId getNeighbor (self, PixelId v, OutEdge2 toNei)
 
PixelId getNeighbor (self, PixelId v, Vector2i pos, OutEdge2 toNei)
 
None resize (self, Vector2i dims)
 
int size (self)
 
int toIndex (self, Vector2i pos)
 
PixelId toPixelId (self, Vector2i pos)
 
Vector2i toPos (self, PixelId id)
 
Vector2i toPos (self, int id)
 

Detailed Description

Generated from:  MR::DistanceMap

this class allows to store distances from the plane in particular pixels
validVerts keeps only pixels with mesh-intersecting rays from them

Constructor & Destructor Documentation

◆ __init__() [1/4]

None meshlib.mrmeshpy.DistanceMap.__init__ ( self)

Reimplemented from meshlib.mrmeshpy.RectIndexer.

◆ __init__() [2/4]

None meshlib.mrmeshpy.DistanceMap.__init__ ( self,
int resX,
int resY )
Preferable constructor with resolution arguments
Access by the index (i) is equal to (y*resX + x)

Reimplemented from meshlib.mrmeshpy.RectIndexer.

◆ __init__() [3/4]

None meshlib.mrmeshpy.DistanceMap.__init__ ( self,
Matrix_float m )
make from 2d array

Reimplemented from meshlib.mrmeshpy.RectIndexer.

◆ __init__() [4/4]

None meshlib.mrmeshpy.DistanceMap.__init__ ( self,
DistanceMap arg0 )
Implicit copy constructor.

Reimplemented from meshlib.mrmeshpy.RectIndexer.

Member Function Documentation

◆ __isub__()

DistanceMap meshlib.mrmeshpy.DistanceMap.__isub__ ( self,
DistanceMap rhs )
replaces values with cell-wise subtracted values. Invalid values remain only if both corresponding cells are invalid

◆ __sub__()

DistanceMap meshlib.mrmeshpy.DistanceMap.__sub__ ( self,
DistanceMap rhs )
returns new Distance Map with cell-wise subtracted values. Invalid values remain only if both corresponding cells are invalid

◆ clear()

None meshlib.mrmeshpy.DistanceMap.clear ( self)
clears data, sets resolutions to zero

◆ data() [1/2]

float meshlib.mrmeshpy.DistanceMap.data ( self)

◆ data() [2/2]

float meshlib.mrmeshpy.DistanceMap.data ( self)

◆ get() [1/2]

float meshlib.mrmeshpy.DistanceMap.get ( self,
int i )
returns value of index element, returns nullopt if not valid (see `isValid()`), UB if out of bounds.

◆ get() [2/2]

float meshlib.mrmeshpy.DistanceMap.get ( self,
int x,
int y )
returns value in (X,Y) element, returns nullopt if not valid (see `isValid()`), UB if out of bounds.

◆ getDerivativeMap()

DistanceMap meshlib.mrmeshpy.DistanceMap.getDerivativeMap ( self)
returns new derivatives map without directions

◆ getInterpolated()

float meshlib.mrmeshpy.DistanceMap.getInterpolated ( self,
float x,
float y )
 \\brief finds interpolated value.
 \\details https://en.wikipedia.org/wiki/Bilinear_interpolation
 getInterpolated( 0.5f, 0.5f ) == get( 0, 0 )
 see https://docs.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-coordinates for details
 all 4 elements around this point should be valid, returns nullopt if at least one is not valid
 \\param x,y should be in resolution range [0;resX][0;resY].
 If x,y are out of bounds, returns nullopt.

◆ getLocalMaximums()

std_vector_std_pair_unsigned_long_unsigned_long meshlib.mrmeshpy.DistanceMap.getLocalMaximums ( self)
computes single derivative map from XY spaces combined. Returns local maximums then

◆ getMaxIndex()

tuple[int, int] meshlib.mrmeshpy.DistanceMap.getMaxIndex ( self)
finds maximum value X,Y
returns [-1.-1] if all values are invalid

◆ getMinIndex()

tuple[int, int] meshlib.mrmeshpy.DistanceMap.getMinIndex ( self)
finds minimum value X,Y
returns [-1.-1] if all values are invalid

◆ getMinMaxValues()

tuple[float, float] meshlib.mrmeshpy.DistanceMap.getMinMaxValues ( self)
finds minimum and maximum values
returns min_float and max_float if all values are invalid

◆ getValue() [1/4]

float meshlib.mrmeshpy.DistanceMap.getValue ( self,
int i )

◆ getValue() [2/4]

float meshlib.mrmeshpy.DistanceMap.getValue ( self,
int i )

◆ getValue() [3/4]

float meshlib.mrmeshpy.DistanceMap.getValue ( self,
int x,
int y )
returns value in (X,Y) element without check on valid
use this only if you sure that distance map has no invalid values or for serialization

◆ getValue() [4/4]

float meshlib.mrmeshpy.DistanceMap.getValue ( self,
int x,
int y )

◆ getXYDerivativeMaps()

tuple[DistanceMap, DistanceMap] meshlib.mrmeshpy.DistanceMap.getXYDerivativeMaps ( self)
returns new derivative maps with X and Y axes direction

◆ heapBytes()

int meshlib.mrmeshpy.DistanceMap.heapBytes ( self)
returns the amount of memory this object occupies on heap

◆ invalidateAll()

None meshlib.mrmeshpy.DistanceMap.invalidateAll ( self)
invalidates all elements

◆ isInBounds() [1/2]

bool meshlib.mrmeshpy.DistanceMap.isInBounds ( self,
int i )
Returns true if a flattened coordinate is in bounds.

◆ isInBounds() [2/2]

bool meshlib.mrmeshpy.DistanceMap.isInBounds ( self,
int x,
int y )
Returns true if (X,Y) coordinates are in bounds.

◆ isValid() [1/2]

bool meshlib.mrmeshpy.DistanceMap.isValid ( self,
int i )
checks if index element is valid (i.e. not `std::numeric_limits<float>::lowest()`; passing an invalid coord to this is UB)

◆ isValid() [2/2]

bool meshlib.mrmeshpy.DistanceMap.isValid ( self,
int x,
int y )
checks if X,Y element is valid (i.e. not `std::numeric_limits<float>::lowest()`; passing invalid coords to this is UB)

◆ max()

DistanceMap meshlib.mrmeshpy.DistanceMap.max ( self,
DistanceMap rhs )
boolean operators
returns new Distance Map with cell-wise maximum values. Invalid values remain only if both corresponding cells are invalid

◆ mergeMax()

DistanceMap meshlib.mrmeshpy.DistanceMap.mergeMax ( self,
DistanceMap rhs )
replaces values with cell-wise maximum values. Invalid values remain only if both corresponding cells are invalid

◆ mergeMin()

DistanceMap meshlib.mrmeshpy.DistanceMap.mergeMin ( self,
DistanceMap rhs )
replaces values with cell-wise minimum values. Invalid values remain only if both corresponding cells are invalid

◆ min()

DistanceMap meshlib.mrmeshpy.DistanceMap.min ( self,
DistanceMap rhs )
returns new Distance Map with cell-wise minimum values. Invalid values remain only if both corresponding cells are invalid

◆ negate()

None meshlib.mrmeshpy.DistanceMap.negate ( self)
replaces every valid element in the map with its negative value

◆ numPoints()

int meshlib.mrmeshpy.DistanceMap.numPoints ( self)
returns the number of pixels

◆ resX()

int meshlib.mrmeshpy.DistanceMap.resX ( self)
returns X resolution

◆ resY()

int meshlib.mrmeshpy.DistanceMap.resY ( self)
returns Y resolution

◆ set() [1/3]

None meshlib.mrmeshpy.DistanceMap.set ( self,
int i,
float val )
sets value in index element (the coord must be valid, UB otherwise)

◆ set() [2/3]

None meshlib.mrmeshpy.DistanceMap.set ( self,
int x,
int y,
float val )
sets value in (X,Y) element (the coords must be valid, UB otherwise)

◆ set() [3/3]

None meshlib.mrmeshpy.DistanceMap.set ( self,
std_vector_float data )
sets all values at one time

◆ unproject()

Vector3f meshlib.mrmeshpy.DistanceMap.unproject ( self,
int x,
int y,
AffineXf3f toWorld )
finds 3d coordinates of the Point on the model surface for the (x,y) pixel
Use the same params with distance map creation
(x,y) must be in bounds, the behavior is undefined otherwise.

◆ unprojectInterpolated()

Vector3f meshlib.mrmeshpy.DistanceMap.unprojectInterpolated ( self,
float x,
float y,
AffineXf3f toWorld )
 \\brief finds 3d coordinates of the Point on the model surface for the (x,y) interpolated value
 \\param x,y should be in resolution range [0;resX][0;resY].
 \\details getInterpolated( 0.5f, 0.5f ) == get( 0, 0 )
 see https://docs.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-coordinates for details
 all 4 elements around this point should be valid, returns nullopt if at least one is not valid
 If x,y are out of bounds, returns nullopt.

◆ unset() [1/2]

None meshlib.mrmeshpy.DistanceMap.unset ( self,
int i )
invalidates value in index element (the coord must be valid, UB otherwise)

◆ unset() [2/2]

None meshlib.mrmeshpy.DistanceMap.unset ( self,
int x,
int y )
invalidates value in (X,Y) element (the coords must be valid, UB otherwise)

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