OEMakeGridFromCenterAndExtents

template<class T>
bool OEMakeGridFromCenterAndExtents(OESystem::OEGrid<T> &fgrid,
                                    const float *center, const float *extents,
                                    float spacing)
bool OEMakeGridFromCenterAndExtents(OESystem::OEScalarGrid &fgrid,
                                    const float *center, const float *extents,
                                    float spacing)

Initiates the geometry of ‘fgrid’ from the midpoint (‘center’), dimensions (‘extents’), and length between grid points (‘spacing’).

This is useful for creating grids that are guaranteed to encapsulate an arbitrary set of coordinates. For example, the following code uses OEGetCenterAndExtents on the molecule and then uses OEMakeGridFromCenterAndExtents to construct the grid.

Initializing grid geometry from the coordinates of a molecule

float center[3];
float extents[3];
float spacing = 0.5f;
OEGetCenterAndExtents(mol, center, extents);

OEScalarGrid grid;
OEMakeGridFromCenterAndExtents(grid, center, extents, spacing);