GetBoundingBox

When the transformationMatrix is given, it will fill an array of 12 double values.
When the transformationMatrix is left empty and both startVector and endVector are given the boundingbox without transformation is calculated and returned.

Syntax

public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "GetBoundingBox")]
public static extern void GetBoundingBox(Int64 owlInstance, out double transformationMatrix, out double startVector, out double endVector);

[DllImport(EngineDLL, EntryPoint = "GetBoundingBox")]
public static extern void GetBoundingBox(Int64 owlInstance, IntPtr transformationMatrix, out double startVector, out double endVector);    

Property owlInstance

Size: 64 bit / 8 byte (value)
The handle to the specific instance in the design tree. The instance handle is static within one open model but is most probably different when the same instance is opened in another model. The instance is always exactly of one unique class.

Property transformationMatrix

Size: 32 bit / 4 byte (reference)
The transformationMatrix is expected to be nullptr or a 12 element double value allocated by the host (i.e. 96 bytes / 12 doubles). The matrix values are defined column by column as is common for DirectX, OpenGL and VULKAN, i.e. _11, _12, _13, _21, ... _42, _43.

Property startVector

Size: 32 bit / 4 byte (reference)
The startVector is expected to be a 3 element double value allocated by the host (i.e. 24 bytes). The function will fill in X, Y, Z as the start vector.

Property endVector

Size: 32 bit / 4 byte (reference)
The endVector is expected to be a 3 element double value allocated by the host (i.e. 24 bytes). The function will fill in X, Y, Z as the end vector.

Example

Here you can find code snippits that show how the API call GetBoundingBox can be used.

using Engine;

static void Main(string[] args)
{
    Int64 model = Engine.x86_64.CreateModel();

    if (model != 0)
    {
        //
        //  Classes
        //
        Int64   classBox = Engine.x86_64.GetClassByName(model, "Box");

        //
        //  Datatype Properties (attributes)
        //
        Int64   propertyLength = Engine.x86_64.GetPropertyByName(model, "length"),
                propertyWidth = Engine.x86_64.GetPropertyByName(model, "width"),
                propertyHeight = Engine.x86_64.GetPropertyByName(model, "height");

        //
        //  Instances (creating)
        //
        Int64   instanceBox = Engine.x86_64.CreateInstance(classBox, (string) null);

        double  length = 2.8,
                width = 1.3,
                height = 1.4;

        Engine.x86_64.SetDatatypeProperty(instanceBox, propertyLength, ref length, 1);
        Engine.x86_64.SetDatatypeProperty(instanceBox, propertyWidth, ref width, 1);
        Engine.x86_64.SetDatatypeProperty(instanceBox, propertyHeight, ref height, 1);

        double[]    transformationMatrix = new double[12],
                    startVector = new double[3],
                    endVector = new double[3];
        Engine.x86_64.GetBoundingBox(instanceBox, out transformationMatrix[0], out startVector[0], out endVector[0]);

        System.Diagnostics.Debug.Assert(endVector[0] == 2.8);

        length = 4.1;
        Engine.x86_64.SetDatatypeProperty(instanceBox, propertyLength, ref length, 1);

        System.Diagnostics.Debug.Assert(endVector[0] == 2.8);

        Engine.x86_64.GetBoundingBox(instanceBox, out transformationMatrix[0], out startVector[0], out endVector[0]);

        System.Diagnostics.Debug.Assert(endVector[0] == 4.1);

        //
        //  Next to the minimum bounding box also the AABB can be retrieved through startVector / endVector
        //
        Engine.x86_64.GetBoundingBox(instanceBox, (IntPtr) null, out startVector[0], out endVector[0]);

        //
        //  The resulting model can be viewed in 3D-Editor.exe
        //
        Engine.x86_64.SaveModel(model, "c:\\created\\myFile.bin");
        Engine.x86_64.CloseModel(model);
    }
}