Querying Boundaries

Each model and object in a xeometry viewer has a boundary, which you can query at any time.

A boundary is an axis-aligned bounding box (AABB) in World space. It's represented as an array containing the boundary's minimum and maximum extents on each World-space axis:

[xmin, ymin, zmin, xmax, ymax, zmax]

Each object's boundary dynamically fits to the World-space extents of the object's geometry vertex positions (see Querying Geometry). This means that an object's boundary will automatically remain fitted to the object whenever you update the object's transforms, or update the transforms of the object's model (see Transforming).

Each model's boundary dynamically fits to the collective boundary of the model's objects. This means that the model's boundary will automatically remain fitted to the objects whenever you transform one of them, or transform the model itself. Note that object transforms are within the coordinate space set up by their model's transforms.

As shown in the examples below, a xeometry viewer has a getAABB() method that allows you to query either the boundaries of individual models and objects, or the collective boundary of some random assortment of models, objects and types.

This functionality supports xeometry's ability to auto-fit the camera to specified models or objects (see Fitting things in view).

Examples

Getting the collective boundary of everything in a viewer:

var totalBoundary = viewer.getAABB();

Getting the boundary of a model:

var sawBoundary = viewer.getAABB("saw");

Getting the collective boundary of two objects:

var objectsBoundary = viewer.getAABB(["saw34", "saw5"]);

Getting the collective boundary of all objects of the given types (see Assigning types to objects):

var objectsBoundary = viewer.getAABB(["IfcFlowController", "IfcFlowFitting"]);

Getting the collective boundary of two models:

var modelsBoundary = viewer.getAABB(["saw", "gearbox"]);

Getting the collective boundary of the first five objects within a given model:

var objectsBoundary2 = viewer.getAABB(viewer.objects("saw").slice(0, 5));

Getting the collective boundary of a model and a couple of objects from a different model:

var objectsBoundary3 = viewer.getAABB(["gearbox", "saw#2", "saw#5"]);

results matching ""

    No results matching ""