1 package org.simantics.datatypes.literal;
\r
3 import org.simantics.databoard.Bindings;
\r
4 import org.simantics.databoard.binding.Binding;
\r
5 import org.simantics.databoard.util.Bean;
\r
8 final public class Vec2i extends Bean {
\r
10 public static final Binding BINDING = Bindings.getBindingUnchecked(Vec2i.class);
\r
15 public Vec2i(int x, int y) {
\r
21 public boolean isZero() {
\r
22 return x==0 && y==0;
\r
25 public double norm1() {
\r
26 return Math.abs(x) + Math.abs(y);
\r
29 public double norm2() {
\r
30 return Math.sqrt(x*x+y*y);
\r
33 public double length() {
\r
37 public double dot(Vec2i other) {
\r
38 return x*other.x + y*other.y;
\r
41 public Vec2i sum(Vec2i other) {
\r
42 return new Vec2i(x + other.x , y + other.y);
\r
46 public String toString() {
\r
47 return "Vec2i[x=" + x + ", y=" + y + "]";
\r