/// <summary> /// Gets the point and the plane about space direction relationship. /// </summary> /// <param name="pt"></param> /// <param name="box"></param> /// <returns></returns> public static GeometryPosition GetSpacePosition(this XYZ pt, PickedBox box) { GeometryPosition result; var pt1 = pt.GetRoundPoint(); var xs = new[] { NumberUtil.GetRound(box.Min.X), NumberUtil.GetRound(box.Max.X) }; var ys = new[] { NumberUtil.GetRound(box.Min.Y), NumberUtil.GetRound(box.Max.Y) }; var zs = new[] { NumberUtil.GetRound(box.Min.Z), NumberUtil.GetRound(box.Max.Z) }; var minPt = new XYZ(xs.Min(), ys.Min(), zs.Min()); var maxPt = new XYZ(xs.Max(), ys.Max(), zs.Max()); var position = pt.GetPlanePosition(box); switch (position) { case GeometryPosition.Other when pt1.Z <minPt.Z: case GeometryPosition.Other when pt1.Z> maxPt.Z: result = GeometryPosition.Other; break; case GeometryPosition.Edge when zs.Contains(pt1.Z): result = GeometryPosition.Edge; break; default: result = GeometryPosition.Inner; break; } return(result); }