X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.datatypes%2Fsrc%2Forg%2Fsimantics%2Fdatatypes%2Fliteral%2FVec2i.java;h=b25e8eacbc3831c8c6461c1f84e743b5aa76e700;hp=2b0c0a81ffa96156d65fedf268327ddae4915c68;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2i.java b/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2i.java index 2b0c0a81f..b25e8eacb 100644 --- a/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2i.java +++ b/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2i.java @@ -1,50 +1,50 @@ -package org.simantics.datatypes.literal; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.binding.Binding; -import org.simantics.databoard.util.Bean; - - -final public class Vec2i extends Bean { - - public static final Binding BINDING = Bindings.getBindingUnchecked(Vec2i.class); - - public int x; - public int y; - - public Vec2i(int x, int y) { - super(BINDING); - this.x = x; - this.y = y; - } - - public boolean isZero() { - return x==0 && y==0; - } - - public double norm1() { - return Math.abs(x) + Math.abs(y); - } - - public double norm2() { - return Math.sqrt(x*x+y*y); - } - - public double length() { - return norm2(); - } - - public double dot(Vec2i other) { - return x*other.x + y*other.y; - } - - public Vec2i sum(Vec2i other) { - return new Vec2i(x + other.x , y + other.y); - } - - @Override - public String toString() { - return "Vec2i[x=" + x + ", y=" + y + "]"; - } - -} +package org.simantics.datatypes.literal; + +import org.simantics.databoard.Bindings; +import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.util.Bean; + + +final public class Vec2i extends Bean { + + public static final Binding BINDING = Bindings.getBindingUnchecked(Vec2i.class); + + public int x; + public int y; + + public Vec2i(int x, int y) { + super(BINDING); + this.x = x; + this.y = y; + } + + public boolean isZero() { + return x==0 && y==0; + } + + public double norm1() { + return Math.abs(x) + Math.abs(y); + } + + public double norm2() { + return Math.sqrt(x*x+y*y); + } + + public double length() { + return norm2(); + } + + public double dot(Vec2i other) { + return x*other.x + y*other.y; + } + + public Vec2i sum(Vec2i other) { + return new Vec2i(x + other.x , y + other.y); + } + + @Override + public String toString() { + return "Vec2i[x=" + x + ", y=" + y + "]"; + } + +}