Ejemplo n.º 1
0
            /// <summary>
            /// Function for obtaining all poses of a WorkSpace definition directly from vlSDK.
            /// </summary>
            /// <returns>
            /// Array of Workspace.Transform in the vlSDK coordinate system, which represent all
            /// camera poses described by this WorkSpace.Definition
            /// </returns>
            public Transform[] GetCameraTransforms()
            {
                int    transformsSize = 0;
                IntPtr transforms     = vlSDKUtil_getCameraTransformsFromWorkspaceDefinition(
                    VLJsonUtility.ToJson(this), out transformsSize);

                if (transforms == IntPtr.Zero)
                {
                    return(new WorkSpace.Transform[0]);
                }

                float[] transformsVector = new float[transformsSize * 7];
                Marshal.Copy(transforms, transformsVector, 0, transformsSize * 7);
                Marshal.FreeHGlobal(transforms);

                WorkSpace.Transform[] result = new WorkSpace.Transform[transformsSize];

                for (int i = 0; i < transformsSize; i++)
                {
                    result[i] = new WorkSpace.Transform(
                        new Vector3(
                            transformsVector[i * 7 + 0],
                            transformsVector[i * 7 + 1],
                            transformsVector[i * 7 + 2]),
                        new Quaternion(
                            transformsVector[i * 7 + 3],
                            transformsVector[i * 7 + 4],
                            transformsVector[i * 7 + 5],
                            transformsVector[i * 7 + 6]));
                }

                return(result);
            }
Ejemplo n.º 2
0
            public Plane(float length, float width, int steps, WorkSpace.Transform trans) :
                base(defaultTypeName)
            {
                this.parameters = new Parameters();

                this.parameters.planeLength = length;
                this.parameters.planeWidth  = width;
                this.parameters.planeSteps  = steps;

                this.parameters.transformation = trans;
            }
Ejemplo n.º 3
0
            public Sphere(VLGeometry usedGeometry, WorkSpace.Transform trans) : base(defaultTypeName)
            {
                this.parameters = new Parameters();
                this.parameters.sphereRadius      = usedGeometry.sphereRadius;
                this.parameters.sphereThetaStart  = usedGeometry.thetaStart;
                this.parameters.sphereThetaLength = usedGeometry.thetaLength;
                this.parameters.sphereSamples     =
                    Mathf.FloorToInt(Remap(usedGeometry.detailLevel, 0f, 1f, 42f, 1281f));
                this.parameters.spherePhiStart  = usedGeometry.phiStart;
                this.parameters.spherePhiLength = usedGeometry.phiLength;

                this.parameters.transformation = trans;
            }