Hide menu
Loading...
Searching...
No Matches
Basic Measurements

Overview

MTK allows to compute some key properties of a 3D model:

  • bounding box;
  • surface area;
  • volume;
  • centroid (center of mass).

Each property can be computed either for an entire ModelData::Model or for any ModelData::Assembly , ModelData::Part , and ModelData::Instance .

Bounding Box

Bounding box is the smallest axis-aligned box that fully contains a 3D model (or its component).

The following example demonstrates computation of a shape bounding box:

ModelData::Shape aShape = ...;
ModelData::Box aBox;
Geom::Transformation aTrsf;
Measurements::BoundingBox::Compute (aShape, aTrsf, aBox);

In addition to traditional bounding boxes, Manufacturing Toolkit also allows to compute minimum bounding box which is not necessarily axis-aligned:

ModelData::Shape aShape = ...;
ModelData::Box aBox;
Geom::Transformation aTrsf;
static void ComputeMin(const ModelData::Shape &theShape, ModelData::Box &theBox, Geom::Transformation &theOutTransformation)
Definition BoundingBox.cxx:361

Surface Area

The following example demonstrates computation of a shape surface area:

ModelData::Shape aShape = ...;
static double Compute(const ModelData::Model &theModel)
Computes the surface area of the model.
Definition SurfaceArea.cxx:57

Volume

The following example demonstrates computation of a shape volume:

ModelData::Shape aShape = ...;
double r = Measurements::Volume::Compute (aShape);
static double Compute(const ModelData::Model &theModel)
Computes the volume of the model.
Definition Volume.cxx:691

Centroid

The following example demonstrates computation of a shape centroid (center of mass) :

ModelData::Shape aShape = ...;
Geom::Point aCentroid = Measurements::ValidationProperties::ComputeCentroid (aShape);
static Geom::Point ComputeCentroid(const ModelData::Model &theModel)
Computes the center of mass of the model.
Definition ValidationProperties.cxx:50

Distance

The following example demonstrates the computation of the distance between two shapes:

ModelData::Shape aFirstShape = ...;
ModelData::Shape aSecondShape = ...;
double aDistance = Measurements::Distance::Compute (aFirstShape, aSecondShape)
static double Compute(const ModelData::Shape &theFirstShape, const ModelData::Shape &theSecondShape)
Computes the distance between theFirstShape and theSecondShape.
Definition Distance.cxx:39

Angle

The following example demonstrates the computation of the angle between two planar faces:

ModelData::Face aFirstFace = ...;
ModelData::Face aSecondFace = ...;
double anAngle = Measurements::Angle::Compute (aFirstFace, aSecondFace)
static double Compute(const ModelData::Face &theFirstFace, const ModelData::Face &theSecondFace)
Computes the angle between two faces.
Definition Angle.cxx:59