> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sdk-user-guide/_mcp/server.

# holoscan::SO3

> Class representing 3D rotations using the SO(3) group.

```cpp showLineNumbers={false}
template <typename K>
class SO3
```

Class representing 3D rotations using the SO(3) group.

This class represents rotations in 3D space as elements of the special orthogonal group SO(3). Internally, rotations are stored as unit quaternions to ensure numerical stability and efficient composition operations.

```cpp showLineNumbers={false}
#include <holoscan/so3.hpp>
```

**Template parameters**

**`K`** `typename`

Scalar type (typically float or double).

---

---

## Constructors

### SO3 \[#so3]

#### Default

```cpp showLineNumbers={false}
holoscan::SO3<K>::SO3()
```

Default constructor creates an uninitialized quaternion.

Use identity() to create an identity rotation.

#### Copy

explicit

```cpp showLineNumbers={false}
holoscan::SO3<K>::SO3(
    const Quaternion<K> &quaternion
)
```

Private constructor from quaternion.

**Parameters**

**`quaternion`** `const Quaternion<K> &`

Unit quaternion representing the rotation.

---

---

## Methods

### axis \[#axis]

```cpp showLineNumbers={false}
Vector3<K> holoscan::SO3<K>::axis() const
```

Get the rotation axis.

**Returns:** Normalized rotation axis.

### angle \[#angle]

```cpp showLineNumbers={false}
K holoscan::SO3<K>::angle() const
```

Get the angle of rotation around the axis.

This calls a trigonometric function.

**Returns:** Rotation angle in radians.

### quaternion \[#quaternion]

```cpp showLineNumbers={false}
const Quaternion<K> & holoscan::SO3<K>::quaternion() const
```

Get the quaternion representation of the rotation.

**Returns:** Unit quaternion representing the rotation.

### matrix \[#matrix]

```cpp showLineNumbers={false}
Matrix3<K> holoscan::SO3<K>::matrix() const
```

Get the 3×3 rotation matrix representation.

**Returns:** 3×3 rotation matrix.

### euler\_angles\_rpy \[#euleranglesrpy]

```cpp showLineNumbers={false}
Vector3<K> holoscan::SO3<K>::euler_angles_rpy() const
```

Get the roll, pitch, yaw Euler angles of the rotation.

**Returns:** [Vector](../typedefs/vector) containing (roll, pitch, yaw) angles in radians.

### inverse \[#inverse]

```cpp showLineNumbers={false}
SO3 holoscan::SO3<K>::inverse() const
```

Get the inverse rotation.

**Returns:** Inverse rotation.

### cast \[#cast]

#### Const (1)

```cpp showLineNumbers={false}
template <typename S>
SO3<S> holoscan::SO3<K>::cast() const
```

Cast to a different scalar type.

**Returns:** Rotation cast to the target type.

**Template parameters**

**`S`** `typename`

Target scalar type.

---

#### Const (2)

```cpp showLineNumbers={false}
template <typename S>
const SO3 & holoscan::SO3<K>::cast() const
```

Cast to the same scalar type (no-op).

**Returns:** Reference to this rotation.

**Template parameters**

**`S`** `typename`

Target scalar type (same as K).

---

### to\_so2\_xy \[#toso2xy]

```cpp showLineNumbers={false}
SO2<K> holoscan::SO3<K>::to_so2_xy() const
```

Convert to a 2D rotation in the XY plane.

**Returns:** 2D rotation representing the Z-axis component of this 3D rotation.

### vector\_rotation\_jacobian \[#vectorrotationjacobian]

```cpp showLineNumbers={false}
Matrix<K, 3, 4> holoscan::SO3<K>::vector_rotation_jacobian(
    const Vector3<K> &n
) const
```

Compute the Jacobian of the rotation of a normal vector.

Plane normals only have rotation components.

**Returns:** 3×4 Jacobian matrix.

**Parameters**

**`n`** `const Vector3<K> &`

Normal vector to compute Jacobian for.

---

---

## Static methods

### identity \[#identity]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::identity()
```

Create the identity rotation.

**Returns:** Identity rotation (no rotation).

### from\_scaled\_axis \[#fromscaledaxis]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_scaled_axis(
    const Vector3<K> &axis_angle
)
```

