Examples of magnitude()


Examples of edu.ucla.sspace.vector.DoubleVector.magnitude()

        } else {
            List<DoubleVector> scaledVectors =
                new ArrayList<DoubleVector>(matrix.rows());
            for (int r = 0; r < matrix.rows(); ++r) {
                DoubleVector v = matrix.getRowVector(r);
                scaledVectors.add(new ScaledDoubleVector(v, 1/v.magnitude()));
            }
            return Matrices.asMatrix(scaledVectors);
        }
    }
View Full Code Here

Examples of edu.ucla.sspace.vector.SparseDoubleVector.magnitude()

                new ArrayList<SparseDoubleVector>(matrix.rows());
            SparseMatrix sm = (SparseMatrix) matrix;
            for (int r = 0; r < matrix.rows(); ++r) {
                SparseDoubleVector v = sm.getRowVector(r);
                scaledVectors.add(new ScaledSparseDoubleVector(
                            v, 1/v.magnitude()));
            }
            return Matrices.asSparseMatrix(scaledVectors);
        } else {
            List<DoubleVector> scaledVectors =
                new ArrayList<DoubleVector>(matrix.rows());
View Full Code Here

Examples of edu.ucla.sspace.vector.SparseDoubleVector.magnitude()

        } else {
            List<DoubleVector> scaledVectors =
                new ArrayList<DoubleVector>(matrix.rows());
            for (int r = 0; r < matrix.rows(); ++r) {
                DoubleVector v = matrix.getRowVector(r);
                scaledVectors.add(new ScaledDoubleVector(v, 1/v.magnitude()));
            }
            return Matrices.asMatrix(scaledVectors);
        }
    }
View Full Code Here

Examples of mikera.vectorz.AVector.magnitude()

    AVector axis = Vectorz.createUniformRandomVector(3);
    double angle = Math.random();
    Matrix33 rot = Matrixx.createRotationMatrix(axis, angle);

    AVector r = rot.transform(v);
    assertEquals(v.magnitude(), r.magnitude(), 0.00001);

    Matrix33 inv = rot.inverse();
    AVector ri = inv.transform(r);
    assertTrue(v.epsilonEquals(ri));
  }
View Full Code Here

Examples of mikera.vectorz.AVector.magnitude()

      AMatrix m = Matrixx.createScaleMatrix(i, 2.3);

      m.transform(v, tv);

      assertEquals(v.magnitude() * 2.3, tv.magnitude(), 0.0001);
    }
  }

  @Test
  public void testBasicDeterminant() {
View Full Code Here

Examples of mikera.vectorz.AVector.magnitude()

   
    AVector r=rot.transform(v);
    assertEquals(v.get(0),r.get(0),0.00001);
    assertEquals(v.get(1),r.get(1),0.00001);
    assertEquals(v.get(2),r.get(2),0.00001);
    assertEquals(v.magnitude(),r.magnitude(),0.00001);
    assertTrue(r.epsilonEquals(v));
  }
 
  private void doInverseTest(AMatrix m) {
    assert(m.rowCount()==m.columnCount());
View Full Code Here

Examples of ptolemy.math.Complex.magnitude()

     @param y The second complex number.
     *  @return The distance.
     */
    private double _computeEuclideanDistance(Complex x, Complex y) {
        Complex z = x.subtract(y);
        return z.magnitude();
    }

    ///////////////////////////////////////////////////////////////////
    ////                         private variables                 ////
    // Local cache of these parameter values.
View Full Code Here

Examples of ptolemy.math.Complex.magnitude()

            for (int j = 0; j < _columnCount; j++) {
                sum = sum.add(_value[i][j]);
            }
        }

        return (int) sum.magnitude();
    }

    /** Join a matrix of matrices into a single matrix by tiling.
     *  All matrices in the matrix must be of the same type,
     *  the same type as this matrix. But none of them needs to
View Full Code Here

Examples of toxi.geom.Vec2D.magnitude()

    }

    public void apply(VerletParticle2D p) {
        Vec2D delta = p.sub(rootPos);
        float heading = MathUtils.floor(delta.heading() / theta) * theta;
        p.set(rootPos.add(Vec2D.fromTheta(heading).scaleSelf(delta.magnitude())));
    }

}
View Full Code Here

Examples of toxi.geom.Vec2D.magnitude()

    }

    protected void update(boolean applyConstraints) {
        Vec2D delta = b.sub(a);
        // add minute offset to avoid div-by-zero errors
        float dist = delta.magnitude() + EPS;
        float normDistStrength = (dist - restLength)
                / (dist * (a.invWeight + b.invWeight)) * strength;
        if (!a.isLocked && !isALocked) {
            a.addSelf(delta.scale(normDistStrength * a.invWeight).limit(limit));
            if (applyConstraints) {
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.