Reputation: 869
I have three points in 3D space. I'd like to use these to construct a circle (it is always possible to do so, see Circumscribed_circle. For two of the points, I'd also like to find the triangle altitude formed by these points and the coordinate origin.
The calculations need to be fast - the equations I've found so far involve lots of square roots, so I was wondering if anyone knew of suitable algorithms or ways to restate the problem.
Thanks in advance!
Upvotes: 2
Views: 2149
Reputation: 321
For the circumcircle, it can be done using this formula
m = a + (|c-a|^2 [(b-a)x(c-a)]x(b-a) + |b-a|^2 (c-a)x[(b-a)x(c-a)]) / (2 | (b-a)x(c-a) |^2)
Where a, b, and c are points in R^3, and m is the center of the circumcircle you are looking for. No sqrt needed.
Source: https://www.ics.uci.edu/~eppstein/junkyard/circumcenter.html
Upvotes: 2
Reputation: 12592
You can add a 4 dimension and lift the points to a paraboloid. Then get the convex hull and project back to the surface. This works with a delaunay triangulation. Here is a similar question but for 2 dimension: How does this code for delaunay triangulation work?.
Upvotes: 2