Example #1
0
        public void getKB()
        {
            double x1 = point1.getX();
            double y1 = point1.getY();

            double x2 = point2.getX();
            double y2 = point2.getY();

            k = (y2 - y1) / (x2 - x1);
            b = (x1 * y2 - x2 * y1) / (x1 - x2);
        }
Example #2
0
        public PointXYZ CalculateTranslationVector()
        {
            PointXYZ point = new PointXYZ();

            double dx = keyPoint2.getX() - keyPoint1.getX();
            double dy = keyPoint2.getY() - keyPoint1.getY();

            point.setX(dx);
            point.setY(dy);

            return(point);
        }
Example #3
0
        //通过矩形对角线上的一对点确定裁剪区域范围
        public void setArea(PointXYZ point1, PointXYZ point2)
        {
            double x1 = point1.getX();
            double y1 = point1.getY();

            double x2 = point2.getX();
            double y2 = point2.getY();


            if (x1 < x2)
            {
                minX = x1;
                maxX = x2;
            }
            else
            {
                minX = x2;
                maxX = x1;
            }

            if (y1 < y2)
            {
                minY = y1;
                maxY = y2;
            }
            else
            {
                minY = y2;
                maxY = y1;
            }
        }
Example #4
0
        private static bool isReverse()
        {
            // 情况1: 左下右上
            // false

            // 情况2: 左上右下
            // true
            PointXYZ centerPoint1 = Const.FK_LINE.getKLine1().getCenterPoint();
            PointXYZ centerPoint2 = Const.FK_LINE.getKLine2().getCenterPoint();

            double x1 = centerPoint1.getX();
            double y1 = centerPoint1.getY();
            double z1 = centerPoint1.getZ();    // not used here
            double x2 = centerPoint2.getX();
            double y2 = centerPoint2.getY();
            double z2 = centerPoint2.getZ();    // not used here

            double k = Const.FK_LINE.getFLine().getK();
            double b = Const.FK_LINE.getFLine().getB();

            if ((y1 > k * x1 + b) && (y2 < k * x2 + b))    // 左上右下判断限定
            {
                return(true);
            }

            return(false);
        }
Example #5
0
        public bool isInKeyRectangle(PointXYZ point)
        {
            bool result = false;

            double x = point.getX();
            double y = point.getY();

            if ((x >= minX) && (x <= maxX) && (y >= minY) && (y < maxY))
            {
                result = true;
            }

            return(result);
        }