X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.datatypes%2Fsrc%2Forg%2Fsimantics%2Fdatatypes%2Fliteral%2FVec2d.java;fp=bundles%2Forg.simantics.datatypes%2Fsrc%2Forg%2Fsimantics%2Fdatatypes%2Fliteral%2FVec2d.java;h=4158e1c95059d464aa4837c3f6c9235dfe39fe35;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=44ff33688df606c377e1bfccd7d0045c503c62de;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2d.java b/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2d.java index 44ff33688..4158e1c95 100644 --- a/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2d.java +++ b/bundles/org.simantics.datatypes/src/org/simantics/datatypes/literal/Vec2d.java @@ -1,54 +1,54 @@ -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 Vec2d extends Bean { - - public static final Binding BINDING = Bindings.getBindingUnchecked(Vec2d.class); - - public double x; - public double y; - - public Vec2d(double x, double y) { - super(BINDING); - this.x = x; - this.y = y; - } - - public boolean isZero() { - return x==0.0 && y==0.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(Vec2d other) { - return x*other.x + y*other.y; - } - - public Vec2d sum(Vec2d other) { - return new Vec2d(x + other.x , y + other.y); - } - - public Vec2d subtraction(Vec2d other) { - return new Vec2d(x - other.x , y - other.y); - } - - @Override - public String toString() { - return "Vec2d[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 Vec2d extends Bean { + + public static final Binding BINDING = Bindings.getBindingUnchecked(Vec2d.class); + + public double x; + public double y; + + public Vec2d(double x, double y) { + super(BINDING); + this.x = x; + this.y = y; + } + + public boolean isZero() { + return x==0.0 && y==0.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(Vec2d other) { + return x*other.x + y*other.y; + } + + public Vec2d sum(Vec2d other) { + return new Vec2d(x + other.x , y + other.y); + } + + public Vec2d subtraction(Vec2d other) { + return new Vec2d(x - other.x , y - other.y); + } + + @Override + public String toString() { + return "Vec2d[x=" + x + ", y=" + y + "]"; + } + +}