## Introduction

I'm reading on surface geometry^{[1]}, as an entrypoint into ray tracing. I've also been reading on web GPU fundamentals, GPUs generally and how computer graphics work.

## Tetrahedron

A tetrahedron has four triangular faces. This means it has four vertices, you can think of them as X, Y, Z and origin coordinates. It also has six edges.

Triangles are important in computer graphics because any surface can be built as a set of triangles called a mesh.

## OFF and Mesh

OFF^{[2]} is a simple binary protocol that lets you define your vertices and faces. In the case of a tethrahedron, the off file looks like:

```
OFF
4 4 0
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
0.0 0.0 0.0
3 0 1 2
3 0 2 3
3 0 1 3
3 1 2 3
```

`4 4 0`

- means 4 vertices, 4 faces and 0 edges (ignored).

The next four lines define the co-ordinates of the vertices.

Eg. `1.0 0.0 0.0`

- means the (X, Y, Z) coordinates.

The subsequent four lines define each face and which vertices combine to form it.

Eg `3 0 1 2`

- means this face is a combination of 3 vertices. Vertices at index 0, 1 and 2.

Mesh is the library used to import and render the OFF file. Other file formats exist like OBJ.

The rendered tetrahedron looks like: