Examples of ReadOnlyTransform


Examples of com.ardor3d.math.type.ReadOnlyTransform

            return true;
        }
        if (!(o instanceof ReadOnlyTransform)) {
            return false;
        }
        final ReadOnlyTransform comp = (ReadOnlyTransform) o;
        return _matrix.equals(comp.getMatrix())
                && Math.abs(_translation.getX() - comp.getTranslation().getX()) < Transform.ALLOWED_DEVIANCE
                && Math.abs(_translation.getY() - comp.getTranslation().getY()) < Transform.ALLOWED_DEVIANCE
                && Math.abs(_translation.getZ() - comp.getTranslation().getZ()) < Transform.ALLOWED_DEVIANCE
                && Math.abs(_scale.getX() - comp.getScale().getX()) < Transform.ALLOWED_DEVIANCE
                && Math.abs(_scale.getY() - comp.getScale().getY()) < Transform.ALLOWED_DEVIANCE
                && Math.abs(_scale.getZ() - comp.getScale().getZ()) < Transform.ALLOWED_DEVIANCE;
    }
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

            return true;
        }
        if (!(o instanceof ReadOnlyTransform)) {
            return false;
        }
        final ReadOnlyTransform comp = (ReadOnlyTransform) o;
        return _matrix.strictEquals(comp.getMatrix()) && _scale.equals(comp.getScale())
                && _translation.equals(comp.getTranslation());
    }
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

        _rotations = new ReadOnlyQuaternion[transforms.length];
        _translations = new ReadOnlyVector3[transforms.length];
        _scales = new ReadOnlyVector3[transforms.length];

        for (int i = 0; i < transforms.length; i++) {
            final ReadOnlyTransform transform = transforms[i];
            if (!transform.isRotationMatrix()) {
                TransformChannel.logger.warning("TransformChannel '" + channelName
                        + "' supplied transform with non-rotational matrices.  May have unexpected results.");
            }
            _rotations[i] = new Quaternion().fromRotationMatrix(transform.getMatrix()).normalizeLocal();
            _translations[i] = new Vector3(transform.getTranslation());
            _scales[i] = new Vector3(transform.getScale());
        }
    }
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

        if (thisCT == null || checkCT == null) {
            return false;
        }

        final ReadOnlyTransform worldTransform = testMesh.getWorldTransform();
        thisCT.getBounds().transform(worldTransform, thisCT.getWorldBounds());
        return thisCT.intersect(checkCT);
    }
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

            }
            return false;
        }

        // both are leaves
        final ReadOnlyTransform transformA = getMesh().getWorldTransform();
        final ReadOnlyTransform transformB = collisionTree.getMesh().getWorldTransform();

        final MeshData dataA = getMesh().getMeshData();
        final MeshData dataB = collisionTree.getMesh().getMeshData();

        Vector3[] storeA = null;
        Vector3[] storeB = null;

        // for every primitive to compare, put them into world space and check for intersections
        for (int i = _start; i < _end; i++) {
            storeA = dataA.getPrimitiveVertices(_primitiveIndices[i], _section, storeA);
            // to world space
            for (int t = 0; t < storeA.length; t++) {
                transformA.applyForward(storeA[t]);
            }
            for (int j = collisionTree._start; j < collisionTree._end; j++) {
                storeB = dataB.getPrimitiveVertices(collisionTree._primitiveIndices[j], collisionTree._section, storeB);
                // to world space
                for (int t = 0; t < storeB.length; t++) {
                    transformB.applyForward(storeB[t]);
                }
                if (Intersection.intersection(storeA, storeB)) {
                    return true;
                }
            }
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

        }

        // both this node and the testing node are leaves. Therefore, we can
        // switch to checking the contained primitives with each other. Any
        // that are found to intersect are placed in the appropriate list.
        final ReadOnlyTransform transformA = getMesh().getWorldTransform();
        final ReadOnlyTransform transformB = collisionTree.getMesh().getWorldTransform();

        final MeshData dataA = getMesh().getMeshData();
        final MeshData dataB = collisionTree.getMesh().getMeshData();

        Vector3[] storeA = null;
        Vector3[] storeB = null;

        boolean test = false;

        for (int i = _start; i < _end; i++) {
            storeA = dataA.getPrimitiveVertices(_primitiveIndices[i], _section, storeA);
            // to world space
            for (int t = 0; t < storeA.length; t++) {
                transformA.applyForward(storeA[t]);
            }
            for (int j = collisionTree._start; j < collisionTree._end; j++) {
                storeB = dataB.getPrimitiveVertices(collisionTree._primitiveIndices[j], collisionTree._section, storeB);
                // to world space
                for (int t = 0; t < storeB.length; t++) {
                    transformB.applyForward(storeB[t]);
                }
                if (Intersection.intersection(storeA, storeB)) {
                    test = true;
                    aList.add(new PrimitiveKey(_primitiveIndices[i], _section));
                    bList.add(new PrimitiveKey(collisionTree._primitiveIndices[j], collisionTree._section));
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

        } else if (_left == null) {
            // This is a leaf node. We can therefore check each primitive this node contains. If an intersection occurs,
            // place it in the list.

            final MeshData data = getMesh().getMeshData();
            final ReadOnlyTransform transform = getMesh().getWorldTransform();

            Vector3[] points = null;
            for (int i = _start; i < _end; i++) {
                points = data.getPrimitiveVertices(_primitiveIndices[i], _section, points);
                for (int t = 0; t < points.length; t++) {
                    transform.applyForward(points[t]);
                }
                if (ray.intersects(points, null)) {
                    result.add(new PrimitiveKey(_primitiveIndices[i], _section));
                }
            }
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

        final int width = getLocalComponentWidth();
        return getRelativeComponentBounds(rVal, width, height);
    }

    private Rectangle2 getRelativeComponentBounds(final Rectangle2 store, final int width, final int height) {
        final ReadOnlyTransform local = getTransform();
        if (local.isIdentity() || local.getMatrix().isIdentity()) {
            store.set(0, 0, width, height);
        } else {
            float minX, maxX, minY, maxY;
            final Vector3 t = Vector3.fetchTempInstance();

            t.set(width, height, 0);
            local.applyForwardVector(t);
            minX = Math.min(t.getXf(), 0);
            maxX = Math.max(t.getXf(), 0);
            minY = Math.min(t.getYf(), 0);
            maxY = Math.max(t.getYf(), 0);

            t.set(0, height, 0);
            local.applyForwardVector(t);
            minX = Math.min(t.getXf(), minX);
            maxX = Math.max(t.getXf(), maxX);
            minY = Math.min(t.getYf(), minY);
            maxY = Math.max(t.getYf(), maxY);

            t.set(width, 0, 0);
            local.applyForwardVector(t);
            minX = Math.min(t.getXf(), minX);
            maxX = Math.max(t.getXf(), maxX);
            minY = Math.min(t.getYf(), minY);
            maxY = Math.max(t.getYf(), maxY);
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

     *
     * @param width
     * @param height
     */
    public void fitComponentIn(final int width, final int height) {
        final ReadOnlyTransform local = getTransform();
        if (local.isIdentity() || local.getMatrix().isIdentity()) {
            setLocalComponentSize(width, height);
            return;
        }

        final Vector3 temp = Vector3.fetchTempInstance();
        temp.set(1, 0, 0);
        local.applyForwardVector(temp);
        if (Math.abs(temp.getX()) >= 0.99999) {
            setLocalComponentSize(width, height);
        } else if (Math.abs(temp.getY()) >= 0.99999) {
            setLocalComponentSize(height, width);
        } else {
View Full Code Here

Examples of com.ardor3d.math.type.ReadOnlyTransform

        SubTexUtil._vals[5] = height;
        SubTexUtil._vals[6] = 0;
        SubTexUtil._vals[7] = height;

        // Set our transform
        final ReadOnlyTransform worldT = appliedTransform != null ? appliedTransform : Transform.IDENTITY;
        final Vector3 v = Vector3.fetchTempInstance();
        v.set(x, y, 0);
        SubTexUtil._helperT.set(worldT);
        SubTexUtil._helperT.applyForwardVector(v);
        SubTexUtil._helperT.translate(v);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.