16 : m_initialized(false),
28 m_minFillIndexes(0, 0, 0),
29 m_numberOfNeighbours(6) {
52 if (absoluteCoordinates) {
55 index =
static_cast<unsigned>(pos.
x + 1) +
79 unsigned char gridLevel) {
92 m_dx =
static_cast<unsigned>(maxFillIndexes[0] - minFillIndexes[0] + 1);
93 m_dy =
static_cast<unsigned>(maxFillIndexes[1] - minFillIndexes[1] + 1);
94 m_dz =
static_cast<unsigned>(maxFillIndexes[2] - minFillIndexes[2] + 1);
113 sqrt(
static_cast<float>(
133 for (std::vector<unsigned>::const_iterator it = list.begin();
134 it != list.end(); ++it) {
173 assert(aCell !=
nullptr);
210 std::size_t minTCellIndexPos = 0;
211 unsigned minTCellIndex =
m_trialCells[minTCellIndexPos];
213 assert(minTCell !=
nullptr);
218 assert(cell !=
nullptr);
220 if (cell->
T < minTCell->
T) {
221 minTCellIndexPos = i;
222 minTCellIndex = cellIndex;
231 return minTCellIndex;
247 T[n] =
static_cast<double>(nCell->
T) +
258 double A = 0, B = 0, C = 0;
259 double Tij =
static_cast<double>(theCell->
T );
267 if (T[n] < Tmin) Tmin = T[n];
281 if (T[n] < Tmin) Tmin = T[n];
295 if (T[n] < Tmin) Tmin = T[n];
307 double delta = B * B - 4.0 * A * C;
310 if (A == 0 || delta < 0) {
314 if (T[n] < Tij) Tij = T[n];
319 Tij = (-B + sqrt(delta)) / (2.0 * A);
322 return static_cast<float>(Tij);
Tuple3Tpl< int > Tuple3i
Tuple of 3 int values.
#define CC_FM_MAX_NUMBER_OF_NEIGHBOURS
The octree structure used throughout the library.
const int * getMaxFillIndexes(unsigned char level) const
static const int MAX_OCTREE_LEVEL
Max octree subdivision level.
const int * getMinFillIndexes(unsigned char level) const
const PointCoordinateType & getCellSize(unsigned char level) const
Returns the octree cells length for a given level of subdivision.
A generic Fast Marching grid cell.
static float T_INF()
Returns infinite time value.
float T
Front arrival time.
virtual void addActiveCell(unsigned index)
Add a cell to the ACTIVE cells list.
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.
virtual float computeT(unsigned index)
Computes the front arrival time at a given cell.
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.
void resetCells(std::vector< unsigned > &list)
Resets the state of cells in a given list.
unsigned m_indexShift
First index of innerbound grid.
virtual float getTime(Tuple3i &pos, bool absoluteCoordinates=false) const
Returns the front arrival time at a given cell.
Tuple3i m_minFillIndexes
Octree min fill indexes at 'm_gridLevel'.
virtual void addTrialCell(unsigned index)
Add a cell to the TRIAL cells list.
float m_neighboursDistance[26]
Neighbours distance weight.
unsigned m_gridSize
Grid size.
virtual ~FastMarching()
Destructor.
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)
FastMarching()
Default constructor.
std::vector< unsigned > m_ignoredCells
IGNORED cells lits.
virtual int initGridWithOctree(DgmOctree *octree, unsigned char gridLevel)
virtual void initTrialCells()
Initializes the TRIAL cells list.
unsigned m_sliceSize
Shift for cell access acceleration (Z dimension)
virtual int initGrid(float step, unsigned dim[3])
Intializes the grid with a given step and dimensions.
virtual bool setSeedCell(const Tuple3i &pos)
Sets a given cell as "seed".
unsigned m_numberOfNeighbours
Current number of neighbours (6 or 26)
virtual void addIgnoredCell(unsigned index)
Add a cell to the IGNORED cells list.
virtual unsigned getNearestTrialCell()
Returns the TRIAL cell with the smallest front arrival time.
int m_neighboursIndexShift[26]
Neighbours coordinates shifts in grid.
virtual int step()=0
Propagates the front (one step)
virtual void cleanLastPropagation()
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.