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

OEFloatArray center = new OEFloatArray(3);
OEFloatArray extents = new OEFloatArray(3);
float spacing = 0.5f;
oechem.OEGetCenterAndExtents(mol, center, extents);

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