Navigation Functions

Function to navigate and query blocks within a block model, including locating by coordinates, iterating, and retrieving block positions or extents.

MTK_BlockModel_FindWorldXyz()

Locate block with world coordinates supplied. Note that this will nullify the current selection.

Signature
int MTK_BlockModel_FindWorldXyz(
    MTK_BlockModel* bmodel,
    const double& wx,
    const double& wy,
    const double& wz
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • wx: World x-coordinate

  • wx: World y-coordinate

  • wz: World z-coordinate

Returns
  • 1: The block was not found.

  • 0: The block was found.

  • -1: Failure.

MTK_BlockModel_FindXyz()

Locate block with block coordinates supplied. Note that this will nullify the current selection.

Signature
int MTK_BlockModel_FindXyz(
    MTK_BlockModel* bmodel,
    const double& mx,
    const double& my,
    const double& mz
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • mx: World x-coordinate

  • mx: World y-coordinate

  • mz: World z-coordinate

Returns
  • 1: The block was not found.

  • 0: The block was found.

  • -1: Failure.

MTK_BlockModel_FirstBlock()

Position at first block

Signature
int MTK_BlockModel_FirstBlock(MTK_BlockModel* bmodel);
Parameters

bmodel: Pointer to an MTK_BlockModel struct.

Returns

0 on success; any other value indicates failure.

MTK_BlockModel_GetBlockExtent()

Get the block extent in model coordinates.

Signature
int MTK_BlockModel_GetBlockExtent(
    MTK_BlockModel* bmodel,
    double* x0, double* y0, double* z0,
    double* x1, double* y1, double* z1
    );
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • x0: Lower left x-coordinate

  • y0: Lower left y-coordinate

  • z0: Lower left z-coordinate

  • x1: Upper right x-coordinate

  • y1: Upper right y-coordinate

  • z1: Upper right z-coordinate

Returns

0 on success; any other value indicates failure.

MTK_BlockModel_GetPosition()

Get current block position.

Signature
double MTK_BlockModel_GetBlockMatchVolume(MTK_BlockModel* bmodel);
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

Returns
  • Int64: The current block position.

  • -1: Failed.

MTK_BlockModel_IsEof()

Check if at the end of the file (blockmodel).

Signature
int MTK_BlockModel_IsEof(MTK_BlockModel* bmodel);
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

Returns
  • 1: At end of file (block model).

  • 0: Not at end of file.

  • -1: Failed.

MTK_BlockModel_NBlocks()

Get the total number of model blocks.

Signature
Int64 MTK_BlockModel_NBlocks(MTK_BlockModel* bmodel);
Parameters

bmodel: Pointer to an MTK_BlockModel struct.

Returns
  • Int64: The number of model blocks.

  • -1: Failed.

MTK_BlockModel_NextBlock()

Position at the next block.

Signature
int MTK_BlockModel_SetUseExactVolume(
    MTK_BlockModel* bmodel, const int& use);
Parameters

bmodel: Pointer to an MTK_BlockModel struct.

Returns

0 on success; any other value indicates failure.

MTK_BlockModel_SetPosition()

Set the block navigation to the block at the position specified Note that this will nullify the current selection.

Signature
int MTK_BlockModel_SetPosition(
    MTK_BlockModel* bmodel, const Int64& position);
Parameters
  • bmodel: Pointer to an MTK_BlockModel struct.

  • position: Block position.

Returns

0 on success; any other value indicates failure.