Package org.geotools.referencing.operation.matrix

Examples of org.geotools.referencing.operation.matrix.GeneralMatrix


     * Weight p = 1 / accuracy<sup>2<sup>.
     * @param include if true then the weights will be included onto the calculation. False is default.
     * @throws FactoryException if all or some of the {@linkplain #setMappedPositions(List) points} does not have accuracy setup properly.
     */
    public void includeWeights(boolean include) throws MissingInfoException {
        this.P = new GeneralMatrix(getMappedPositions().size() * 2,
                getMappedPositions().size() * 2);

        if (include) {
            fillPMatrix();
        } else {
View Full Code Here


            } catch (FactoryException e) {
                // should never reach here - weights are not included
            }
        }

        GeneralMatrix AT = (GeneralMatrix) A.clone();
        AT.transpose();

        GeneralMatrix ATP = new GeneralMatrix(AT.getNumRow(), P.getNumCol());
        GeneralMatrix ATPA = new GeneralMatrix(AT.getNumRow(), A.getNumCol());
        GeneralMatrix ATPX = new GeneralMatrix(AT.getNumRow(), 1);
        GeneralMatrix x = new GeneralMatrix(A.getNumCol(), 1);
        ATP.mul(AT, P); // ATP
        ATPA.mul(ATP, A); // ATPA
        ATPX.mul(ATP, X); // ATPX
        ATPA.invert();       
        x.mul(ATPA, ATPX);
        ATPA.invert();

        x.transpose();

        return x.getElements()[0];
    }
View Full Code Here

     * </pre>
     *
     * @return Matrix M
     */
    protected GeneralMatrix getProjectiveMatrix() {
        GeneralMatrix M = new GeneralMatrix(3, 3);

        // double[] param = generateMMatrix();
        double[] param = calculateLSM();
        double[] m0 = { param[0], param[1], param[2] };
        double[] m1 = { param[3], param[4], param[5] };
        double[] m2 = { param[6], param[7], 1 };
        M.setRow(0, m0);
        M.setRow(1, m1);
        M.setRow(2, m2);

        return M;
    }
View Full Code Here

     * @param vectors list of {@linkplain MappedPosition mapped positions}.
     */
    public BursaWolfTransformBuilder(final List<MappedPosition> vectors) {
        super.setMappedPositions(vectors);

        x = new GeneralMatrix(vectors.size(), 3);
        X = new GeneralMatrix(vectors.size(), 3);
        x = getx();
        X = getX();
        this.getDxMatrix();
    }
View Full Code Here

     *
     * @return x matrix.
     */
    protected GeneralMatrix getx() {
        final DirectPosition[] sourcePoints = getSourcePoints();
        GeneralMatrix x = new GeneralMatrix(3 * sourcePoints.length, 1);

        for (int j = 0; j < (x.getNumRow()); j = j + 3) {
            x.setElement(j, 0, sourcePoints[j / 3].getCoordinate()[0]);
            x.setElement(j + 1, 0, sourcePoints[j / 3].getCoordinate()[1]);
            x.setElement(j + 2, 0, sourcePoints[j / 3].getCoordinate()[2]);
        }

        return x;
    }
View Full Code Here

     * @return the X matrix
     */
    protected GeneralMatrix getX() {
        final DirectPosition[] sourcePoints = getSourcePoints();
        final DirectPosition[] targetPoints = getTargetPoints();
        GeneralMatrix X = new GeneralMatrix(3 * sourcePoints.length, 1);

        for (int j = 0; j < (X.getNumRow()); j = j + 3) {
            X.setElement(j, 0, targetPoints[j / 3].getCoordinate()[0]);
            X.setElement(j + 1, 0, targetPoints[j / 3].getCoordinate()[1]);
            X.setElement(j + 2, 0, targetPoints[j / 3].getCoordinate()[2]);
        }

        return X;
    }
View Full Code Here

     * Generates rotation matrix around X axis.
     *
     * @return rotation Matrix
     */
    protected GeneralMatrix getRalfa() {
        GeneralMatrix Ralfa = new GeneralMatrix(3, 3);
        double[] m0 = { 1, 0, 0 };
        double[] m1 = { 0, Math.cos(alfa), Math.sin(alfa) };
        double[] m2 = { 0, -Math.sin(alfa), Math.cos(alfa) };
        Ralfa.setRow(0, m0);
        Ralfa.setRow(1, m1);
        Ralfa.setRow(2, m2);

        return Ralfa;
    }
View Full Code Here

     * Generates rotation matrix around Y axis.
     *
     * @return rotation Matrix.
     */
    protected GeneralMatrix getRbeta() {
        GeneralMatrix Rbeta = new GeneralMatrix(3, 3);
        double[] m0 = { Math.cos(beta), 0, -Math.sin(beta) };
        double[] m1 = { 0, 1, 0 };
        double[] m2 = { Math.sin(beta), 0, Math.cos(beta) };
        Rbeta.setRow(0, m0);
        Rbeta.setRow(1, m1);
        Rbeta.setRow(2, m2);

        return Rbeta;
    }
View Full Code Here

     * Generates rotation matrix around Z axis.
     *
     * @return rotation Matrix.
     */
    protected GeneralMatrix getRgamma() {
        GeneralMatrix Rgamma = new GeneralMatrix(3, 3);
        double[] m0 = { Math.cos(gamma), Math.sin(gamma), 0 };
        double[] m1 = { -Math.sin(gamma), Math.cos(gamma), 0 };
        double[] m2 = { 0, 0, 1 };
        Rgamma.setRow(0, m0);
        Rgamma.setRow(1, m1);
        Rgamma.setRow(2, m2);

        return Rgamma;
    }
View Full Code Here

     *
     * @return Matrix, that represents partial derivation of rotation Matrix
     *         with respect to  alfa.
     */
    protected GeneralMatrix getDRalfa() {
        GeneralMatrix dRa = new GeneralMatrix(3, 3);

        double[] m0 = { 0, 0, 0 };
        double[] m1 = { 0, -Math.sin(alfa), Math.cos(alfa) };
        double[] m2 = { 0, -Math.cos(alfa), -Math.sin(alfa) };

        dRa.setRow(0, m0);
        dRa.setRow(1, m1);
        dRa.setRow(2, m2);

        dRa.mul(dRa, getRbeta());
        dRa.mul(dRa, getRgamma());

        return specialMul(dRa, x);
    }
View Full Code Here

TOP

Related Classes of org.geotools.referencing.operation.matrix.GeneralMatrix

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.