public LinkedList<Vector> multiIntersect(Ray ray) { var intersections = new LinkedList<Vector>(); var rays = new LinkedList<Ray>(); var arcs = new LinkedList<Arc>(); getEdges(rays, arcs); foreach (var side in rays) { var sideIntersection = ray.intersect(side); if (sideIntersection != null) { intersections.AddLast(sideIntersection ?? new Vector()); } } foreach (var arc in arcs) { var arcIntersections = arc.multiIntersect(ray); if (arcIntersections != null) { foreach (var inters in arcIntersections) { intersections.AddLast(inters); } } } return intersections; }
public AxisDirection? borderAnyIntersectionDirection(Ray ray, AxisDirection? exceptDir = null) { foreach (AxisDirection dir in Enum.GetValues(typeof(AxisDirection))) { if (dir == exceptDir) continue; var side = lineForDirection(dir); if (ray.intersect(side) != null) { //(ray.intersect(side) ?? new Vector(0, 0)).draw(0xFF0000); return dir; } } return null; }
public bool isIntersect(Ray ray) { var rays = new LinkedList<Ray>(); var arcs = new LinkedList<Arc>(); getEdges(rays, arcs); foreach (var side in rays) { var sideIntersection = ray.intersect(side); if (sideIntersection != null) { return true; } } foreach (var arc in arcs) { var arcIntersections = arc.multiIntersect(ray); if (arcIntersections != null) { return true; } } return false; }
public bool isIntersect(Ray ray) { foreach (AxisDirection dir in Enum.GetValues(typeof(AxisDirection))) { var edge = edgeInDirection(dir); if (ray.intersect(edge) != null) { return true; } } return false; }