Trsf

class Trsf

Transformation.

This class represents a transformation in 3D space. It can be used to scale, translate and rotate points. This transformation is using homogeneous coordinates under the hood. Transformations can be chained together using the multiplication operator or by applying transformation using method chaining.

Public Functions

Trsf &scale(double factor)

Scale this transformation isotropicly.

Parameters:

factor – Scaling factor

Returns:

Resulting transformation

Trsf &scale(double factor_x, double factor_y, double factor_z = 1.)

Scale this transformation anisotropicly.

Parameters:
  • factor_x – scaling factor in x direction

  • factor_y – scaling factor in y direction

  • factor_z – scaling factor in z direction

Returns:

Resulting transformation

Trsf &translate(double tx, double ty, double tz = 0.)

Translate this transformation.

Parameters:
  • tx – Translation in x direction

  • ty – Translation in y direction

  • tz – Translation in z direction

Returns:

Resulting transformation

Trsf &rotate_x(double theta)

Rotate this transformation around x axis.

Parameters:

theta – Rotation angle in radians

Returns:

Resulting transformation

Trsf &rotate_y(double theta)

Rotate this transformation around y axis.

Parameters:

theta – Rotation angle in radians

Returns:

Resulting transformation

Trsf &rotate_z(double theta)

Rotate this transformation around z axis.

Parameters:

theta – Rotation angle in radians

Returns:

Resulting transformation

Trsf operator*(const Trsf &other) const

Apply transformation.

Parameters:

other – Transformation to apply

Returns:

Composition of transformations

Trsf &operator*=(const Trsf &other)

Apply transformation.

Parameters:

other – Transformation to apply

Returns:

Composition of transformations

Point operator*(const Point &other) const

Apply transformation to point.

Parameters:

pointPoint to transform

Returns:

Transformed point

Public Static Functions

static Trsf scaled(double factor)

Create isotropic scaling transformation.

Parameters:

factor – Scaling factor

Returns:

Scaling transformation

static Trsf scaled(double factor_x, double factor_y, double factor_z = 1.)

Create anisotropic scaling transformation.

Parameters:
  • factor_x – scaling factor in x direction

  • factor_y – scaling factor in y direction

  • factor_z – scaling factor in z direction

Returns:

Scaling transformation

static Trsf translated(double tx, double ty, double tz = 0.)

Create translation transformation.

Parameters:
  • tx – Translation in x direction

  • ty – Translation in y direction

  • tz – Translation in z direction

Returns:

Translation transformation

static Trsf rotated_x(double theta)

Create rotation transformation around z axis.

Parameters:

theta – Rotation angle in radians

Returns:

Rotation transformation

static Trsf rotated_y(double theta)

Create rotation transformation around y axis.

Parameters:

theta – Rotation angle in radians

Returns:

Rotation transformation

static Trsf rotated_z(double theta)

Create rotation transformation around z axis.

Parameters:

theta – Rotation angle in radians

Returns:

Rotation transformation

static Trsf identity()

Create identity transformation.

Returns:

Identity transformation