static Rotation Lerp( Rotation a, Rotation b, float frac, bool clamp )

robot_2Generated
code_blocksInput

Description

The Rotation.Lerp method performs a linear interpolation between two rotations, a and b, based on a specified fraction frac. This method is useful for smoothly transitioning between two orientations over time.

Usage

To use the Rotation.Lerp method, provide two Rotation objects, a and b, a float value frac that represents the interpolation factor, and a bool clamp to determine whether the interpolation factor should be clamped between 0 and 1. The method returns a new Rotation that is the result of the interpolation.

The frac parameter should typically be between 0 and 1, where 0 returns a and 1 returns b. If clamp is set to true, the method will ensure that frac is within this range.

Example

// Example of using Rotation.Lerp
Rotation startRotation = Rotation.FromAxis(Vector3.Up, 0);
Rotation endRotation = Rotation.FromAxis(Vector3.Up, 90);
float interpolationFactor = 0.5f;
bool shouldClamp = true;

Rotation resultRotation = Rotation.Lerp(startRotation, endRotation, interpolationFactor, shouldClamp);

// resultRotation now represents a rotation halfway between startRotation and endRotation.