holoscan::SO2

Beta
View as Markdown
template <typename K>
class SO2

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

This class represents rotations in 2D space as elements of the special orthogonal group SO(2). Internally, rotations are stored as normalized direction vectors (cos, sin) to avoid trigonometric function calls during composition and transformation operations.

#include <holoscan/so2.hpp>

Template parameters

K
typename

Scalar type (typically float or double).


Constructors

SO2

holoscan::SO2<K>::SO2()

Default constructor creates an undefined rotation.

Use identity() to create the identity rotation.


Methods

cos

K holoscan::SO2<K>::cos() const

Get the cosine of the rotation angle.

This is a simple getter and does not call trigonometric functions.

Returns: Cosine of the rotation angle.

sin

K holoscan::SO2<K>::sin() const

Get the sine of the rotation angle.

This is a simple getter and does not call trigonometric functions.

Returns: Sine of the rotation angle.

as_direction

const Vector2<K> & holoscan::SO2<K>::as_direction() const

Get the cos and sin of the rotation angle as a direction vector.

Returns: Direction vector (cos, sin).

angle

K holoscan::SO2<K>::angle() const

Get the rotation angle in range [-π, π].

This uses a call to a trigonometric function.

Returns: Rotation angle in radians.

matrix

Matrix2<K> holoscan::SO2<K>::matrix() const

Get the 2×2 rotation matrix representation.

Returns: 2×2 rotation matrix.

inverse

SO2 holoscan::SO2<K>::inverse() const

Get the inverse rotation.

Returns: Inverse rotation.

cast

template <typename S>
SO2<S> holoscan::SO2<K>::cast() const

Cast to a different scalar type.

Returns: Rotation cast to the target type.

Template parameters

S
typename

Target scalar type.


Static methods

identity

static SO2 holoscan::SO2<K>::identity()

Create the identity rotation.

Returns: Identity rotation (no rotation).

from_angle

static SO2 holoscan::SO2<K>::from_angle(
K angle
)

Create rotation from an angle.

This uses calls to trigonometric functions.

Returns: Rotation representing the given angle.

Parameters

angle
K

Rotation angle in radians.

from_direction

static SO2 holoscan::SO2<K>::from_direction(
const Vector2<K> &direction
)

Create rotation from a not necessarily normalized direction vector.

Returns: Rotation aligned with the given direction.

Parameters

direction
const Vector2<K> &

Direction vector (will be normalized internally).

from_normalized

static SO2 holoscan::SO2<K>::from_normalized(
const Vector2<K> &cos_sin
)

Create rotation from a normalized cos/sin direction vector.

Returns: Rotation represented by the given cos/sin values.

Parameters

cos_sin
const Vector2<K> &

Normalized direction vector (cos, sin).


Types

Typedefs

NameDefinition
ScalarK

Member variables

NameTypeDescription
kDimension static constexprint
cos_sin_Vector2< K >Internal representation as (cos, sin) direction vector.