GetBoundingBox
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 byte GetBoundingBox(Int64 owlInstance, out double transformationMatrix, out double startVector, out double endVector); [DllImport(enginedll, EntryPoint = "GetBoundingBox")] public static extern byte GetBoundingBox(Int64 owlInstance, IntPtr transformationMatrix, out double startVector, out double endVector); [DllImport(enginedll, EntryPoint = "GetBoundingBox")] public static extern byte GetBoundingBox(Int64 owlInstance, double[] transformationMatrix, double[] startVector, double[] endVector); [DllImport(enginedll, EntryPoint = "GetBoundingBox")] public static extern byte GetBoundingBox(Int64 owlInstance, IntPtr transformationMatrix, double[] startVector, double[] endVector); public static byte GetBoundingBox(Int64 owlInstance, out double startVector, out double endVector) { return GetBoundingBox(owlInstance, IntPtr.Zero, out startVector, out endVector); }
Property owlInstance
Size: 64 bit / 8 byte (value)Property transformationMatrix
Size: 32 bit / 4 byte (reference)Property startVector
Size: 32 bit / 4 byte (reference)Property endVector
Size: 32 bit / 4 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call GetBoundingBox can be used.
using RDF; // include at least engine.cs within your solution static void Main(string[] args) { Int64 model = RDF.engine.CreateModel(); if (model != 0) { // // Classes // Int64 classBox = RDF.engine.GetClassByName(model, "Box"); // // Datatype Properties (attributes) // Int64 propertyLength = RDF.engine.GetPropertyByName(model, "length"), propertyWidth = RDF.engine.GetPropertyByName(model, "width"), propertyHeight = RDF.engine.GetPropertyByName(model, "height"); // // Instances (creating) // Int64 instanceBox = RDF.engine.CreateInstance(classBox, (string) null); double length = 2.8, width = 1.3, height = 1.4; RDF.engine.SetDatatypeProperty(instanceBox, propertyLength, ref length, 1); RDF.engine.SetDatatypeProperty(instanceBox, propertyWidth, ref width, 1); RDF.engine.SetDatatypeProperty(instanceBox, propertyHeight, ref height, 1); double[] transformationMatrix = new double[12], startVector = new double[3], endVector = new double[3]; RDF.engine.GetBoundingBox(instanceBox, out transformationMatrix[0], out startVector[0], out endVector[0]); System.Diagnostics.Debug.Assert(endVector[0] == 2.8); length = 4.1; RDF.engine.SetDatatypeProperty(instanceBox, propertyLength, ref length, 1); System.Diagnostics.Debug.Assert(endVector[0] == 2.8); RDF.engine.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 // RDF.engine.GetBoundingBox(instanceBox, (IntPtr) null, out startVector[0], out endVector[0]); // // The resulting model can be viewed in 3D-Editor.exe // RDF.engine.SaveModel(model, "c:\\created\\myFile.bin"); RDF.engine.CloseModel(model); } }