Пример #1
0
        /// <summary>
        /// 判断点是否在曲线范围内
        /// </summary>
        /// <param name="outLine">范围线</param>
        /// <param name="point">点</param>
        /// <param name="tolerance">容差</param>
        /// <returns></returns>
        public static bool IsInside(Polyline outLine, Point2d point, Tolerance tolerance)
        {
            var outL = outLine.Clone() as Polyline;

            if (!outL.Closed)
            {
                outL.Closed = true;
            }

            var closestPoint = outL.GetClosestPointTo(point.ToPoint3d(), false);

            if (closestPoint.IsEqualTo(point.ToPoint3d(), tolerance))
            {
                return(true);
            }

            var ray = new Ray();

            ray.BasePoint = point.ToPoint3d();
            ray.UnitDir   = new Vector3d(1, 0, 0);
            Point3dCollection points = new Point3dCollection();

            ray.IntersectWith(outL, Intersect.OnBothOperands, points, 0, 0);
            if (points.Count % 2 == 1)
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// 指定基点与旋转角度旋转实体
        /// </summary>
        /// <param name="ent">实体对象</param>
        /// <param name="basePt">基点</param>
        /// <param name="angle">旋转角度</param>
        public static void Rotate(this Entity ent, Point2d basePt, double angle)
        {
            Matrix3d mt = Matrix3d.Rotation(angle, Vector3d.ZAxis, basePt.ToPoint3d());

            ent.TransformBy(mt);
        }