Game Development Reference

In-Depth Information

In the context of UI programming it is important to understand how geometry is repres-

ented at its most basic level, whenever we are faced with the need to generate geometry

procedurally, it is through triangles that we will create or approximate other shapes.

It is also important to understand how we can use triangle data to interact with the game

world's geometry. There are a number of tests we can do to understand more the game

world.

Figure 26 - A triangle is given by 3 vertices.

Triangles, in Euclidian geometry have the property of being planar as long as its vertices

are not collinear,this means we can use a triangle to define a plane. Inrare occasions when

rendering, it may happen that the vertices of a triangle are collinear, this results in a degen-

erate triangle.

Given a triangle we can calculate the plane defined by its vertices.

Where
n
is the triangle's surface normal, the direction in which the triangle is facing.