/// <summary> /// Get item that is interseted by ray comming through from point and to point. /// </summary> /// <param name="from">From point.</param> /// <param name="to">To point.</param> /// <param name="planes">The planes where intersection is searched.</param> /// <param name="intersectionPoint">The intersection point.</param> /// <returns>Intersected item.</returns> private DiagramItem intersectedItem(Point from, Point to, Planes planes, out Point intersectionPoint) { if (planes == null) { intersectionPoint = default(Point); return(null); } var item = planes.GetIntersectedItem(from, to, out intersectionPoint); return(item); }
/// <summary> /// Selects according to ray direction defined by given points. /// </summary> /// <param name="p1">The p1.</param> /// <param name="p2">The p2.</param> /// <param name="incrementalPlanes">The incremental planes.</param> /// <param name="decrementalPlanes">The decremental planes.</param> /// <returns>Selected planes.</returns> private Planes selectPlanes(double p1, double p2, Planes incrementalPlanes, Planes decrementalPlanes) { switch (Math.Sign(p2 - p1)) { case 1: return(incrementalPlanes); case -1: return(decrementalPlanes); default: return(null); } }