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 Vec2d extends Bean {
\r
10 public static final Binding BINDING = Bindings.getBindingUnchecked(Vec2d.class);
\r
15 public Vec2d(double x, double y) {
\r
21 public boolean isZero() {
\r
22 return x==0.0 && y==0.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(Vec2d other) {
\r
38 return x*other.x + y*other.y;
\r
41 public Vec2d sum(Vec2d other) {
\r
42 return new Vec2d(x + other.x , y + other.y);
\r
45 public Vec2d subtraction(Vec2d other) {
\r
46 return new Vec2d(x - other.x , y - other.y);
\r
50 public String toString() {
\r
51 return "Vec2d[x=" + x + ", y=" + y + "]";
\r