示例#1
0
        /// <summary>
        /// 将方向调整到指定象限
        /// OneAndFour在Y=-1的时候,调整为向上
        /// OneAndTwo在X=-1的时候,调整为向右
        /// </summary>
        /// <param name="vector"></param>
        /// <param name="quadrantType"></param>
        /// <returns></returns>
        public static XYZ GetVectorByQuadrant(XYZ vector, QuadrantType quadrantType)
        {
            var result = vector;

            switch (quadrantType)
            {
            case QuadrantType.OneAndFour:
                if ((vector.Y == -1 && AnnotationConstaints.IsMiniValue(vector.X)) || vector.X < 0)
                {
                    result = new XYZ(-vector.X, -vector.Y, vector.Z);
                }
                return(result);

            case QuadrantType.OneAndTwo:
                if ((vector.X == -1 && AnnotationConstaints.IsMiniValue(vector.Y)) || vector.Y < 0)
                {
                    result = new XYZ(-vector.X, -vector.Y, vector.Z);
                }
                return(result);

            case QuadrantType.One:
            case QuadrantType.Two:
            case QuadrantType.Three:
            case QuadrantType.Four:
            default:
                throw new NotImplementedException("");
            }
        }
示例#2
0
 /// <summary>
 /// 平行检测
 /// </summary>
 /// <param name="pipes"></param>
 /// <param name="verticalVector"></param>
 /// <returns></returns>
 bool CheckParallel(IEnumerable <Pipe> pipes, XYZ verticalVector)
 {
     foreach (var pipe in pipes)
     {
         var direction    = ((pipe.Location as LocationCurve).Curve as Line).Direction;
         var crossProduct = direction.CrossProduct(verticalVector);
         if (!AnnotationConstaints.IsMiniValue(crossProduct.X) || !AnnotationConstaints.IsMiniValue(crossProduct.Y))
         {
             return(false);
         }
     }
     return(true);
 }
示例#3
0
        /// <summary>
        /// 将方向调整到指定象限
        /// </summary>
        /// <param name="vector"></param>
        /// <param name="quadrantType"></param>
        /// <returns></returns>
        public static void GetVectorByQuadrant(QuadrantType quadrantType, double axleX, double axleY, ref double axle1, ref double axle2)
        {
            switch (quadrantType)
            {
            case QuadrantType.OneAndFour:
                if ((axleY == -1 && AnnotationConstaints.IsMiniValue(axleX)) || axleX < 0)
                {
                    axle1 = -axleX;
                    axle2 = -axleY;
                }
                else
                {
                    axle1 = axleX;
                    axle2 = axleY;
                }
                return;

            case QuadrantType.OneAndTwo:
                if ((axleX == -1 && AnnotationConstaints.IsMiniValue(axleY)) || axleY < 0)
                {
                    axle1 = -axleX;
                    axle2 = -axleY;
                }
                else
                {
                    axle1 = axleX;
                    axle2 = axleY;
                }
                return;

            case QuadrantType.One:
            case QuadrantType.Two:
            case QuadrantType.Three:
            case QuadrantType.Four:
            default:
                throw new NotImplementedException("未实现07130318");
            }
        }