Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }