GetPerimeter

This function calculates the perimeter of an instance.

Note: internally the call does not store its results, any optimization based on known
    dependancies between instances need to be implemented on the client.
Note: due to internal structure using already calculated vertices/indices does not
    give any performance benefits, in opposite to GetVolume and GetArea

Syntax

//   Visual Studio for Windows
public:
double __declspec(dllexport) __stdcall GetPerimeter(
            __int64             owlInstance
        );

//   Linux, OS-X and non-Visual Studio Windows solutions
public:
double GetPerimeter(
            int64_t             owlInstance
        );    

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.

Example

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

#include "engine/include/engine.h"
#include <assert.h>

void    main()
{
    int64_t model = CreateModel();

    if (model) {
        //
        //  Classes
        //
        int64_t classBox = GetClassByName(model, "Box");

        //
        //  Datatype Properties (attributes)
        //
        int64_t propertyLength = GetPropertyByName(model, "length"),
                propertyWidth = GetPropertyByName(model, "width"),
                propertyHeight = GetPropertyByName(model, "height");

        //
        //  Instances (creating)
        //
        int64_t instanceBox = CreateInstance(classBox, nullptr);

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

        SetDatatypeProperty(instanceBox, propertyLength, &length, 1);
        SetDatatypeProperty(instanceBox, propertyWidth, &width, 1);
        SetDatatypeProperty(instanceBox, propertyHeight, &height, 1);

        double  perimeter = GetPerimeter(instanceBox);

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