开发者

Given three points on a tetrahedron, Find the 4th

开发者 https://www.devze.com 2023-01-28 23:47 出处:网络
If you have an equilateral triangle in 3D space, where all the sides are of length 1, there are two points that you could use to form a tetrahedron. One floating out in front of the triangle, and one

If you have an equilateral triangle in 3D space, where all the sides are of length 1, there are two points that you could use to form a tetrahedron. One floating out in front of the triangle, and one behind it. Given the coordinates of the three known vertices, how would you calculate either of the possible fourth vertices?

I would really appreciate it if you can show how to do it with the Pr开发者_开发知识库ocessing vector class definition


Average your three points to get the center of the triangle:

center = (a + b + c) / 3

Calculate the normal vector by taking the cross product of two of the sides:

normal = (c - a) x (b - a)

Normalize the normal vector (make it of unit length):

unit_normal = normal / |normal|

Scale the normal by the height of regular tetrahedron:

scaled_normal = unit_normal * sqrt(2/3)

Now, your two points are:

top = center + scaled_normal
bottom = center - scaled_normal


(a + b + c)/3 (centre of the triangle)

+/- ((a-b) x (b-c) (cross product of two sides of the triangle, hence perpendicular to both)

* some constant or other) (the height of a regular tetrahedron divided by the length of that cross product, the length being 1 * 1 * sin(60 degrees) = sqrt(3)/2)

This can probably be simplified.

[Edit: height is sqrt(2/3), so the constant is 2*sqrt(2)]

[Second edit: any fourth point not in the plane of the first three forms a tetrahedron. ITYM a regular tetrahedron ;-)]


Since, 3D has never been my interest, I guess I can only provide a way to do this, rather than exact coordinates.

A point which lies at a distance of sqrt(2/3) from the centroid of the triangle and on a line perpendicular to the plane formed by the triangle and containing the centroid.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号