Transformation

This class represents the concept Transformation.

Class

class GeometricItem
   relation material
      range Material, cardinality [0, 1]
class Transformation
   relation object
      range GeometricItem, cardinality [0, 1]
   relation matrix
      range Matrix, cardinality [0, 1]    

Example

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

using Engine;

public void CreateTransformation()
{
    Int64 model = Engine.x86_64.CreateModel();

    if (model != 0)
    {
        //
        //  Classes
        //
        Int64   classCylinder = Engine.x86_64.GetClassByName(model, "Cylinder"),
                classMatrix = Engine.x86_64.GetClassByName(model, "Matrix"),
                classTransformation = Engine.x86_64.GetClassByName(model, "Transformation");

        //
        //  Object Properties (relations)
        //
        Int64   propertyMatrix = Engine.x86_64.GetPropertyByName(model, "matrix"),
                propertyObject = Engine.x86_64.GetPropertyByName(model, "object");

        //
        //  Datatype Properties (attributes)
        //
        Int64   property_41 = Engine.x86_64.GetPropertyByName(model, "_41"),
                property_42 = Engine.x86_64.GetPropertyByName(model, "_42"),
                property_43 = Engine.x86_64.GetPropertyByName(model, "_43"),
                propertyLength = Engine.x86_64.GetPropertyByName(model, "length"),
                propertyRadius = Engine.x86_64.GetPropertyByName(model, "radius"),
                propertySegmentationParts = Engine.x86_64.GetPropertyByName(model, "segmentationParts");

        //
        //  Instances (creating)
        //
        Int64   myInstanceCylinder = Engine.x86_64.CreateInstance(classCylinder, (string) null),
                myInstanceMatrix = Engine.x86_64.CreateInstance(classMatrix, (string) null),
                myInstanceTransformation = Engine.x86_64.CreateInstance(classTransformation, (string) null);

        Engine.x86_64.SetObjectProperty(myInstanceTransformation, propertyObject, ref myInstanceCylinder, 1);
        Engine.x86_64.SetObjectProperty(myInstanceTransformation, propertyMatrix, ref myInstanceMatrix, 1);

        double  length = 2.8,
                radius = 1.3;
        Int64   segmentationParts = 36;

        Engine.x86_64.SetDatatypeProperty(myInstanceCylinder, propertyLength, ref length, 1);
        Engine.x86_64.SetDatatypeProperty(myInstanceCylinder, propertyRadius, ref radius, 1);
        Engine.x86_64.SetDatatypeProperty(myInstanceCylinder, propertySegmentationParts, ref segmentationParts, 1);

        double  offsetX = 3.3,
                offsetY = -1.2,
                offsetZ = 0.5;
        Engine.x86_64.SetDatatypeProperty(myInstanceMatrix, property_41, ref offsetX, 1);
        Engine.x86_64.SetDatatypeProperty(myInstanceMatrix, property_42, ref offsetY, 1);
        Engine.x86_64.SetDatatypeProperty(myInstanceMatrix, property_43, ref offsetZ, 1);

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