Next: Maths Utilities Up: 2D and 3D vector Previous: 3D Rotation Functions   Contents

## 3D Transformation Functions

```Transform3 *trans3_alloc(void)
```
Returns a pointer to a new (unit) Transform3.

```Transform3 *trans3_make(Mat3 R, Vec3 t)
```
Returns a pointer to a new (unit) Transform3 with given rotation and translation.

```Transform3 *trans3_copy(Transform3 * transf)
```
Returns a pointer to a new copy of *transf.

```void    trans3_free(void *transf)
```
Frees the Transform3 pointed to by transf (provided for completeness, it just calls rfree).

```Transform3 trans3_unit(void)
```
Returns a unit transformation (i.e. one that leaves vectors unchanged).

```Transform3 trans3_prod(Transform3 transf2, Transform3 transf1)
```
Returns the composition of the transformations transf2 and transf1 (i.e. transf1 first then transf2).

```Transform3 trans3_inverse(Transform3 transf)
```
Returns the inverse of the transformation transf.

```Vec3    trans3_pos(Transform3 transf, Vec3 v)
```
Returns the transform by transf of the position v, i.e R*v+t.

```Vec3    trans3_inverse_pos(Transform3 transf, Vec3 v)
```
Returns the inverse transform by transf of the position v.

```Vec3    trans3_vec(Transform3 transf, Vec3 v)
```
Returns the transform by transf of the direction v, i.e R*v, (translation does not affect directions).

```Vec3    trans3_inverse_vec(Transform3 transf, Vec3 v)
```
Returns the inverse transform by transf of the direction v.

```void    trans3_get_frame1in2(Transform3 transf, Vec3 * p,
Vec3 * ex, Vec3 * ey, Vec3 * ez)
```
Sets the position *p of the origin and the directions *ei of the axes of coordinate frame1 in frame2.

```void    trans3_get_frame2in1(Transform3 transf, Vec3 * p,
Vec3 * ex, Vec3 * ey, Vec3 * ez)
```
Sets the position *p of the origin and the directions *ei of the axes of coordinate frame2 in frame1.

```Vec3    trans3_get_origin2in1(Transform3 transf)
```

Returns the position of the origin of frame2 in frame1. (trans3_get_origin1in2 is not supplied, it would just return transf.t).

```Transform3 trans3_from_frame(Vec3 p, Vec3 ex, Vec3 ey, Vec3 ez)
```
Returns the transformation for which the position of the origin and the axes of frame1 in frame2 are given by p, ex, ey, ez).

```Transform3 trans3_to_frame(Vec3 p, Vec3 ex, Vec3 ey, Vec3 ez)
```
Returns the transformation for which the position of the origin and the axes of frame2 in frame1 are given by p, ex, ey, ez).

```Transform3 trans3_from_frame_to_frame(Vec3 p1, Vec3 ex1, Vec3 ey1, Vec3 ez1,
Vec3 p2, Vec3 ex2, Vec3 ey2, Vec3 ez2)
```
Returns the transformation for which the position of the origin and axes of frame1 and frame2 are given by p1, ex1, ey1, ez1 and p2, ex2, ey2, ez2 respectively in some third frame.

```void trans3_print(FILE *fp, Transform3 trans)
```
Prints out the transformation transf in ascii to a file pointer, first the rows of the rotation matrix, then the translation vector using %f and no newlines.

```void trans3_format(Transform3 trans)
```
Writes out the transformation transf as above to the Tina textsw or standard output.

Next: Maths Utilities Up: 2D and 3D vector Previous: 3D Rotation Functions   Contents
root 2019-03-24