예제 #1
0
 public Vec2 smallestn(Vec2 b) {
   if (this.lengthSquared() > b.lengthSquared()) {
     return b;
   } else {
     return this;
   }
 }
예제 #2
0
 public Vec2 biggestn(Vec2 b) {
   if (this.lengthSquared() < b.lengthSquared()) {
     return b;
   } else {
     return this;
   }
 }
예제 #3
0
 @Override
 public int compareTo(Vec2 v) {
   if (this == v) {
     return 0;
   } else {
     float l = this.lengthSquared();
     float vl = v.lengthSquared();
     if (l < vl) {
       return -1;
     } else if (l == vl) {
       return 0;
     } else {
       return 1;
     }
   }
 }
예제 #4
0
 public Vec2 projectn(Vec2 onthisv) {
   Vec2 n = dup();
   n.project(onthisv);
   return n;
 }
예제 #5
0
 public void smallest(Vec2 b) {
   if (this.lengthSquared() > b.lengthSquared()) {
     x = b.x;
     y = b.y;
   }
 }
예제 #6
0
 public void biggest(Vec2 b) {
   if (this.lengthSquared() < b.lengthSquared()) {
     x = b.x;
     y = b.y;
   }
 }
예제 #7
0
 public Vec2 setLengthn(float v) {
   Vec2 n = this.normalisen();
   n.scale(v);
   return n;
 }
예제 #8
0
 public Vec2 normalisen() {
   Vec2 n = this.dup();
   n.normalise();
   return n;
 }