0
$\begingroup$

It is well known that the area of the triangle (with vertices $a, b, c$) can be calculated as

$ \frac{1}{2}\det\left(\begin{bmatrix} a - c \\ b - c \end{bmatrix}\right) = \frac{1}{2}\det\left(\begin{bmatrix} a_x - c_x, a_y - c_y \\ b_x - c_x, b_y - c_y \end{bmatrix}\right)$

But what if I want to calculate the area of a triangle in 3 (or any higher) dimensions?

I tried to extend the matrix as $ \begin{bmatrix} a_x - c_x, a_y - c_y, a_z - c_z \\ b_x - c_x, b_y - c_y, b_z - c_z \\ 1, 1, 1 \end{bmatrix}$ and $ \begin{bmatrix} a_x - c_x, a_y - c_y, a_z - c_z \\ b_x - c_x, b_y - c_y, b_z - c_z \\ 0, 0, 1 \end{bmatrix}$ but I got incorrect results.

I'm not interested in solutions involving cross products.

  • 1
    See whether this helps you: http://mathworld.wolfram.com/TriangleArea.html2017-02-20

2 Answers 2

1

It is equal to $$ \frac12\sqrt{\det\left(\begin{bmatrix} a_x - c_x, a_y - c_y, a_z - c_z \\ b_x - c_x, b_y - c_y, b_z - c_z \end{bmatrix}\begin{bmatrix} a_x - c_x, a_y - c_y, a_z - c_z \\ b_x - c_x, b_y - c_y, b_z - c_z \end{bmatrix}^T\right)}, $$ where $T$ denotes transposition.

  • 0
    Could you provide a proof of your formula ?2017-02-20
  • 0
    @JeanMarie How can we show that the volume is given by the absolute value of the determinant? The same answer here: we should check the axioms of volume, namely multiplication by scalars, sums of vectors, and normalization. But really the square root is simply the $2$-norm coming from the canonical inner product on the space of alternating forms.2017-02-20
  • 0
    I just realized that the quantity inside the square root of your formula is :$det\begin{pmatrix}\vec{CA}^2&\vec{CA}.\vec{CB}\\ \vec{CB}.\vec{CA}&\vec{CB}^2\end{pmatrix}=\|\vec{CA}\|^2\|\vec{CB}\|^2(1-cos^2(\theta))$ which is indeed equivalent to the formula obtained through the cross product.2017-02-20
  • 0
    Great, I like your proof better than mine. But the OP did eliminate explicitly cross products in his question, and so I also did, on purpose.2017-02-20
  • 1
    @JeanMarie Ah, forgot to mention, my answer extends easily to the $k$-volume determined by $k$ vectors in $\mathbb R^n$ with $k\le n$.2017-02-20
  • 0
    Yes, and this is indeed very interesting because cross-products don't exist outside $\mathbb{R^3}$...2017-02-20
  • 0
    @JeanMarie Actually, cross products do exist in any $n$ dimensions ($n > 0$) as the Hodge dual of the wedge product of $n-1$ vectors. Your solution generalizes this way, by $\frac{1}{n!} |\star(v_0 \wedge v_1 \dots)|$2017-02-20
  • 0
    @JohnB Yeah, I was looking for a solution which generalizes to arbitrary simplex and dimensions. It turns out that your solution is computationally more efficient from dimension 4, while the cross product variant is numerically more stable.2017-02-20
  • 0
    @plasmacel I do agree for the use of the Hodge star. About numerical stability, unless the dimension is high, is it a concern ?2017-02-20
  • 0
    @JeanMarie Well, if at least one of the coordinates is higher, the calculation of the determinant before the square root can easily exceed the precision of single precision floating-point numbers. So you can end up with error $\delta_{error} > 1$. With double precision there is no such error. I tried with $(100,100,0), (200,200,0), (100,200,5000)$ and got an absolute error $\delta_{error} \approx 2$. For some reason the cross product version doesn't suffer from this behavior.2017-02-20
  • 0
    @JeanMarie It think it also depends on the implementation and compiler options.2017-02-20
1

I use cross products, but I convert it in coordinates afterwards, with minimum computations (in particular, there is no need to use matrices):

$$\text{area}=\frac12 \|\vec{AB} \times \vec{AC}\|$$

Explanation: as $\vec{AB}$ and $\vec{AC}$ "live" in a 2D space, we have used here a 2D well known formula.

For a developed form with coordinates, if we set:

$$\begin{pmatrix}u_1\\u_2\\u_3\end{pmatrix}=\begin{pmatrix}x_B-x_A\\y_B-y_A\\z_B-z_A\end{pmatrix} \ \ \text{and} \ \ \begin{pmatrix}v_1\\v_2\\v_3\end{pmatrix}=\begin{pmatrix}x_C-x_A\\y_C-y_A\\z_C-z_A\end{pmatrix} $$

$$\text{area}=\frac12 \sqrt{(u_2v_3-u_3v_2)^2+(u_3v_1-u_1v_3)^2+(u_1v_2-u_2v_1)^2}$$