Example #1
0
        /// <summary>Convert a 3D pose to a unit dual quaternion.</summary>
        /// <param name="pose">3D pose.</param>
        /// <returns>Unit dual quaternion.</returns>
        public static HDualQuaternion[] PoseToDualQuat(HPose[] pose)
        {
            HTuple htuple = HData.ConcatArray((HData[])pose);
            IntPtr proc   = HalconAPI.PreCall(2080);

            HalconAPI.Store(proc, 0, htuple);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            return(HDualQuaternion.SplitArray(tuple));
        }
Example #2
0
        /// <summary>Multiply two dual quaternions.</summary>
        /// <param name="dualQuaternionLeft">Left dual quaternion.</param>
        /// <param name="dualQuaternionRight">Right dual quaternion.</param>
        /// <returns>Product of the dual quaternions.</returns>
        public static HDualQuaternion[] DualQuatCompose(
            HDualQuaternion[] dualQuaternionLeft,
            HDualQuaternion[] dualQuaternionRight)
        {
            HTuple htuple1 = HData.ConcatArray((HData[])dualQuaternionLeft);
            HTuple htuple2 = HData.ConcatArray((HData[])dualQuaternionRight);
            IntPtr proc    = HalconAPI.PreCall(2059);

            HalconAPI.Store(proc, 0, htuple1);
            HalconAPI.Store(proc, 1, htuple2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple1);
            HalconAPI.UnpinTuple(htuple2);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            return(HDualQuaternion.SplitArray(tuple));
        }
Example #3
0
        /// <summary>
        ///   Interpolate two dual quaternions.
        ///   Instance represents: Dual quaternion as the start point of the interpolation.
        /// </summary>
        /// <param name="dualQuaternionEnd">Dual quaternion as the end point of the interpolation.</param>
        /// <param name="interpPos">Interpolation parameter. Default: 0.5</param>
        /// <returns>Interpolated dual quaternion.</returns>
        public HDualQuaternion[] DualQuatInterpolate(
            HDualQuaternion dualQuaternionEnd,
            HTuple interpPos)
        {
            IntPtr proc = HalconAPI.PreCall(2061);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HData)dualQuaternionEnd);
            HalconAPI.Store(proc, 2, interpPos);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HalconAPI.UnpinTuple((HTuple)((HData)dualQuaternionEnd));
            HalconAPI.UnpinTuple(interpPos);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            HDualQuaternion[] hdualQuaternionArray = HDualQuaternion.SplitArray(tuple);
            GC.KeepAlive((object)this);
            return(hdualQuaternionArray);
        }