-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVertex.java
More file actions
33 lines (28 loc) · 769 Bytes
/
Vertex.java
File metadata and controls
33 lines (28 loc) · 769 Bytes
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
/**
* Created by sayleebhide on 11/30/17.
*/
import java.util.HashMap;
public class Vertex
{
PointO point;
HashMap visibleVertices;
String label;
public Vertex(PointO _point, String _label)
{
point = _point;
visibleVertices = new HashMap();
label =_label;
}
public void addVisibleVertex(Vertex vert)
{
visibleVertices.put(vert, Math.sqrt( (this.point.x - vert.point.x)*(this.point.x - vert.point.x) + (this.point.y - vert.point.y)*(this.point.y - vert.point.y) ));
}
public HashMap getAllVisibleVertices()
{
return visibleVertices;
}
public Double getDistance(Vertex vert)
{
return (Double)visibleVertices.get(vert);
}
}