Package com.ardor3d.intersection

Examples of com.ardor3d.intersection.IntersectionRecord$Intersection


            final Vector3 normalStore = new Vector3();
            final Vector3 intersect = _picker.getTerrainIntersection(getWorldTransform(), _terrainCamera.getLocation(),
                    ray, null, normalStore);
            if (intersect != null) {
                final double distance = intersect.distance(ray.getOrigin());
                final IntersectionRecord record = new IntersectionRecord(new double[] { distance },
                        new Vector3[] { intersect }, new Vector3[] { normalStore }, null);
                return record;
            }
        }
        return null;
View Full Code Here


            if (t[1] > t[0]) {
                final double[] distances = t;
                final Vector3[] points = new Vector3[] {
                        new Vector3(ray.getDirection()).multiplyLocal(distances[0]).addLocal(ray.getOrigin()),
                        new Vector3(ray.getDirection()).multiplyLocal(distances[1]).addLocal(ray.getOrigin()) };
                return new IntersectionRecord(distances, points);
            }

            final double[] distances = new double[] { t[0] };
            final Vector3[] points = new Vector3[] { new Vector3(ray.getDirection()).multiplyLocal(distances[0])
                    .addLocal(ray.getOrigin()), };
            return new IntersectionRecord(distances, points);
        }

        return null;

    }
View Full Code Here

            if (t[1] > t[0]) {
                final double[] distances = t;
                final Vector3[] points = new Vector3[] {
                        rayDir.multiply(distances[0], new Vector3()).addLocal(rayOrigin),
                        rayDir.multiply(distances[1], new Vector3()).addLocal(rayOrigin) };
                final IntersectionRecord record = new IntersectionRecord(distances, points);
                return record;
            }

            final double[] distances = new double[] { t[0] };
            final Vector3[] points = new Vector3[] { rayDir.multiply(distances[0], new Vector3()).addLocal(rayOrigin) };
            final IntersectionRecord record = new IntersectionRecord(distances, points);
            return record;
        }

        return null;
View Full Code Here

            discr = (a1 * a1) - a;
            root = Math.sqrt(discr);
            final double[] distances = new double[] { root - a1 };
            final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3())
                    .addLocal(ray.getOrigin()) };
            return new IntersectionRecord(distances, points);
        }

        a1 = ray.getDirection().dot(diff);
        if (a1 >= 0.0) {
            // No intersection
            return null;
        }

        discr = a1 * a1 - a;
        if (discr < 0.0) {
            return null;
        } else if (discr >= MathUtils.ZERO_TOLERANCE) {
            root = Math.sqrt(discr);
            final double[] distances = new double[] { -a1 - root, -a1 + root };
            final Vector3[] points = new Vector3[] {
                    ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()),
                    ray.getDirection().multiply(distances[1], new Vector3()).addLocal(ray.getOrigin()) };
            final IntersectionRecord record = new IntersectionRecord(distances, points);
            return record;
        }

        final double[] distances = new double[] { -a1 };
        final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3())
                .addLocal(ray.getOrigin()) };
        return new IntersectionRecord(distances, points);
    }
View Full Code Here

        final Vector3[] positions = new Vector3[distances.length];
        for (int i = 0; i < distances.length; i++) {
            positions[i] = ray.getDirection().multiply(distances[i], new Vector3()).addLocal(ray.getOrigin());
        }
        return new IntersectionRecord(distances, positions, primitives);
    }
View Full Code Here

TOP

Related Classes of com.ardor3d.intersection.IntersectionRecord$Intersection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.