Package com.ardor3d.math.type

Examples of com.ardor3d.math.type.ReadOnlyVector3


    }

    private void shiftVerticals() {
        final int texWidth = _textureRenderer.getWidth();
        final double xOffset = -(_off * texWidth) / (StatCollector.getMaxSamples() * StatCollector.getSampleRate());
        final ReadOnlyVector3 trans = _verticals.getTranslation();
        _verticals.setTranslation(xOffset, trans.getY(), trans.getZ());
    }
View Full Code Here


    }

    private void shiftVerticals() {
        final int texWidth = _textureRenderer.getWidth();
        final double xOffset = -(_off * texWidth) / (StatCollector.getMaxSamples() * StatCollector.getSampleRate());
        final ReadOnlyVector3 trans = _verticals.getTranslation();
        _verticals.setTranslation(xOffset, trans.getY(), trans.getZ());
    }
View Full Code Here

                    // add line keys
                    entry.lineKey = ((TableLinkable) _linkedGraph).updateLineKey(type, entry.lineKey);
                    if (entry.lineKey.getParent() != _graphRoot) {
                        _graphRoot.attachChild(entry.lineKey);
                    }
                    final ReadOnlyVector3 tLoc = entry.text.getTranslation();
                    entry.lineKey.setTranslation((float) (tLoc.getX() + entry.text.getWidth() + 15), (float) (tLoc
                            .getY() + (.5 * entry.text.getHeight())), 0);
                }

                // update column / row variables
                col++;
