Package javax.vecmath

Examples of javax.vecmath.Point2d.scale()


        int ct = 0;
        for ( int i = 0; i < snakeData_.getNumSegments(); i += 2 ) {
            ct++;
            center.add( segment_[i].getCenterParticle() );
        }
        center.scale( 1.0 / (double) ct );
        return center;
    }

    /**
     * shift/translate the whole snake by the specified vector
View Full Code Here


        Point2d centerOfMass = new Point2d(0, 0);

        for (Creature c : friends) {
            centerOfMass.add(c.getLocation());
        }
        centerOfMass.scale(1.0/friends.size());

        double directionToCOM = MathUtil.getDirectionTo(getLocation(), centerOfMass);

        direction = (nearestFriend.direction + directionToCOM) / 2.0;
    }
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.