// Region extensions ///<summary> /// Returns whether a Region contains a Point3d. ///</summary> ///<param name="pt">A points to test against the Region.</param> ///<returns>A Boolean indicating whether the Region contains /// the point.</returns> public static bool ContainsPoint(this _AcDb.Region reg, _AcGe.Point3d pt) { using (var brep = new _AcBr.Brep(reg)) { var pc = new _AcBr.PointContainment(); using (var brepEnt = brep.GetPointContainment(pt, out pc)) { return(pc != _AcBr.PointContainment.Outside); } } }
///<summary> /// Returns whether a Region contains a set of Point3ds. ///</summary> ///<param name="pts">An array of points to test against the Region.</param> ///<returns>A Boolean indicating whether the Region contains /// all the points.</returns> public static bool ContainsPoints(this _AcDb.Region reg, _AcGe.Point3d[] pts) { using (var brep = new _AcBr.Brep(reg)) { foreach (var pt in pts) { var pc = new _AcBr.PointContainment(); using (var brepEnt = brep.GetPointContainment(pt, out pc)) { if (pc == _AcBr.PointContainment.Outside) { return(false); } } } } return(true); }