Search code examples
c#3dhalcon

Why do some HalconDotNet procedures produce HTuple instead of preferred type?


One example is: HOperatorSet.RigidTransObjectModel3d()

It expects HTuple but also accept objectModel3D as model input. The model output is HTuple, even tho it should (imo) be objectModel3D, as a result I cannot use the objectModel3D's WriteObjectModel3d() functionality.

Is there a way around this this so I end up with an objectModel3D?


Solution

  • You don't need to use HOperatorSet, it can be done directly from HObjectModel3D:

            HObjectModel3D hObjectModel3D = new HObjectModel3D(HTuple.TupleRand(10), HTuple.TupleRand(10), HTuple.TupleRand(10));
    
            HPose hPose = new HPose(0.0, 0.0, 0.0, 90.0, 90.0, 90.0, "Rp+T", "gba", "point");
            HObjectModel3D objectModel3DRig = hObjectModel3D.RigidTransObjectModel3d(hPose);
            objectModel3DRig.WriteObjectModel3d("om3", @"C:\temp\temp2.om3", new HTuple(), new HTuple());