ZIntPoint operator / (const ZIntPoint &pt1, const ZIntPoint &pt2) { if (pt2.getX() == 0 || pt2.getY() == 0 || pt2.getZ() == 0) { return ZIntPoint(0, 0, 0); } return ZIntPoint(pt1.getX() / pt2.getX(), pt1.getY() / pt2.getY(), pt1.getZ() / pt2.getZ()); }
ZIntPoint operator / (const ZIntPoint &pt1, int scale) { if (scale == 0) { return ZIntPoint(0, 0, 0); } return ZIntPoint(pt1.getX() / scale, pt1.getY() / scale, pt1.getZ() / scale); }
ZIntPoint ZDvidInfo::getEndCoordinates() const { ZIntPoint pt = getStartCoordinates(); pt += ZIntPoint(m_stackSize[0], m_stackSize[1], m_stackSize[2]); return pt; }
ZIntPoint ZBlockGrid::getBlockPosition(const ZIntPoint &blockIndex) const { int x = blockIndex.getX() * m_blockSize.getX(); int y = blockIndex.getY() * m_blockSize.getY(); int z = blockIndex.getZ() * m_blockSize.getZ(); x += m_minPoint.getX(); y += m_minPoint.getY(); z += m_minPoint.getZ(); return ZIntPoint(x, y, z); }
ZIntPoint ZIntCuboid::getCorner(int index) const { switch (index) { case 0: return getFirstCorner(); case 1: return ZIntPoint(getLastCorner().getX(), getFirstCorner().getY(), getFirstCorner().getZ()); case 2: return ZIntPoint(getFirstCorner().getX(), getLastCorner().getY(), getFirstCorner().getZ()); case 3: return ZIntPoint(getLastCorner().getX(), getLastCorner().getY(), getFirstCorner().getZ()); case 4: return ZIntPoint(getFirstCorner().getX(), getFirstCorner().getY(), getLastCorner().getZ()); case 5: return ZIntPoint(getLastCorner().getX(), getFirstCorner().getY(), getLastCorner().getZ()); case 6: return ZIntPoint(getFirstCorner().getX(), getLastCorner().getY(), getLastCorner().getZ()); case 7: return getLastCorner(); default: break; } return ZIntPoint(0, 0, 0); }
ZIntPoint operator - (const ZIntPoint &pt1, const ZIntPoint &pt2) { return ZIntPoint(pt1.getX() - pt2.getX(), pt1.getY() - pt2.getY(), pt1.getZ() - pt2.getZ()); }
ZIntPoint operator + (const ZIntPoint &pt1, int v) { return ZIntPoint(pt1.getX() + v, pt1.getY() + v, pt1.getZ() + v); }
ZIntPoint ZIntPoint::operator - () const { return ZIntPoint(-getX(), -getY(), -getZ()); }
ZIntPoint ZDvidInfo::getGridSize() const { return ZIntPoint(m_endBlockIndex.getX() - m_startBlockIndex.getX() + 1, m_endBlockIndex.getY() - m_startBlockIndex.getY() + 1, m_endBlockIndex.getZ() - m_startBlockIndex.getZ() + 1); }
ZIntPoint ZDvidInfo::getBlockSize() const { return ZIntPoint(m_blockSize[0], m_blockSize[1], m_blockSize[2]); }