26 #define CC_FM_MAX_NUMBER_OF_NEIGHBOURS 26
30 0, -1, 0, 1, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 1,
32 -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, 0, -1, -1, 0, 1, -1, 1, -1, -1, 1,
33 0, -1, 1, 1, 0, -1, -1, 0, -1, 1, 0, 1, -1, 0, 1, 1, 1, -1, -1, 1, -1,
34 0, 1, -1, 1, 1, 0, -1, 1, 0, 1, 1, 1, -1, 1, 1, 0, 1, 1, 1};
53 virtual bool setSeedCell(
const Tuple3i& pos);
65 virtual void cleanLastPropagation();
76 virtual float getTime(
Tuple3i& pos,
bool absoluteCoordinates =
false)
const;
82 m_numberOfNeighbours = state ? 26 : 6;
88 return static_cast<unsigned>(pos.
x - m_minFillIndexes.x) +
89 static_cast<unsigned>(pos.
y - m_minFillIndexes.y) * m_rowSize +
90 static_cast<unsigned>(pos.
z - m_minFillIndexes.z) * m_sliceSize +
98 inline static float T_INF() {
return FLT_MAX; }
109 Cell() : state(FAR_CELL), T(T_INF()) {}
127 virtual int initGridWithOctree(
DgmOctree*
octree,
unsigned char gridLevel);
134 virtual int initGrid(
float step,
unsigned dim[3]);
138 virtual int initOther();
145 virtual float computeT(
unsigned index);
153 Cell* neighbourCell)
const = 0;
163 virtual void initTrialCells();
175 if (m_theGrid)
return false;
177 T** grid =
new T*[
size];
178 if (!grid)
return false;
179 memset(grid, 0,
size *
sizeof(T*));
181 m_theGrid =
reinterpret_cast<Cell**
>(grid);
189 virtual void addTrialCell(
unsigned index);
194 virtual void addActiveCell(
unsigned index);
199 virtual void addIgnoredCell(
unsigned index);
204 virtual unsigned getNearestTrialCell();
209 void resetCells(std::vector<unsigned>& list);
#define CC_FM_MAX_NUMBER_OF_NEIGHBOURS
The octree structure used throughout the library.
A generic Fast Marching grid cell.
Cell()
Default constructor.
virtual ~Cell()=default
Virtual destructor.
static float T_INF()
Returns infinite time value.
STATE
Possible states of a Fast Marching grid cell.
float T
Front arrival time.
Fast Marching algorithm (front propagation)
virtual int propagate()=0
Propagates the front.
float m_cellSize
Octree cell size at equivalent subdivision level.
unsigned pos2index(const Tuple3i &pos) const
Cell ** m_theGrid
Grid used to process Fast Marching.
unsigned m_dx
Grid size along the X dimension.
DgmOctree * m_octree
Associated octree.
std::vector< unsigned > m_activeCells
ACTIVE cells list.
unsigned char m_gridLevel
Equivalent octree subdivision level.
virtual bool instantiateGrid(unsigned size)=0
Instantiates grid in memory.
bool m_initialized
Specifiies whether structure is initialized or not.
unsigned m_indexShift
First index of innerbound grid.
Tuple3i m_minFillIndexes
Octree min fill indexes at 'm_gridLevel'.
unsigned m_gridSize
Grid size.
std::vector< unsigned > m_trialCells
TRIAL cells list.
virtual float computeTCoefApprox(Cell *currentCell, Cell *neighbourCell) const =0
Computes the front acceleration between two cells.
unsigned m_dz
Grid size along the Z dimension.
unsigned m_rowSize
Shift for cell access acceleration (Y dimension)
virtual void setExtendedConnectivity(bool state)
Sets extended connectivity mode.
std::vector< unsigned > m_ignoredCells
IGNORED cells lits.
unsigned m_sliceSize
Shift for cell access acceleration (Z dimension)
bool instantiateGridTpl(unsigned size)
Grid instantiation helper.
unsigned m_numberOfNeighbours
Current number of neighbours (6 or 26)
virtual int step()=0
Propagates the front (one step)
unsigned m_dy
Grid size along the Y dimension.
Generic file read and write utility for python interface.
const int c_FastMarchingNeighbourPosShift[]
Grid neighboring cells positions.