Skip to content

Commit fa7b3d9

Browse files
committed
This calculation is already provided by Vecmath Point3d.
1 parent 67c24ff commit fa7b3d9

File tree

1 file changed

+8
-6
lines changed
  • descriptor/qsarmolecular/src/main/java/org/openscience/cdk/geometry/surface

1 file changed

+8
-6
lines changed

descriptor/qsarmolecular/src/main/java/org/openscience/cdk/geometry/surface/NeighborList.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020

2121
package org.openscience.cdk.geometry.surface;
2222

23+
import org.openscience.cdk.geometry.GeometryUtil;
24+
import org.openscience.cdk.graph.rebond.Point;
2325
import org.openscience.cdk.interfaces.IAtom;
2426

27+
import javax.vecmath.Point3d;
2528
import java.util.ArrayList;
2629
import java.util.HashMap;
2730
import java.util.List;
@@ -120,12 +123,11 @@ public int[] getNeighbors(int i) {
120123
if (nbrs != null) {
121124
for (Integer nbr : nbrs) {
122125
if (nbr != i) {
123-
IAtom aj = atoms[nbr];
124-
double x12 = aj.getPoint3d().x - atom.getPoint3d().x;
125-
double y12 = aj.getPoint3d().y - atom.getPoint3d().y;
126-
double z12 = aj.getPoint3d().z - atom.getPoint3d().z;
127-
double d2 = x12 * x12 + y12 * y12 + z12 * z12;
128-
if (d2 < maxDist2) result.add(nbr);
126+
IAtom anbr = atoms[nbr];
127+
Point3d p1 = anbr.getPoint3d();
128+
Point3d p2 = atom.getPoint3d();
129+
if (p1.distanceSquared(p2) < maxDist2)
130+
result.add(nbr);
129131
}
130132
}
131133
}

0 commit comments

Comments
 (0)