VolumeObject.cpp
/** Returns the extremes for the volume so that the volume contains all the vertices. */
Returns the extremes for the volume so that the volume contains all the vertices.
Returns the extremes for the volume so that the volume contains all the vertices .
static std::tuple<Vector3DInt32, Vector3DInt32> volumeCorners(const std::vector<Vector3>& vertices) {
  const auto corners = MeshConversions::aabbCorners(vertices);
  const auto& lowFloatCorner = std::get<0>(corners);
  const auto& topFloatCorner = std::get<1>(corners);
  Vector3DInt32 lowCorner(lowFloatCorner.x,
                          lowFloatCorner.y,
                          lowFloatCorner.z);
  Vector3DInt32 topCorner(topFloatCorner.x,
                          topFloatCorner.y,
                          topFloatCorner.z);
  lowCorner -= Vector3DInt32(1, 1, 1);
  topCorner += Vector3DInt32(1, 1, 1);
  return std::make_tuple(lowCorner, topCorner);
}
static std :: tuple < Vector3DInt32 , Vector3DInt32 > volumeCorners ( const std :: vector < Vector3 > & vertices ) { const auto corners = MeshConversions :: aabbCorners ( vertices ) ; const auto & lowFloatCorner = std :: get < 0 > ( corners ) ; const auto & topFloatCorner = std :: get < 1 > ( corners ) ; Vector3DInt32 lowCorner ( lowFloatCorner . x , lowFloatCorner . y , lowFloatCorner . z ) ; Vector3DInt32 topCorner ( topFloatCorner . x , topFloatCorner . y , topFloatCorner . z ) ; lowCorner -= Vector3DInt32 ( 1 , 1 , 1 ) ; topCorner += Vector3DInt32 ( 1 , 1 , 1 ) ; return std :: make_tuple ( lowCorner , topCorner ) ; }
Returns the extremes for the volume so that the volume contains all the vertices.
Returns the extremes for the volume so that the volume contains all the vertices .
// The above code pushes float coordinates into integer vectors. // Push the limits "1 unit away" to be sure that the mesh fits inside even if the decimals are truncated.