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

center = oechem.OEFloatArray(3)
extents = oechem.OEFloatArray(3)
spacing = 0.5
oechem.OEGetCenterAndExtents(mol, center, extents)

grid = oegrid.OEScalarGrid()
oegrid.OEMakeGridFromCenterAndExtents(grid, center, extents, spacing)