View Full Code Here

    }

    public BoundingVolume transformRotational(final ReadOnlyTransform transform, final BoundingVolume store) {

        final ReadOnlyMatrix3 rotate = transform.getMatrix();
        final ReadOnlyVector3 scale = transform.getScale();
        final ReadOnlyVector3 translate = transform.getTranslation();

        BoundingBox box;
        if (store == null || store.getType() != Type.AABB) {
            box = new BoundingBox();
        } else {
View Full Code Here

     * @param plane
     *            the plane to check against.
     */
    @Override
    public Side whichSide(final ReadOnlyPlane plane) {
        final ReadOnlyVector3 normal = plane.getNormal();
        final double radius = Math.abs(getXExtent() * normal.getX()) + Math.abs(getYExtent() * normal.getY())
                + Math.abs(getZExtent() * normal.getZ());

        final double distance = plane.pseudoDistance(_center);

        if (distance < -radius) {
            return Plane.Side.Inside;
View Full Code Here

            return false;
        }

        final Vector3 diff = ray.getOrigin().subtract(_center, _compVect1);

        final ReadOnlyVector3 direction = ray.getDirection();

        final double[] t = { 0.0, Double.POSITIVE_INFINITY };

        // Check for degenerate cases and pad using zero tolerance. Should give close enough result.
        double x = getXExtent();
        if (x < MathUtils.ZERO_TOLERANCE && x >= 0) {
            x = MathUtils.ZERO_TOLERANCE;
        }
        double y = getYExtent();
        if (y < MathUtils.ZERO_TOLERANCE && y >= 0) {
            y = MathUtils.ZERO_TOLERANCE;
        }
        double z = getZExtent();
        if (z < MathUtils.ZERO_TOLERANCE && z >= 0) {
            z = MathUtils.ZERO_TOLERANCE;
        }

        // Special case.
        if (Double.isInfinite(x) && Double.isInfinite(y) && Double.isInfinite(z)) {
            return true;
        }

        final boolean notEntirelyClipped = clip(direction.getX(), -diff.getX() - x, t)
                && clip(-direction.getX(), diff.getX() - x, t) && clip(direction.getY(), -diff.getY() - y, t)
                && clip(-direction.getY(), diff.getY() - y, t) && clip(direction.getZ(), -diff.getZ() - z, t)
                && clip(-direction.getZ(), diff.getZ() - z, t);

        return (notEntirelyClipped && (t[0] != 0.0 || t[1] != Double.POSITIVE_INFINITY));
    }
View Full Code Here

            return null;
        }

        final Vector3 diff = ray.getOrigin().subtract(_center, _compVect1);

        final ReadOnlyVector3 direction = ray.getDirection();

        final double[] t = { 0.0, Double.POSITIVE_INFINITY };

        // Check for degenerate cases and pad using zero tolerance. Should give close enough result.
        double x = getXExtent();
        if (x < MathUtils.ZERO_TOLERANCE && x >= 0) {
            x = MathUtils.ZERO_TOLERANCE;
        }
        double y = getYExtent();
        if (y < MathUtils.ZERO_TOLERANCE && y >= 0) {
            y = MathUtils.ZERO_TOLERANCE;
        }
        double z = getZExtent();
        if (z < MathUtils.ZERO_TOLERANCE && z >= 0) {
            z = MathUtils.ZERO_TOLERANCE;
        }

        final boolean notEntirelyClipped = clip(direction.getX(), -diff.getX() - x, t)
                && clip(-direction.getX(), diff.getX() - x, t) && clip(direction.getY(), -diff.getY() - y, t)
                && clip(-direction.getY(), diff.getY() - y, t) && clip(direction.getZ(), -diff.getZ() - z, t)
                && clip(-direction.getZ(), diff.getZ() - z, t);

        if (notEntirelyClipped && (t[0] != 0.0 || t[1] != Double.POSITIVE_INFINITY)) {
            if (t[1] > t[0]) {
                final double[] distances = t;
                final Vector3[] points = new Vector3[] {
View Full Code Here

        return toReturn;
    }

    @Override
    public Side whichSide(final ReadOnlyPlane plane) {
        final ReadOnlyVector3 planeNormal = plane.getNormal();
        final double fRadius = Math.abs(_extent.getX() * (planeNormal.dot(_xAxis)))
                + Math.abs(_extent.getY() * (planeNormal.dot(_yAxis)))
                + Math.abs(_extent.getZ() * (planeNormal.dot(_zAxis)));
        final double fDistance = plane.pseudoDistance(_center);
        if (fDistance <= -fRadius) {
            return Plane.Side.Inside;
        } else if (fDistance >= fRadius) {
            return Plane.Side.Outside;
View Full Code Here

        final double cutoff = 0.999999;
        boolean parallelPairExists = false;
        int i;

        // convenience variables
        final ReadOnlyVector3 akA[] = new ReadOnlyVector3[] { box0.getXAxis(), box0.getYAxis(), box0.getZAxis() };
        final ReadOnlyVector3[] akB = new ReadOnlyVector3[] { box1.getXAxis(), box1.getYAxis(), box1.getZAxis() };
        final ReadOnlyVector3 afEA = box0._extent;
        final ReadOnlyVector3 afEB = box1._extent;

        // compute difference of box centers, D = C1-C0
        final Vector3 kD = box1._center.subtract(box0._center, _compVect1);

        final double[][] aafC = { new double[3], new double[3], new double[3] };

        final double[][] aafAbsC = { new double[3], new double[3], new double[3] };

        final double[] afAD = new double[3];
        double fR0, fR1, fR; // interval radii and distance between centers
        double fR01; // = R0 + R1

        // axis C0+t*A0
        for (i = 0; i < 3; i++) {
            aafC[0][i] = akA[0].dot(akB[i]);
            aafAbsC[0][i] = Math.abs(aafC[0][i]);
            if (aafAbsC[0][i] > cutoff) {
                parallelPairExists = true;
            }
        }
        afAD[0] = akA[0].dot(kD);
        fR = Math.abs(afAD[0]);
        fR1 = afEB.getX() * aafAbsC[0][0] + afEB.getY() * aafAbsC[0][1] + afEB.getZ() * aafAbsC[0][2];
        fR01 = afEA.getX() + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A1
        for (i = 0; i < 3; i++) {
            aafC[1][i] = akA[1].dot(akB[i]);
            aafAbsC[1][i] = Math.abs(aafC[1][i]);
            if (aafAbsC[1][i] > cutoff) {
                parallelPairExists = true;
            }
        }
        afAD[1] = akA[1].dot(kD);
        fR = Math.abs(afAD[1]);
        fR1 = afEB.getX() * aafAbsC[1][0] + afEB.getY() * aafAbsC[1][1] + afEB.getZ() * aafAbsC[1][2];
        fR01 = afEA.getY() + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A2
        for (i = 0; i < 3; i++) {
            aafC[2][i] = akA[2].dot(akB[i]);
            aafAbsC[2][i] = Math.abs(aafC[2][i]);
            if (aafAbsC[2][i] > cutoff) {
                parallelPairExists = true;
            }
        }
        afAD[2] = akA[2].dot(kD);
        fR = Math.abs(afAD[2]);
        fR1 = afEB.getX() * aafAbsC[2][0] + afEB.getY() * aafAbsC[2][1] + afEB.getZ() * aafAbsC[2][2];
        fR01 = afEA.getZ() + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*B0
        fR = Math.abs(akB[0].dot(kD));
        fR0 = afEA.getX() * aafAbsC[0][0] + afEA.getY() * aafAbsC[1][0] + afEA.getZ() * aafAbsC[2][0];
        fR01 = fR0 + afEB.getX();
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*B1
        fR = Math.abs(akB[1].dot(kD));
        fR0 = afEA.getX() * aafAbsC[0][1] + afEA.getY() * aafAbsC[1][1] + afEA.getZ() * aafAbsC[2][1];
        fR01 = fR0 + afEB.getY();
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*B2
        fR = Math.abs(akB[2].dot(kD));
        fR0 = afEA.getX() * aafAbsC[0][2] + afEA.getY() * aafAbsC[1][2] + afEA.getZ() * aafAbsC[2][2];
        fR01 = fR0 + afEB.getZ();
        if (fR > fR01) {
            return false;
        }

        // At least one pair of box axes was parallel, so the separation is
        // effectively in 2D where checking the "edge" normals is sufficient for
        // the separation of the boxes.
        if (parallelPairExists) {
            return true;
        }

        // axis C0+t*A0xB0
        fR = Math.abs(afAD[2] * aafC[1][0] - afAD[1] * aafC[2][0]);
        fR0 = afEA.getY() * aafAbsC[2][0] + afEA.getZ() * aafAbsC[1][0];
        fR1 = afEB.getY() * aafAbsC[0][2] + afEB.getZ() * aafAbsC[0][1];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A0xB1
        fR = Math.abs(afAD[2] * aafC[1][1] - afAD[1] * aafC[2][1]);
        fR0 = afEA.getY() * aafAbsC[2][1] + afEA.getZ() * aafAbsC[1][1];
        fR1 = afEB.getX() * aafAbsC[0][2] + afEB.getZ() * aafAbsC[0][0];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A0xB2
        fR = Math.abs(afAD[2] * aafC[1][2] - afAD[1] * aafC[2][2]);
        fR0 = afEA.getY() * aafAbsC[2][2] + afEA.getZ() * aafAbsC[1][2];
        fR1 = afEB.getX() * aafAbsC[0][1] + afEB.getY() * aafAbsC[0][0];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A1xB0
        fR = Math.abs(afAD[0] * aafC[2][0] - afAD[2] * aafC[0][0]);
        fR0 = afEA.getX() * aafAbsC[2][0] + afEA.getZ() * aafAbsC[0][0];
        fR1 = afEB.getY() * aafAbsC[1][2] + afEB.getZ() * aafAbsC[1][1];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A1xB1
        fR = Math.abs(afAD[0] * aafC[2][1] - afAD[2] * aafC[0][1]);
        fR0 = afEA.getX() * aafAbsC[2][1] + afEA.getZ() * aafAbsC[0][1];
        fR1 = afEB.getX() * aafAbsC[1][2] + afEB.getZ() * aafAbsC[1][0];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A1xB2
        fR = Math.abs(afAD[0] * aafC[2][2] - afAD[2] * aafC[0][2]);
        fR0 = afEA.getX() * aafAbsC[2][2] + afEA.getZ() * aafAbsC[0][2];
        fR1 = afEB.getX() * aafAbsC[1][1] + afEB.getY() * aafAbsC[1][0];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A2xB0
        fR = Math.abs(afAD[1] * aafC[0][0] - afAD[0] * aafC[1][0]);
        fR0 = afEA.getX() * aafAbsC[1][0] + afEA.getY() * aafAbsC[0][0];
        fR1 = afEB.getY() * aafAbsC[2][2] + afEB.getZ() * aafAbsC[2][1];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A2xB1
        fR = Math.abs(afAD[1] * aafC[0][1] - afAD[0] * aafC[1][1]);
        fR0 = afEA.getX() * aafAbsC[1][1] + afEA.getY() * aafAbsC[0][1];
        fR1 = afEB.getX() * aafAbsC[2][2] + afEB.getZ() * aafAbsC[2][0];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

        // axis C0+t*A2xB2
        fR = Math.abs(afAD[1] * aafC[0][2] - afAD[0] * aafC[1][2]);
        fR0 = afEA.getX() * aafAbsC[1][2] + afEA.getY() * aafAbsC[0][2];
        fR1 = afEB.getX() * aafAbsC[2][1] + afEB.getY() * aafAbsC[2][0];
        fR01 = fR0 + fR1;
        if (fR > fR01) {
            return false;
        }

View Full Code Here

        if (!Vector3.isValid(_center)) {
            return false;
        }

        double rhs;
        final ReadOnlyVector3 rayDir = ray.getDirection();
        final Vector3 diff = _compVect1.set(ray.getOrigin()).subtractLocal(_center);
        final Vector3 wCrossD = _compVect2;

        final double[] fWdU = new double[3];
        final double[] fAWdU = new double[3];
        final double[] fDdU = new double[3];
        final double[] fADdU = new double[3];
        final double[] fAWxDdU = new double[3];

        fWdU[0] = rayDir.dot(_xAxis);
        fAWdU[0] = Math.abs(fWdU[0]);
        fDdU[0] = diff.dot(_xAxis);
        fADdU[0] = Math.abs(fDdU[0]);
        if (fADdU[0] > _extent.getX() && fDdU[0] * fWdU[0] >= 0.0) {
            return false;
        }

        fWdU[1] = rayDir.dot(_yAxis);
        fAWdU[1] = Math.abs(fWdU[1]);
        fDdU[1] = diff.dot(_yAxis);
        fADdU[1] = Math.abs(fDdU[1]);
        if (fADdU[1] > _extent.getY() && fDdU[1] * fWdU[1] >= 0.0) {
            return false;
        }

        fWdU[2] = rayDir.dot(_zAxis);
        fAWdU[2] = Math.abs(fWdU[2]);
        fDdU[2] = diff.dot(_zAxis);
        fADdU[2] = Math.abs(fDdU[2]);
        if (fADdU[2] > _extent.getZ() && fDdU[2] * fWdU[2] >= 0.0) {
            return false;
        }

        rayDir.cross(diff, wCrossD);

        fAWxDdU[0] = Math.abs(wCrossD.dot(_xAxis));
        rhs = _extent.getY() * fAWdU[2] + _extent.getZ() * fAWdU[1];
        if (fAWxDdU[0] > rhs) {
            return false;
View Full Code Here

TOP

Related Classes of com.ardor3d.math.type.ReadOnlyVector3

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.