Beispiel #1
0
        public static HHomMat3D Deserialize(Stream stream)
        {
            HHomMat3D hhomMat3D = new HHomMat3D();

            hhomMat3D.DeserializeHomMat3d(HSerializedItem.Deserialize(stream));
            return(hhomMat3D);
        }
Beispiel #2
0
        /// <summary>
        ///   Add a scaling to a homogeneous 3D transformation matrix.
        ///   Instance represents: Input transformation matrix.
        /// </summary>
        /// <param name="sx">Scale factor along the x-axis. Default: 2</param>
        /// <param name="sy">Scale factor along the y-axis. Default: 2</param>
        /// <param name="sz">Scale factor along the z-axis. Default: 2</param>
        /// <param name="px">Fixed point of the transformation (x coordinate). Default: 0</param>
        /// <param name="py">Fixed point of the transformation (y coordinate). Default: 0</param>
        /// <param name="pz">Fixed point of the transformation (z coordinate). Default: 0</param>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dScale(
            double sx,
            double sy,
            double sz,
            double px,
            double py,
            double pz)
        {
            IntPtr proc = HalconAPI.PreCall(250);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, sx);
            HalconAPI.StoreD(proc, 2, sy);
            HalconAPI.StoreD(proc, 3, sz);
            HalconAPI.StoreD(proc, 4, px);
            HalconAPI.StoreD(proc, 5, py);
            HalconAPI.StoreD(proc, 6, pz);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #3
0
        /// <summary>
        ///   Add a rotation to a homogeneous 3D transformation matrix.
        ///   Instance represents: Input transformation matrix.
        /// </summary>
        /// <param name="phi">Rotation angle. Default: 0.78</param>
        /// <param name="axis">Axis, to be rotated around. Default: "x"</param>
        /// <param name="px">Fixed point of the transformation (x coordinate). Default: 0</param>
        /// <param name="py">Fixed point of the transformation (y coordinate). Default: 0</param>
        /// <param name="pz">Fixed point of the transformation (z coordinate). Default: 0</param>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dRotate(
            double phi,
            string axis,
            double px,
            double py,
            double pz)
        {
            IntPtr proc = HalconAPI.PreCall(248);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, phi);
            HalconAPI.StoreS(proc, 2, axis);
            HalconAPI.StoreD(proc, 3, px);
            HalconAPI.StoreD(proc, 4, py);
            HalconAPI.StoreD(proc, 5, pz);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #4
0
        public HHomMat3D Clone()
        {
            HSerializedItem serializedItemHandle = this.SerializeHomMat3d();
            HHomMat3D       hhomMat3D            = new HHomMat3D();

            hhomMat3D.DeserializeHomMat3d(serializedItemHandle);
            serializedItemHandle.Dispose();
            return(hhomMat3D);
        }
Beispiel #5
0
        internal static HHomMat3D[] SplitArray(HTuple data)
        {
            int length = data.Length / 12;

            HHomMat3D[] hhomMat3DArray = new HHomMat3D[length];
            for (int index = 0; index < length; ++index)
            {
                hhomMat3DArray[index] = new HHomMat3D(new HData(data.TupleSelectRange((HTuple)(index * 12), (HTuple)((index + 1) * 12 - 1))));
            }
            return(hhomMat3DArray);
        }
Beispiel #6
0
        internal static int LoadNew(
            IntPtr proc,
            int parIndex,
            HTupleType type,
            int err,
            out HHomMat3D obj)
        {
            HTuple tuple;

            err = HTuple.LoadNew(proc, parIndex, err, out tuple);
            obj = new HHomMat3D(new HData(tuple));
            return(err);
        }
Beispiel #7
0
        /// <summary>
        ///   Invert a homogeneous 3D transformation matrix.
        ///   Instance represents: Input transformation matrix.
        /// </summary>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dInvert()
        {
            IntPtr proc = HalconAPI.PreCall(245);

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

            this.UnpinTuple();
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #8
0
        /// <summary>
        ///   Multiply two homogeneous 3D transformation matrices.
        ///   Instance represents: Left input transformation matrix.
        /// </summary>
        /// <param name="homMat3DRight">Right input transformation matrix.</param>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dCompose(HHomMat3D homMat3DRight)
        {
            IntPtr proc = HalconAPI.PreCall(246);

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

            this.UnpinTuple();
            HalconAPI.UnpinTuple((HTuple)((HData)homMat3DRight));
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #9
0
        /// <summary>
        ///   Add a translation to a homogeneous 3D transformation matrix.
        ///   Instance represents: Input transformation matrix.
        /// </summary>
        /// <param name="tx">Translation along the x-axis. Default: 64</param>
        /// <param name="ty">Translation along the y-axis. Default: 64</param>
        /// <param name="tz">Translation along the z-axis. Default: 64</param>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dTranslate(double tx, double ty, double tz)
        {
            IntPtr proc = HalconAPI.PreCall(252);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, tx);
            HalconAPI.StoreD(proc, 2, ty);
            HalconAPI.StoreD(proc, 3, tz);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #10
0
        /// <summary>
        ///   Add a rotation to a homogeneous 3D transformation matrix.
        ///   Instance represents: Input transformation matrix.
        /// </summary>
        /// <param name="phi">Rotation angle. Default: 0.78</param>
        /// <param name="axis">Axis, to be rotated around. Default: "x"</param>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dRotateLocal(HTuple phi, HTuple axis)
        {
            IntPtr proc = HalconAPI.PreCall(247);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, phi);
            HalconAPI.Store(proc, 2, axis);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HalconAPI.UnpinTuple(phi);
            HalconAPI.UnpinTuple(axis);
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #11
0
        /// <summary>
        ///   Add a scaling to a homogeneous 3D transformation matrix.
        ///   Instance represents: Input transformation matrix.
        /// </summary>
        /// <param name="sx">Scale factor along the x-axis. Default: 2</param>
        /// <param name="sy">Scale factor along the y-axis. Default: 2</param>
        /// <param name="sz">Scale factor along the z-axis. Default: 2</param>
        /// <returns>Output transformation matrix.</returns>
        public HHomMat3D HomMat3dScaleLocal(HTuple sx, HTuple sy, HTuple sz)
        {
            IntPtr proc = HalconAPI.PreCall(249);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, sx);
            HalconAPI.Store(proc, 2, sy);
            HalconAPI.Store(proc, 3, sz);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HalconAPI.UnpinTuple(sx);
            HalconAPI.UnpinTuple(sy);
            HalconAPI.UnpinTuple(sz);
            HHomMat3D hhomMat3D;
            int       procResult = HHomMat3D.LoadNew(proc, 0, err, out hhomMat3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hhomMat3D);
        }
Beispiel #12
0
 internal static int LoadNew(IntPtr proc, int parIndex, int err, out HHomMat3D obj)
 {
     return(HHomMat3D.LoadNew(proc, parIndex, HTupleType.MIXED, err, out obj));
 }