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 = new float[3];
float[] extents = new float[3];
float spacing = 0.5f;
OEChem.OEGetCenterAndExtents(mol, center, extents);

OEScalarGrid grid = new OEScalarGrid();
OEGrid.OEMakeGridFromCenterAndExtents(grid, center, extents, spacing);