Package Kinematic

Examples of Kinematic.Vector


     */
    private Vector Force;

    public Ball(Pitch P) {
        OnPitch = P;
        this.Velocity = new Vector(0, 0);
        this.Acceleration = new Vector(0, 0);
        this.Force=new Vector(0, 0);
        this.setLoc(OnPitch.getCenter());
        this.animationTimer = new Timer(RefreshRate, new Ball.TimerHandler());
        this.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Soccer-Ball.png"))); // NOI18N
        this.setSize(10, 10);
    }
View Full Code Here


    }

    public Ball() {
        this.US = 0.4;
        OnPitch = new Pitch();
        this.Velocity = new Vector(0, 0);
        this.Acceleration = new Vector(0, 0);
        this.setLoc(OnPitch.getCenter());
        this.animationTimer = new Timer(RefreshRate, new Ball.TimerHandler());
        this.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Soccer-Ball.png"))); // NOI18N
        this.setSize(10, 10);
    }
View Full Code Here

        Acceleration.x = Force.x / Mass;
        Acceleration.y = Force.y / Mass;
    }

    public void TakeImpact(Point To, double F) {
        Force = new Vector(0, 0);
        From = this.getLoc();
        Teta = (double) (To.y - From.y) / (To.x - From.x);
        Force.x += F * Math.cos(Math.atan(Teta));
        Force.y += F * Math.sin(Math.atan(Teta));
        CalculateAcceleration();
View Full Code Here

        Teta = (double) (To.y - From.y) / (To.x - From.x);
    }

    public void nextFrame() {
        //if (Status.startsWith("Move")) {
            Vector Loc = this.getLoc();
            double t = RefreshRate / 1000.0;
            double nimt2 = 0.5 * Math.pow(t, 2);
            double newX = Acceleration.x * nimt2 + Velocity.x * t + Loc.x;
            double newY = Acceleration.y * nimt2 + Velocity.y * t + Loc.y;
            if (newX >= -OnPitch.getWidth() / 2 && newX <= OnPitch.getWidth() / 2 && newY >= -OnPitch.getHeight() / 2 && newY <= OnPitch.getHeight() / 2) {
View Full Code Here

TOP

Related Classes of Kinematic.Vector

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.