Exemplo n.º 1
0
 public SetString(XGraphics gfx, string text, XFont font)
 {
     this.gfx  = gfx;
     Text      = text;
     this.Font = font;
     Position  = new XVector();
 }
Exemplo n.º 2
0
        public PVector()
        {
            m_dNomX = 0.0;
            m_dNomY = 0.0;
            m_dNomT = 0.0;


            m_nSelect = 0;

            m_dCalX = 1.0;
            m_dCalY = 1.0;
            m_dCalT = 1.0;

            m_dMinX = -100000.0;
            m_dMaxX = 100000.0;
            m_dMinY = -100000.0;
            m_dMaxY = 100000.0;
            m_dMinT = -100000.0;
            m_dMaxT = 100000.0;

            m_sFormatX = "{0:F1}";
            m_sFormatY = "{0:F1}";
            m_sFormatT = "{0:F1}";

            m_cBolderColor = Color.DarkBlue;
            m_cValueColor  = Color.White;
            InitializeComponent();

            m_xVector = new XVector();
        }
Exemplo n.º 3
0
        public bool Judge(MODE eMode)
        {
            XVector xTolerance = m_xTolerance[(int)eMode];

            if (Math.Abs(m_xDeviation.X) <= xTolerance.X &&
                Math.Abs(m_xDeviation.Y) <= xTolerance.Y &&
                Math.Abs(m_xDeviation.T) <= xTolerance.T)
            //&& Math.Abs(m_dE)<= m_dTolE )
            {
                if (eMode == MODE.ALIGN)
                {
                    return(true);
                }
                else
                {
                    for (int n = 0; n < m_nCamCount; n++)
                    {
                        XVector xScale = m_xCam[n].Scale;
                        if ((double)xScale > m_dTolScale)
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 4
0
        public void CalScale(XVector xDeviation)
        {
            XScalar xCoor = new XScalar(Coordinate);

            xCoor.Rotate(xDeviation.T);
            Scale.Set(xCoor - xDeviation - Mark);
        }
Exemplo n.º 5
0
        public XAlign()
        {
            m_nAlignCount = 0;
            m_nCamCount   = 2;
            for (int n = 0; n < (int)MODE.MAX_ALIGN_MODE; n++)
            {
                m_xTolerance[n] = new XVector();
            }

            m_xDeviation = new XVector();
            m_xTwist     = new XVector();
            m_xShift     = new XVector();
            for (int n = 0; n < MAX_OFFSET; n++)
            {
                m_xOffset[n]      = new XVector();
                m_xOffsetData[n]  = new XVector();
                m_xOriginData[n]  = new XVector();
                m_xContactData[n] = new XVector();
            }


            for (int n = 0; n < MAX_CAM; n++)
            {
                m_xCam[n]   = new XCam();
                m_nLight[n] = 100;
                m_xGain[n]  = new XVector(0, 300, 128);
            }
            m_nCamPoseMode = 0xF;

            m_xTable           = new XTable();
            m_xMoveCalibration = new XVector();
        }
Exemplo n.º 6
0
        public static double AngleBetween(XVector vector1, XVector vector2)
        {
            double y = vector1._x * vector2._y - vector2._x * vector1._y;
            double x = vector1._x * vector2._x + vector1._y * vector2._y;

            return(Math.Atan2(y, x) * 57.295779513082323);
        }
Exemplo n.º 7
0
        public bool GetMotionUVW(ref XVector xMove, ref XScalar xU, ref XScalar xV, ref XScalar xW)
        {
            GetLocal(ref xMove);

            double dTx = 0, dTy = 0;

            {            //U
                RotateMethod(63640, 63640, xMove.T, ref dTx, ref dTy);
                xU.Set(dTx, dTy);
            }
            {            //V
                RotateMethod(-63640, -63640, xMove.T, ref dTx, ref dTy);
                xV.Set(dTx, dTy);
            }
            {            //W
                RotateMethod(63640, -63640, xMove.T, ref dTx, ref dTy);
                xW.Set(dTx, dTy);
            }

            xMove.X *= m_xMotorDirection.X;
            xMove.Y *= m_xMotorDirection.Y;
            xMove.T *= m_xMotorDirection.T * 180000 / Math.PI;
            double dLimitT = m_xMoveLimit.T * 180000 / Math.PI;

            if (m_xMoveLimit.X > Math.Abs(xMove.X) && m_xMoveLimit.Y > Math.Abs(xMove.Y) && dLimitT > Math.Abs(xMove.T))
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 8
0
        public static double AngleBetween(XVector vector1, XVector vector2)
        {
            double y = vector1.X * vector2.Y - vector2.X * vector1.Y;
            double x = vector1.X * vector2.X + vector1.Y * vector2.Y;

            return(Math.Atan2(y, x) * 57.295779513082323);
        }
Exemplo n.º 9
0
 public static bool Equals(XVector vector1, XVector vector2)
 {
     if (vector1.X.Equals(vector2.X))
     {
         return(vector1.Y.Equals(vector2.Y));
     }
     return(false);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Moves a rectangle by the specified amount.
 /// </summary>
 public void Offset(XVector offsetVector)
 {
     if (IsEmpty)
     {
         throw new InvalidOperationException("CannotCallMethod"); //SR.Get(SRID.Rect_CannotCallMethod, new object[0]));
     }
     _x += offsetVector.X;
     _y += offsetVector.Y;
 }
Exemplo n.º 11
0
        public static XVector Parse(string source)
        {
            TokenizerHelper helper = new TokenizerHelper(source, CultureInfo.InvariantCulture);
            string          str    = helper.NextTokenRequired();
            XVector         vector = new XVector(Convert.ToDouble(str, CultureInfo.InvariantCulture), Convert.ToDouble(helper.NextTokenRequired(), CultureInfo.InvariantCulture));

            helper.LastTokenRequired();
            return(vector);
        }
Exemplo n.º 12
0
        public XTable()
        {
            m_xMotorDirection = new XVector();
            m_xMoveLimit      = new XVector();

            for (int n = 0; n < MAX_CAM; n++)
            {
                m_xCamPosition[n] = new XVector();
            }
        }
Exemplo n.º 13
0
        public void GetLocal(ref XVector xMove, int nLocal)
        {
            double dTx = 0, dTy = 0;

            XVector tPoint = m_xCamPosition[nLocal];

            RotateMethod(tPoint.X - xMove.X, tPoint.Y - xMove.Y, xMove.T, ref dTx, ref dTy);
            xMove.X += dTx;
            xMove.Y += dTy;
        }
Exemplo n.º 14
0
        public XVector GetCalT(int nCam, double dMoveT, XScalar xStartPos, XScalar xEndPos, XScalar xCal)
        {
            XVector xMarkPos = new XVector();
            XScalar xDelta   = (xEndPos - xStartPos) * xCal;
            double  dDn      = 1.0 + Math.Sin(dMoveT) * Math.Sin(dMoveT) / (1.0 - Math.Cos(dMoveT)) - Math.Cos(dMoveT);
            double  dUp      = xDelta.X * Math.Sin(dMoveT) / (1.0 - Math.Cos(dMoveT)) - xDelta.Y;

            xMarkPos.Y = dUp / dDn;
            xMarkPos.X = (xMarkPos.Y * Math.Sin(dMoveT) - xDelta.X) / (1.0 - Math.Cos(dMoveT));
            return(xMarkPos);
        }
Exemplo n.º 15
0
        public XVector ComputeNormal(ref List <XVector> _Vertices)
        {
            this.Normal = new XVector();
            XVector _A1 = _Vertices[this.VertIdx[0]];
            XVector _B  = _Vertices[this.VertIdx[1]];
            XVector _A2 = _Vertices[this.VertIdx[2]];

            this.Normal = XVector.Cross(XVector.Subtract(_A1, _B), XVector.Subtract(_A2, _B));
            this.Normal.Normalize();
            return(this.Normal);
        }
Exemplo n.º 16
0
 public bool SetAlign(XVector xDeviation, MODE Mode, int Offset)
 {
     m_xShift.Set(0, 0, 0);
     m_xDeviation.Set(xDeviation);
     //m_xDeviation.Set(m_xDeviation - m_xShift);
     m_xDeviation.Set(m_xDeviation - m_xTwist);
     if (Mode == MODE.ALIGN)
     {
         m_xDeviation.Set(m_xDeviation - m_xOffset[Offset]);
     }
     return(true);
 }
Exemplo n.º 17
0
        public bool GetMoveCalibration(ref XVector xMove)
        {
            xMove.X *= m_xMotorDirection.X;
            xMove.Y *= m_xMotorDirection.Y;
            xMove.T *= m_xMotorDirection.T * 180000 / Math.PI;
            double dLimitT = m_xMoveLimit.T * 180000 / Math.PI;

            if (m_xMoveLimit.X > Math.Abs(xMove.X) && m_xMoveLimit.Y > Math.Abs(xMove.Y) && dLimitT > Math.Abs(xMove.T))
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Calculates the distance between an old anchor point and a new anchor point.
        /// </summary>
        /// <param name="oldType"></param>
        /// <param name="newType"></param>
        /// <param name="size"></param>
        public static XVector CalcDistance(AnchorType oldType, AnchorType newType, XSize size)
        {
            if (oldType == newType)
            {
                return(new XVector());
            }

            XVector result;
            Delta   delta = Deltas[(int)oldType, (int)newType];

            result = new XVector(size.Width / 2 * delta.X, size.Height / 2 * delta.Y);
            return(result);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Calculates the distance between an old anchor point and a new anchor point.
        /// </summary>
        /// <param name="oldType"></param>
        /// <param name="newType"></param>
        /// <param name="size"></param>
        public static XVector CalcDistance(AnchorType oldType, AnchorType newType, XSize size)
        {
            if (oldType == newType)
            {
                return(new XVector());
            }

            XVector result;
            Delta   delta = CodeBase.deltas[(int)oldType, (int)newType];

            result = new XVector(size.width / 2 * delta.x, size.height / 2 * delta.y);
            return(result);
        }
Exemplo n.º 20
0
        public void GetLocal(ref XVector xMove)
        {
            double dSTx = 0, dSTy = 0;
            double dTx = 0, dTy = 0;

            for (long n = 0; n < m_nCamCount; n++)
            {
                XVector tPoint = m_xCamPosition[n];
                RotateMethod(tPoint.X - xMove.X, tPoint.Y - xMove.Y, xMove.T, ref dTx, ref dTy);
                dSTx += dTx;
                dSTy += dTy;
            }

            xMove.X += dSTx / m_nCamCount;
            xMove.Y += dSTy / m_nCamCount;
        }
Exemplo n.º 21
0
        public XCam()
        {
            Coordinate = new XVector();
            Transpose  = new XVector();
            Differ     = new XVector();
            Cal        = new XVector();
            Mark       = new XVector();
            Pivot      = new XVector();
            Scale      = new XVector();
            Dist       = new XVector();

            for (int n = 0; n < MAX_FIND_COUNT; n++)
            {
                Find[n] = new XVector();
            }
        }
Exemplo n.º 22
0
        public bool GetMotionTable(ref XVector xMove, int nLocal, bool bLocal)
        {
            if (bLocal == true)
            {
                GetLocal(ref xMove, nLocal);
            }
            xMove.X *= m_xMotorDirection.X;
            xMove.Y *= m_xMotorDirection.Y;
            xMove.T *= m_xMotorDirection.T * 180000 / Math.PI;
            double dLimitT = m_xMoveLimit.T * 180000 / Math.PI;

            if (m_xMoveLimit.X > Math.Abs(xMove.X) && m_xMoveLimit.Y > Math.Abs(xMove.Y) && dLimitT > Math.Abs(xMove.T))
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 23
0
        public void Align()
        {
            if (m_RegionAlign != null && m_RegionAlign.TargetRegion != null)
            {
                m_RegionAlign.TargetRegion.Align();

                PointF[] TargetCp = m_RegionAlign.TargetRegion.GetCP();
                PointF[] ObjectCp = GetCP();

                if (TargetCp != null)
                {
                    PointF  tCp    = TargetCp[(int)m_RegionAlign.AlignTarget];
                    PointF  oCp    = ObjectCp[(int)m_RegionAlign.AlignObject];
                    XVector Offset = m_RegionAlign.Offset;
                    p[0] = (float)(p[0] - oCp.X + tCp.X + Offset.X);
                    p[1] = (float)(p[1] - oCp.Y + tCp.Y + Offset.Y);
                }
            }
        }
Exemplo n.º 24
0
        public bool GetMotionUVWX(XVector xMove, ref XScalar xU, ref XScalar xV, ref XScalar xW, ref XScalar xX)
        {
            xMove.X *= m_xMotorDirection.X;
            xMove.Y *= m_xMotorDirection.Y;
            xMove.T *= m_xMotorDirection.T;

            double dTx = 0, dTy = 0;

            {            //U
                RotateMethod(-1005000, 755000, xMove.T, ref dTx, ref dTy);
                xU.Set(dTx, dTy);
            }
            {            //V
                RotateMethod(1005000, 755000, xMove.T, ref dTx, ref dTy);
                xV.Set(dTx, dTy);
            }
            {            //W
                RotateMethod(-1005000, -755000, xMove.T, ref dTx, ref dTy);
                xW.Set(dTx, dTy);
            }

            {            //W
                RotateMethod(1005000, -755000, xMove.T, ref dTx, ref dTy);
                xX.Set(dTx, dTy);
            }

            xMove.T *= 180000 / Math.PI;

            double dLimitT = m_xMoveLimit.T * 180000 / Math.PI;

            if (m_xMoveLimit.X > Math.Abs(xMove.X) && m_xMoveLimit.Y > Math.Abs(xMove.Y) && dLimitT > Math.Abs(xMove.T))
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 25
0
 public bool Equals(XVector value)
 {
     return Equals(this, value);
 }
Exemplo n.º 26
0
 public static bool Equals(XVector vector1, XVector vector2)
 {
     if (vector1.X.Equals(vector2.X))
         return vector1.Y.Equals(vector2.Y);
     return false;
 }
Exemplo n.º 27
0
 public static double Determinant(XVector vector1, XVector vector2)
 {
     return vector1._x * vector2._y - vector1._y * vector2._x;
 }
Exemplo n.º 28
0
 public static double Multiply(XVector vector1, XVector vector2)
 {
     return(vector1._x * vector2._x + vector1._y * vector2._y);
 }
Exemplo n.º 29
0
 public static XVector Divide(XVector vector, double scalar)
 {
     return(vector * (1.0 / scalar));
 }
Exemplo n.º 30
0
 /// <summary>
 /// Adds a point and a vector.
 /// </summary>
 public static XPoint Add(XPoint point, XVector vector)
 {
     return new XPoint(point._x + vector.X, point._y + vector.Y);
 }
Exemplo n.º 31
0
 public static XPoint Add(XVector vector, XPoint point)
 {
     return new XPoint(point.X + vector._x, point.Y + vector._y);
 }
Exemplo n.º 32
0
 public static XVector Subtract(XVector vector1, XVector vector2)
 {
     return new XVector(vector1._x - vector2._x, vector1._y - vector2._y);
 }
Exemplo n.º 33
0
 public static XVector Add(XVector vector1, XVector vector2)
 {
     return new XVector(vector1._x + vector2._x, vector1._y + vector2._y);
 }
Exemplo n.º 34
0
 public static double AngleBetween(XVector vector1, XVector vector2)
 {
     double y = vector1._x * vector2._y - vector2._x * vector1._y;
     double x = vector1._x * vector2._x + vector1._y * vector2._y;
     return (Math.Atan2(y, x) * 57.295779513082323);
 }
Exemplo n.º 35
0
 /// <summary>
 /// Subtracts a vector from a point.
 /// </summary>
 public static XPoint Subtract(XPoint point, XVector vector)
 {
     return new XPoint(point._x - vector.X, point._y - vector.Y);
 }
Exemplo n.º 36
0
 /// <summary>
 /// Transforms the specified vector by this Matrix and returns the result.
 /// </summary>
 public XVector Transform(XVector vector)
 {
     double x = vector.X;
     double y = vector.Y;
     MultiplyVector(ref x, ref y);
     return new XVector(x, y);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Transforms the specified vectors by this matrix.
 /// </summary>
 public void Transform(XVector[] vectors)
 {
     if (vectors != null)
     {
         int count = vectors.Length;
         for (int idx = 0; idx < count; idx++)
         {
             double x = vectors[idx].X;
             double y = vectors[idx].Y;
             MultiplyVector(ref x, ref y);
             vectors[idx].X = x;
             vectors[idx].Y = y;
         }
     }
 }
Exemplo n.º 38
0
 public static XVector Multiply(double scalar, XVector vector)
 {
     return new XVector(vector._x * scalar, vector._y * scalar);
 }
Exemplo n.º 39
0
 public static XVector Divide(XVector vector, double scalar)
 {
     return vector * (1.0 / scalar);
 }
Exemplo n.º 40
0
 public static XVector Multiply(XVector vector, XMatrix matrix)
 {
     return matrix.Transform(vector);
 }
Exemplo n.º 41
0
 public static XVector Multiply(double scalar, XVector vector)
 {
     return(new XVector(vector._x * scalar, vector._y * scalar));
 }
Exemplo n.º 42
0
 public static double Multiply(XVector vector1, XVector vector2)
 {
     return vector1._x * vector2._x + vector1._y * vector2._y;
 }
Exemplo n.º 43
0
 public static XVector Multiply(XVector vector, XMatrix matrix)
 {
     return(matrix.Transform(vector));
 }
Exemplo n.º 44
0
        /// <summary>
        /// Calculates the distance between an old anchor point and a new anchor point.
        /// </summary>
        /// <param name="oldType"></param>
        /// <param name="newType"></param>
        /// <param name="size"></param>
        public static XVector CalcDistance(AnchorType oldType, AnchorType newType, XSize size)
        {
            if (oldType == newType)
                return new XVector();

            XVector result;
            Delta delta = Deltas[(int)oldType, (int)newType];
            result = new XVector(size.Width / 2 * delta.X, size.Height / 2 * delta.Y);
            return result;
        }
Exemplo n.º 45
0
 public static double Determinant(XVector vector1, XVector vector2)
 {
     return(vector1._x * vector2._y - vector1._y * vector2._x);
 }
Exemplo n.º 46
0
 public static XVector Parse(string source)
 {
     TokenizerHelper helper = new TokenizerHelper(source, CultureInfo.InvariantCulture);
     string str = helper.NextTokenRequired();
     XVector vector = new XVector(Convert.ToDouble(str, CultureInfo.InvariantCulture), Convert.ToDouble(helper.NextTokenRequired(), CultureInfo.InvariantCulture));
     helper.LastTokenRequired();
     return vector;
 }
Exemplo n.º 47
0
 public bool Equals(XVector value)
 {
     return(Equals(this, value));
 }
Exemplo n.º 48
0
 public static double CrossProduct(XVector vector1, XVector vector2)
 {
     return vector1._x * vector2._y - vector1._y * vector2._x;
 }