Game Development Reference
In-Depth Information
Figure 27 - A triangle's surface normal is given by the cross product of the vectors formed by its vertices.
As we will see when we discuss Rendering Primitives , we can use the surface normal of a
triangleasoneofthebasisvectorstodefineatransformation.Atransformationfromwhich
we can procedurally generate the geometry for a quad. This is a useful technique that can
be used to procedurally generate geometry used by user interface systems such as augmen-
ted reality .
1.4.1.5Rectangles
Rectangles are very useful when developing user interfaces, they are often the shape used
to create containers within which any number of UI elements reside, we also use this rect-
angle shape as boundaries within which the user interface, a collection of buttons, labels,
etc. must exist; this could mean we do not allow these elements to leave said boundaries,
or we may decide to clip these UI elements against the rectangle, leaving them partially
visible within.
At the time of this writing, computer screens are still rectangular, therefore our work is
already bound within a rectangle. An axis aligned rectangle is described by a point and a
size.Thepointrepresentsthetopleftcorneroftherectangle,thesizeconsistsofscalarsfor
width and height. It is convenient to represent rectangles in this manner because with this
information we can calculate the right and bottom coordinates, and simplify some calcula-
tions down the line.
An oriented rectangle is one which may contain an orientation parameter, this parameter is
an angle in radians that represents how much to rotate the rectangle by. In addition to an
Search WWH ::




Custom Search