# Coordinates of octahedron's vertices and checking if a point is inside it.

Given that I have the distance between the center of an octahedron and any of its faces (regular octahedron, so all the distances are equal), how can I calculate the coordinates of its vertices, considering that the octahedron may have rotation in any of the 3 Euler angles? I can't find this formula anywhere and I'm having serious trouble calculating it. Also, after calculating the coordinates of the vertices, I need to check if a point is inside or outside the octahedron. I am thinking of doing something like:

$\alpha_1 = dR *\frac{L_1}{L_1^2}$

$\alpha_2 = dR * \frac{L_2}{L_2^2}$

$\alpha_3 = dR * \frac{L_3}{L_3^2}$

And dR is the vector from the point being checked to the center of the octahedron. $L_1$, $L_2$ and $L_3$ are the vectors from the center of the octahedron to the nearest vertices to the point. And then if:

$\alpha_1 + \alpha_2 + \alpha_3 \leq 1$

The point is inside the octahedron. Is my calculation correct? Sorry if this question is confusing, I've never posted a question in a math forum and I'm not a native English speaker.

## 1 Answer

Wikipedia says that the radius of an inscribed sphere (tangent to each of the octahedron's faces) is $r=L/\sqrt 6$, where $L$ is the length of the edges of the octahedron's. The distance you know is this radius. The coordinates of the vertices are $(\pm R,0,0)$, $(0,\pm R,0)$, $(0,0,\pm R)$, where $R$ is the radius of a circumscribed sphere and which is given by $R=L/\sqrt 2=r \sqrt 3$.

These are the coordinates of the octahedron in standard position. To rotate it, apply a rotation matrix.

Finally, to check whether a point is inside the octahedron (rotated or not), orient the faces consistently outward and check whether the point is on the same (negative) side of the all faces (that is, of their planes).