# Glossary of Terms

### From Physics Simulation Wiki

To be able to get Bullet to interact with your rendering system, etc, there's a few terms that are helpful to know.

## Contents |

## Basic Items

### Scalar

A "scalar" is mostly a posh word for "number". It's a linear value, just like "1.0" or "1.23 * 10^75". You build up the other items in this section from collections of scalars.

For example, the distance between two points is a scalar, and speed [not velocity! see below] is a scalar [eg, X meters per second]

### Vector, Vector3, Vector4

A "vector" is best understood as a scalar and a direction. [in "polar co-ordinates", below]. It's a certain distance travelled in a certain direction. This is how velocity is measured [eg, "75 miles an hour, north-north-east"].

Alternatively, in euler co-ordinates, it's a group of numbers such as "A units along the X axis, B units along the Y axis, and C units along the Z axis", or (x,y,z). This is typically how most people imagine vectors. Computers being what they are, vectors are usually described in this manner. This is what a Vector3 is.

A vector4 is a vector through four dimensions.

To get the length of a vector [for polar co-ordinates] from a vector3, use pythagoras' theorem . Typically vector3 objects provide a .length() method]. Getting the angles isn't usually very useful in practice, but can be done using basic trigonometry.

You'll see that pythagoras' theorem uses a sqrt function. These are expensive in computers, so if you can avoid using it, do so. Most vector objects provide a length2() or lengthsquared() method. This will return the value calculated before the sqrt. If you're trying to find out whether the distance between two things is less than a particular threshold, it's usually wise to compare the length2() with the square of the threshold. eg:

#define THRESHOLD 20 #define THRESHOLD_SQ THRESHOLD*THRESHOLD // Your compiler will optimise this out later Vector3 a(12,14,20); if(THRESHOLD > a.length()) { do_something; } // This one is much slower if(THRESHOLD_SQ > a.length2()) {do_something; } // Use this version if you can

### Euler co-ordinates

Euler co-ordinates are one way of describing a position in space. Mostly, people think in euler co-ordinates when they imagine a vector3, (x,y,z).

### Polar co-ordinates

Polar co-ordinates are a different way of describing a position in space. Typically for polar co-ordinates, you give a scalar that is the distance, and a direction. For example, "ten meters straight north" is a co-ordinate described in polar terms.

### Euler Angle

An euler angle is the usual naive implementation of a rotation. It's the normal, human, way to understand rotations; "rotate around the X axis by A, rotate around the Y axis by B, rotate around the Z axis by C". Typically presented as a Vector3, (a,b,c).

Computers are linear beasts. They do operations in order - attempting to rotate by an euler angle on a computer will usually rotate by the X axis, then the Y axis, then the Z axis. This leads to something called "Gimbal Lock", and is Very Bad. [youtube video explaining gimbal lock].

In short, don't use euler angles. Use quaternions to represent rotations. Any toolkit you use will provide facilities to operate on quaternions, and to convert euler angles [if you have them as an input source] into quaternions.

### AxisAngle

An AxisAngle [you don't see them much in Bullet] is a rotation around an axis. It's a way to describe a rotation. Given a three-dimensional axis [represented as a vector] and a rotation by an angle around that axis [represented as a scalar], you can describe any normal rotation in three-dimensional space.

### Quaternion

A computer scientist talking about quaternions is a *great* way to antagonise a mathematician. In general [mathematically], a quaternion is something made up of four "co-ordinates", all of which are in imaginary planes.

For the purposes of computer games and physics simulations, a quaternion is basically a way to implement rotations that don't suffer from gimbal lock.

Typically, quaternions are implementable as a Vector4, but with an understanding of the operations on quaternions, it's possible to build a much more useful class - and this is what most toolkits will provide.

## Compound Items

Given the terms described above, you can build more complex things. The author finds it a lot easier to mentally grasp the compound items in this section by keeping them as their separate entities.

### Transform

A transform is a translation [vector] plus a rotation [quaternion]. A "transform" alone is usually sufficient to describe everything you need to use to map a physics body [in Bullet] into your graphical rendering system.

### Matrix

Usually a "matrix" is a transform.

Keep in mind that the system you're using for rendering [D3D, OpenGL, Torque] may work on a "matrix", but the matrix may not be represented the same way, item-by-item, in your rendering system as it is in another rendering system, or as it is in a Bullet transform.

## Physics Terms

### Rigid Body

A "rigid body" is what it sounds like - an item of fixed mass, size, and other physical properties. It's the base individual item in physics simulations.

### Soft Body

Imagine a rigid body, but squidgy. The mass doesn't change, but the shape of it can.

### Joint, constraint

A "constraint" is a what Bullet calls a joint - which is exactly what it sounds like. It's a something that connects bodies together, in certain ways.

For example, a constraint may restrict all rotational movement, or may be a "hinge" - it allows rotation around one and only one axis, and allows no movement of the bodies with respect to each other.

### World

All bodies, soft and rigid, in a simulation go inside of a "world". They can be connected by constraints. The entire simulation is a "world".