}
public int compare(Object o1, Object o2) {
N3Point3D node1Pos = ((N3Node) o1).getPosition();
N3Point3D node2Pos = ((N3Node) o2).getPosition();
N3Vector3D node1Vector = new N3Vector3D(node1Pos.x - p.x,
node1Pos.y - p.y, node1Pos.z - p.z);
N3Vector3D node2Vector = new N3Vector3D(node2Pos.x - p.x,
node2Pos.y - p.y, node2Pos.z - p.z);
float node1Dist = node1Vector.length();
float node2Dist = node2Vector.length();
if (node1Dist < node2Dist)
return -1;
if (node1Dist > node2Dist)
return 1;
return 0;