-
Notifications
You must be signed in to change notification settings - Fork 13
/
KVector.java
53 lines (41 loc) · 1.11 KB
/
KVector.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.fleen.geom_Kisrhombille;
/*
* diamond vector
* direction and distance
* direction is integer in range [0,11]. We have 12 directions in a diamond plane.
* distance is double.
* A sum of integers (1s and 2s) or integer multiples of sqrt3.
* Or some relative proportion thereof
*/
public class KVector{
/*
* ################################
* CONSTRUCTORS
* ################################
*/
public KVector(){}
public KVector(int direction,double distance){
this.direction=direction;
this.distance=distance;}
/*
* ################################
* GEOMETRY
* ################################
*/
public int direction;
public double distance;
/*
* ################################
* OBJECT
* ################################
*/
public boolean equals(Object a){
KVector b=(KVector)a;
return direction==b.direction&&distance==b.distance;}
public int hashCode(){
int a=direction*65536+(int)distance;
return a;}
public String toString(){
String s="["+direction+","+distance+"]";
return s;}
}