123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- package me.hammerle.supersnuvi.math;
- public class Vector implements IVector
- {
- private float x = 0.0f;
- private float y = 0.0f;
-
- public Vector(float x, float y)
- {
- this.x = x;
- this.y = y;
- }
-
- public Vector()
- {
- this(0.0f, 0.0f);
- }
-
- public void setX(float x)
- {
- this.x = x;
- }
-
- public void setY(float y)
- {
- this.y = y;
- }
-
- public void set(float x, float y)
- {
- this.x = x;
- this.y = y;
- }
-
- public void set(Vector v)
- {
- set(v.x, v.y);
- }
-
- public void add(float x, float y)
- {
- this.x += x;
- this.y += y;
- }
-
- public void add(Vector v)
- {
- add(v.x, v.y);
- }
-
- public void addY(float y)
- {
- this.y += y;
- }
-
- public void addX(float x)
- {
- this.x += x;
- }
-
- public void mul(Vector v)
- {
- x *= v.x;
- y *= v.y;
- }
- @Override
- public float getX()
- {
- return x;
- }
- @Override
- public float getY()
- {
- return y;
- }
- @Override
- public String toString()
- {
- return String.format("Vector(x = %f, y = %f)", x, y);
- }
- }
|