## Topics for v2.x

## Topics for v1.x

## Expression snippets

Here is a few snippets of expression code that can be useful from time to time.

**Create/place point on circle**

```
pos.x = cos(radians)*radius;
pos.y = sin(radians)*radius;
```

**Create/place a random point on unit sphere**
The point will be in the x,y,z variables

```
z = srand();
t = 2.0 * PI * rand();
w = sqrt(1.0 - z*z);
x = w * cos(t);
y = w * sin(t);
```

**Rotate existing point around x axis**

```
newpos.y = pos.y*cos(radians) - pos.z*sin(radians);
newpos.z = pos.y*sin(radians) + pos.z*cos(radians);
```

**Rotate existing point around y axis**

```
newpos.z = pos.z*cos(radians) - pos.x*sin(radians);
newpos.x = pos.z*sin(radians) + pos.x*cos(radians);
```

**Rotate existing point around z axis**

```
newpos.x = pos.x*cos(radians) - pos.y*sin(radians);
newpos.y = pos.x*sin(radians) + pos.y*cos(radians);
```