# Frame Functions¶

Functions to compute coordinate frames.

```#include <Imath/ImathFrame.h>
```
template<class T>
constexpr Matrix44<T> Imath::firstFrame(const Vec3<T> &pi, const Vec3<T> &pj, const Vec3<T> &pk) noexcept

Compute the first reference frame along a curve.

This function returns the transformation matrix to the reference frame defined by the three points `pi`, `pj` and `pk`. Note that if the two vectors <`pi`,`pj`> and <`pi`,`pk`> are colinears, an arbitrary twist value will be choosen.

Throw `std::domain_error` if `pi` and `pj` are equal.

Parameters:
• pi – First point

• pj – Second point

• pk – Third point

template<class T>
constexpr Matrix44<T> Imath::nextFrame(const Matrix44<T> &Mi, const Vec3<T> &pi, const Vec3<T> &pj, Vec3<T> &ti, Vec3<T> &tj) noexcept

Compute the next reference frame along a curve.

This function returns the transformation matrix to the next reference frame defined by the previously computed transformation matrix and the new point and tangent vector along the curve.

Parameters:
• Mi – The previous matrix

• pi – The previous point

• pj – The current point

• ti – The previous tangent vector

• tj – The current tangent vector

template<class T>
constexpr Matrix44<T> Imath::lastFrame(const Matrix44<T> &Mi, const Vec3<T> &pi, const Vec3<T> &pj) noexcept

Compute the last reference frame along a curve.

This function returns the transformation matrix to the last reference frame defined by the previously computed transformation matrix and the last point along the curve.

Parameters:
• Mi – The previous matrix

• pi – The previous point

• pj – The last point