Package toxi.geom

Examples of toxi.geom.Vec3D.magnitude()


     * distance, weight and spring configuration *
     */
    protected void update(boolean applyConstraints) {
        Vec3D 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));
            if (applyConstraints) {
View Full Code Here


    }

    protected void update(boolean applyConstraints) {
        Vec3D 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

    }

    private static void pointToLine3D(ReadonlyVec3D p, ReadonlyVec3D t,
            Vec3D top, Vec3D out) {
        Vec3D dir = top.sub(p);
        float hyp = dir.magnitude();
        out.set(p.add(t.scale(t.dot(dir.normalize()) * hyp)));
    }

    private static float[][] surfaceMeshParameters(Vec3D points[][], int n,
            int m) {
View Full Code Here

        assertEquals(c, t.fromBarycentric(t.toBarycentric(c)));
        Vec2D p = new Vec2D(0, 0);
        assertEquals(p, t.fromBarycentric(t.toBarycentric(p)));
        // test point outside
        Vec3D bp = t.toBarycentric(new Vec2D(0, -150));
        assertTrue(bp.magnitude() > 1);
    }

    public void testCentroid() {
        Vec2D a = new Vec2D(-100, 0);
        Vec2D b = new Vec2D(0, 100);
View Full Code Here

        dir = Vec3D.randomVector();
    }

    public void update(Vec3D target) {
        Vec3D d = target.sub(this);
        if (d.magnitude() > escapeRadius) {
            set(opos);
            reorientate();
            d = target.sub(this);
        }
        Vec3D ndir = d.getNormalizedTo(searchSpeed);
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.