Create rotation which rotates around the given axis by the magnitude of the axis.

**Returns:** Rotation around the scaled axis.

**Parameters**

**`axis_angle`** `const Vector3<K> &`

Scaled axis vector where the magnitude represents the rotation angle.

---

### from\_axis\_angle \[#fromaxisangle]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_axis_angle(
    const Vector3<K> &axis,
    K angle
)
```

Create rotation which rotates by an angle around a given axis.

**Returns:** Rotation around the given axis by the specified angle.

**Parameters**

**`axis`** `const Vector3<K> &`

Rotation axis (will be normalized internally).

---

**`angle`** `K`

Rotation angle in radians.

---

### from\_angle\_axis \[#fromangleaxis]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_angle_axis(
    K angle,
    const Vector3<K> &axis
)
```

Create rotation from angle and axis (alternative parameter order).

**Returns:** Rotation around the given axis by the specified angle.

**Parameters**

**`angle`** `K`

Rotation angle in radians.

---

**`axis`** `const Vector3<K> &`

Rotation axis (will be normalized internally).

---

### from\_quaternion \[#fromquaternion]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_quaternion(
    const Quaternion<K> &quaternion
)
```

Create rotation from a (not necessarily normalized) quaternion.

**Returns:** Rotation represented by the normalized quaternion.

**Parameters**

**`quaternion`** `const Quaternion<K> &`

[Quaternion](../typedefs/quaternion) representation (will be normalized internally).

---

### from\_normalized\_quaternion \[#fromnormalizedquaternion]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_normalized_quaternion(
    const Quaternion<K> &quaternion
)
```

Create rotation from a normalized quaternion.

This will assert if the quaternion does not have unit length.

**Returns:** Rotation represented by the quaternion.

**Parameters**

**`quaternion`** `const Quaternion<K> &`

Normalized quaternion representation.

---

### from\_so2\_xy \[#fromso2xy]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_so2_xy(
    const SO2<K> &rotation
)
```

Create a 3D rotation from a 2D rotation in the XY plane.

**Returns:** 3D rotation equivalent to the 2D rotation around the Z-axis.

**Parameters**

**`rotation`** `const SO2<K> &`

2D rotation in the XY plane.

---

### from\_matrix \[#frommatrix]

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_matrix(
    const Matrix<K, 3, 3> &matrix
)
```

Create rotation from a 3×3 rotation matrix.

**Returns:** Rotation represented by the matrix.

**Parameters**

**`matrix`** `const Matrix<K, 3, 3> &`

3×3 Rotation matrix.

---

### from\_euler\_angles\_rpy \[#fromeuleranglesrpy]

#### Create rotation from roll/pitch/yaw Euler angles

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_euler_angles_rpy(
    K roll_angle,
    K pitch_angle,
    K yaw_angle
)
```

Create rotation from roll/pitch/yaw Euler angles.

**Returns:** Rotation representing the given Euler angles.

**Parameters**

**`roll_angle`** `K`

Roll angle in radians (rotation around X-axis).

---

**`pitch_angle`** `K`

Pitch angle in radians (rotation around Y-axis).

---

**`yaw_angle`** `K`

Yaw angle in radians (rotation around Z-axis).

---

#### Create rotation from Euler angles vector

```cpp showLineNumbers={false}
static SO3 holoscan::SO3<K>::from_euler_angles_rpy(
    const Vector3d &roll_pitch_yaw
)
```

Create rotation from Euler angles vector.

**Returns:** Rotation representing the given Euler angles.

**Parameters**

**`roll_pitch_yaw`** `const Vector3d &`

[Vector](../typedefs/vector) containing (roll, pitch, yaw) angles in radians.

---

---

## Types

### Typedefs

| Name     | Definition |
| -------- | ---------- |
| `Scalar` | `K`        |

---

## Member variables

| Name                          | Type              | Description                         |
| ----------------------------- | ----------------- | ----------------------------------- |
| `kDimension` static constexpr | `int`             |                                     |
| `quaternion_`                 | `Quaternion< K >` | Internal quaternion representation. |