src.core.transforms package#

Submodules#

src.core.transforms.euler_angles module#

src.core.transforms.euler_angles.Rx(theta)[source]#

Theta: angle in radians

Returns: 3x3 rotation matrix about x axis

src.core.transforms.euler_angles.Ry(theta)[source]#

Theta: angle in radians

Returns: 3x3 rotation matrix about y axis

src.core.transforms.euler_angles.Rz(theta)[source]#

Theta: angle in radians

Returns: 3x3 rotation matrix about z axis

src.core.transforms.euler_angles.rotation_matrix_x_y_x(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_x_y_z(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_x_z_x(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_x_z_y(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_y_x_y(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_y_x_z(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_y_z_x(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_y_z_y(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_z_x_y(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_z_x_z(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_z_y_x(alpha, beta, gamma)[source]#
src.core.transforms.euler_angles.rotation_matrix_z_y_z(alpha, beta, gamma)[source]#

src.core.transforms.flexibility module#

class src.core.transforms.flexibility.ConstantF[source]#

Bases: Flexibility_Transform

ConstantF Class#

No-operation (identity) flexibility transform.

This transform returns the input 3D point array unchanged. It can be used in contexts where no deformation is required but the pipeline expects a transform instance.

(None)
__call__(input_, t):

Returns the input array without applying any deformation.

class src.core.transforms.flexibility.Flexibility_Transform[source]#

Bases: object

Flexibility_Transform Class#

Abstract base class for all time-dependent flexibility transforms in the FlapKine framework.

This class serves as a blueprint for defining spatial deformation transforms that vary over time. It enforces implementation of the __call__ method in subclasses, where the actual transformation logic is defined.

(None)
__call__(input_, t):

Abstract method to apply the deformation to a 3D input array at time t. Must be implemented by derived classes.

class src.core.transforms.flexibility.Flexibility_type1(x, y, z, major_axis, minor_axis, time_period=100, p=0.5)[source]#

Bases: Flexibility_Transform

Flexibility_type1 Class#

Sinusoidal deformation transform along selectable axes.

Applies periodic sinusoidal deformations to a 3D point cloud based on time t and configurable parameters such as axis selection, time period, and waveform shape. The deformation magnitude at each point depends on its cross-axes (e.g., YZ affects X).

x#

Whether to apply deformation along the X-axis.

Type:

bool

y#

Whether to apply deformation along the Y-axis.

Type:

bool

z#

Whether to apply deformation along the Z-axis.

Type:

bool

major_axis#

Controls the primary axis for sinusoidal wave generation.

Type:

bool

minor_axis#

Controls the secondary axis used in wave generation.

Type:

bool

time_period#

Period of the sinusoidal deformation in time steps.

Type:

float

p#

Controls the steepness and sharpness of the waveform.

Type:

float

__init__(x, y, z, major_axis, minor_axis, time_period=100, p=0.5):

Initializes the transform with axis configuration and waveform parameters.

__call__(input_, t):

Applies the sinusoidal deformation along enabled axes at time t.

class src.core.transforms.flexibility.Flexibility_type2(x, y, z, min_minor_axis, major_axis, minor_axis, array_values, time_period=100, p=0.5)[source]#

Bases: Flexibility_Transform

Flexibility_type2 Class#

Empirical deformation transform driven by a time-dependent value array.

Applies deformative forces to a 3D point cloud based on a user-provided array_values, which modulates the waveform amplitude over time. Useful for applying non-analytical or externally generated flexibility profiles (e.g., sensor or simulation data).

x#

Whether to apply deformation along the X-axis.

Type:

bool

y#

Whether to apply deformation along the Y-axis.

Type:

bool

z#

Whether to apply deformation along the Z-axis.

Type:

bool

min_minor_axis#

Lower bound for the minor axis parameter in waveform generation.

Type:

float

major_axis#

Primary shaping parameter for the sinusoidal wave.

Type:

float

minor_axis#

Secondary shaping parameter for the sinusoidal wave.

Type:

float

array_values#

Time-indexed array containing modulation values for the waveform.

Type:

np.ndarray

time_period#

Period of the waveform over time.

Type:

float

p#

Shape parameter for the waveform’s slope and intensity.

Type:

float

__init__(x, y, z, min_minor_axis, major_axis, minor_axis, array_values, time_period=100, p=0.5):

Initializes the transform with axis settings, waveform configuration, and dynamic amplitude data.

__call__(input_, t):

Applies deformation at time t using values from the external array.

src.core.transforms.functional_flexibility module#

src.core.transforms.functional_flexibility.functional_Flexibility_type1(x, y, t, major_axis, minor_axis, time_period, p)[source]#

Computes the Z-axis displacement of a point on a flexible surface using an elliptical deformation model.

This function models the time-dependent vertical displacement Z_M_x_y_t of a surface (e.g., a flexible wing or membrane) based on its spatial coordinates (x, y), time t, and geometric parameters such as major_axis, minor_axis, and a curvature parameter p. The deformation is modulated using a sinusoidal waveform and normalized using tanh shaping.

Parameters:
  • x (float) – X-coordinate of the point on the surface (along the major axis).

  • y (float) – Y-coordinate of the point on the surface (along the minor axis).

  • t (float) – Time variable controlling the phase of the deformation waveform.

  • major_axis (float) – Length of the semi-major axis of the elliptical surface.

  • minor_axis (float) – Length of the semi-minor axis of the elliptical surface.

  • time_period (float) – Period over which the waveform completes one oscillation.

  • p (float) – Curvature parameter (typically in range [0, 1]) defining the shape profile across the surface span.

Returns:

The computed Z-axis displacement Z_M_x_y_t at position (x, y) and time t.

Return type:

float

src.core.transforms.functional_flexibility.functional_Flexibility_type2(x, y, y_min, Z_M_x_t, major_axis, minor_axis, time_period, p=0.5)[source]#

Computes the Z-axis displacement of a point using a modified elliptical deformation model (Type 2).

This function calculates the vertical displacement Z_M_x_y_t for a point on a flexible structure (such as a deformable wing) based on its spatial location (x, y), a minimum Y reference (y_min), and a time-dependent displacement amplitude Z_M_x_t. This Type 2 variation suppresses motion for span-wise locations below a threshold defined by the parameter p.

Parameters:
  • x (float) – X-coordinate of the point on the surface (along the major axis). (Not used in current formula.)

  • y (float) – Y-coordinate of the point on the surface (along the minor axis).

  • y_min (float) – Minimum Y-coordinate on the surface (used to normalize y across span).

  • Z_M_x_t (float) – Time-varying amplitude at the given X-location, typically precomputed for each time frame.

  • major_axis (float) – Length of the semi-major axis of the elliptical surface.

  • minor_axis (float) – Length of the semi-minor axis of the elliptical surface.

  • time_period (float) – Oscillation period of the deformation waveform (not directly used in this implementation).

  • p (float, optional) – Curvature parameter (default is 0.5) that controls the span-wise shaping of the deformation.

Returns:

The computed Z-axis displacement Z_M_x_y_t at the given (x, y) and time t.

Return type:

float

src.core.transforms.rotation module#

class src.core.transforms.rotation.ConstantR[source]#

Bases: Rotation_Transform

ConstantR Class#

A subclass of Rotation_Transform that performs no rotation on the input data.

This transform simply returns the input data without any modifications, effectively serving as a placeholder for situations where no rotation is desired.

__call__(input_, angles=None):

Returns the input data as-is without applying any rotation.

class src.core.transforms.rotation.Rotation_EulerAngles(type)[source]#

Bases: Rotation_Transform

Rotation_EulerAngles Class#

A subclass of Rotation_Transform that applies a rotation to input data using Euler angles.

This transform performs a rotation on the input data based on the specified Euler angle sequence. The available rotation sequences are Proper Euler angles (e.g., ‘ZXZ’, ‘XYX’, ‘ZYZ’) and Tait-Bryan angles (e.g., ‘ZYX’, ‘YXZ’). The rotation is achieved by multiplying the input data by the corresponding rotation matrix.

type#

The type of Euler angle rotation, such as ‘ZXZ’, ‘XYX’, ‘ZYZ’, etc.

Type:

str

__init__(type):

Initializes the rotation transform with a specified Euler angle sequence type.

__call__(input_, angles):

Applies the rotation on the input data using the specified Euler angle sequence.

class src.core.transforms.rotation.Rotation_Transform[source]#

Bases: object

Rotation_Transform Class#

Base class for rotational transformations.

This class serves as an abstract base for all rotational transformations. Any subclass must implement the __call__ method to apply a specific rotation transformation to an input data (e.g., 3D coordinates) based on given angles.

__call__(self, input_, angles):

Applies the rotation transformation to the given input data using the provided angles. This method must be implemented by subclasses.

src.core.transforms.translation module#

class src.core.transforms.translation.ConstantT[source]#

Bases: Translation_Transform

ConstantT Class#

A translation transform that applies no translation to the input data.

This class overrides the __call__ method of the Translation_Transform base class and simply returns the input data unchanged, effectively performing no translation. It is useful when a no-op translation is needed, or as a placeholder in cases where translation might be conditionally applied.

__call__(input_, position):

Returns the input data without any changes, effectively applying no translation.

class src.core.transforms.translation.Translation_COM[source]#

Bases: Translation_Transform

Translation_COM Class#

A translation transform that applies a constant translation to the input data based on a specified position vector.

This class implements the __call__ method of the Translation_Transform base class by adding a translation vector (position) to each of the input data points. The position is applied to all points in the input data, effectively shifting them in 3D space by the specified vector.

__call__(input_, position):

Translates the input data by adding the specified position vector to each point.

class src.core.transforms.translation.Translation_Transform[source]#

Bases: object

Translation_Transform Class#

Abstract base class for translation transformations.

This class serves as a base for all translation transformations, requiring subclasses to implement the __call__ method to perform the translation operation. The translation is applied to the input data, typically shifting points in a 3D space by a specified position.

__call__(input_, position):

Applies the translation to the input data based on the specified position. Must be implemented by subclasses.

src.core.transforms.vtk_transform module#

src.core.transforms.vtk_transform.vtk_rotation(rotation_type: str, angles: tuple) vtkTransform[source]#

Returns a vtkTransform object that applies the specified rotation sequence based on the given rotation type and angles.

This function supports different types of Euler angle rotations (ZXZ, XYX, YZY, etc.) and returns the corresponding vtkTransform object that applies the specified sequence of rotations. The angles are provided in radians and are internally converted to degrees for vtk’s rotation functions.

Parameters:
  • rotation_type (str) – The type of rotation sequence to apply. It should be one of the following: ‘ZXZ’, ‘XYX’, ‘YZY’, ‘ZYZ’, ‘XZX’, ‘YXY’, ‘ZYX’, ‘YXZ’, ‘XZY’, ‘ZXY’, ‘YZX’, ‘XYZ’.

  • angles (tuple) – A tuple of three angles (in radians) representing the rotations about the axes specified by the rotation type. The angles will be converted to degrees before applying the rotations.

Returns:

A vtkTransform object that applies the specified rotation sequence.

Return type:

vtk.vtkTransform

Raises:

ValueError – If an invalid rotation type is provided.

Notes

The angles are assumed to be in radians, but are converted to degrees for use with vtk’s rotation methods. The transformations are concatenated in the specified order, resulting in a single composite rotation transform.

Module contents#