Exemple #1
0
        public static HDualQuaternion Deserialize(Stream stream)
        {
            HDualQuaternion hdualQuaternion = new HDualQuaternion();

            hdualQuaternion.DeserializeDualQuat(HSerializedItem.Deserialize(stream));
            return(hdualQuaternion);
        }
Exemple #2
0
        public HDualQuaternion Clone()
        {
            HSerializedItem serializedItemHandle = this.SerializeDualQuat();
            HDualQuaternion hdualQuaternion      = new HDualQuaternion();

            hdualQuaternion.DeserializeDualQuat(serializedItemHandle);
            serializedItemHandle.Dispose();
            return(hdualQuaternion);
        }
Exemple #3
0
        internal static HDualQuaternion[] SplitArray(HTuple data)
        {
            int length = data.Length / 8;

            HDualQuaternion[] hdualQuaternionArray = new HDualQuaternion[length];
            for (int index = 0; index < length; ++index)
            {
                hdualQuaternionArray[index] = new HDualQuaternion(new HData(data.TupleSelectRange((HTuple)(index * 8), (HTuple)((index + 1) * 8 - 1))));
            }
            return(hdualQuaternionArray);
        }
Exemple #4
0
        internal static int LoadNew(
            IntPtr proc,
            int parIndex,
            HTupleType type,
            int err,
            out HDualQuaternion obj)
        {
            HTuple tuple;

            err = HTuple.LoadNew(proc, parIndex, err, out tuple);
            obj = new HDualQuaternion(new HData(tuple));
            return(err);
        }
Exemple #5
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));
        }
Exemple #6
0
        /// <summary>
        ///   Normalize a dual quaternion.
        ///   Instance represents: Unit dual quaternion.
        /// </summary>
        /// <returns>Normalized dual quaternion.</returns>
        public HDualQuaternion DualQuatNormalize()
        {
            IntPtr proc = HalconAPI.PreCall(2062);

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

            this.UnpinTuple();
            HDualQuaternion hdualQuaternion;
            int             procResult = HDualQuaternion.LoadNew(proc, 0, err, out hdualQuaternion);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hdualQuaternion);
        }
Exemple #7
0
        /// <summary>
        ///   Multiply two dual quaternions.
        ///   Instance represents: Left dual quaternion.
        /// </summary>
        /// <param name="dualQuaternionRight">Right dual quaternion.</param>
        /// <returns>Product of the dual quaternions.</returns>
        public HDualQuaternion DualQuatCompose(HDualQuaternion dualQuaternionRight)
        {
            IntPtr proc = HalconAPI.PreCall(2059);

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

            this.UnpinTuple();
            HalconAPI.UnpinTuple((HTuple)((HData)dualQuaternionRight));
            HDualQuaternion hdualQuaternion;
            int             procResult = HDualQuaternion.LoadNew(proc, 0, err, out hdualQuaternion);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hdualQuaternion);
        }
Exemple #8
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,
            double interpPos)
        {
            IntPtr proc = HalconAPI.PreCall(2061);

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

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hdualQuaternion);
        }
Exemple #9
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));
        }
Exemple #10
0
 internal static int LoadNew(IntPtr proc, int parIndex, int err, out HDualQuaternion obj)
 {
     return(HDualQuaternion.LoadNew(proc, parIndex, HTupleType.MIXED, err, out obj));
 }