std::ostream & operator<<(std::ostream & os,const FgImage<T> & img) { return os << "dimensions: " << img.dims() << " bounds: " << fgBounds(img.m_data); }
FgMatrixC<T,dim,2> fgCubeBounds(const vector<FgMatrixC<T,dim,1> > & verts,T padRatio=1) { FgMatrixC<T,dim,2> ret; FgMatrixC<T,dim,2> bounds = fgBounds(verts); FgMatrixC<T,dim,1> lo = bounds.colVec(0), hi = bounds.colVec(1), centre = (lo + hi) * T(0.5); T hsize = fgMaxElem(hi - lo) * 0.5f * padRatio; ret = fgConcatHoriz(centre-FgMatrixC<T,dim,1>(hsize),centre+FgMatrixC<T,dim,1>(hsize)); return ret; }
inline FgMatrixC<T,1,2> fgBounds(const FgMatrixV<T> & mat) { return fgBounds(mat.dataVec()); }
FgMatrixC<T,dim,1> fgBoundsCentre(const std::vector<FgMatrixC<T,dim,1> > & verts) { FgMatrixC<T,dim,2> bounds = fgBounds(verts); return (bounds.colVector[0] + bounds.colVec(1)) * 0.5; }
FgMatrixC<T,nrows,1> fgDims(const std::vector<FgMatrixC<T,nrows,1> > & vec) { FgMatrixC<T,nrows,2> bounds = fgBounds(vec); return (bounds.colVec(1)-bounds.colVec(0)); }