Skip to content

Commit

Permalink
update circumcircle calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
dnanto committed Apr 7, 2024
1 parent b7dfd1e commit 580cef8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions democapsid/src/capsid.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,9 @@ def facets(self, sphericity=0, lattice=HEXAGONAL):


def triangle_circumcircle_center(p, q, r):
v1, v2 = q - p, r - p
m1, m2 = p + (v1 / 2), p + (v2 / 2)
u1 = m1 + roro(v1, np.array([1, 0, 0]), np.pi / 2)
u2 = m2 + roro(v2, np.array([1, 0, 0]), np.pi / 2)
a, b, c = u1 - m1, u2 - m2, m2 - m1
cross_ab = np.cross(a, b)
return m1 + a * (np.dot(np.cross(c, b), cross_ab) / np.linalg.norm(cross_ab) ** 2)
# https://en.wikipedia.org/wiki/Circumcircle#Higher_dimensions
a, b = p - r, q - r
return np.cross(np.dot(np.linalg.norm(a) ** 2, b) - np.dot(np.linalg.norm(b) ** 2, a), np.cross(a, b)) / (2 * np.linalg.norm(np.cross(a, b)) ** 2) + r


def tetrahedron_circumsphere_center(v0, v1, v2, v3):
Expand Down

0 comments on commit 580cef8

Please sign in to comment.