Constructing Two-Dimensional Cosine Wave

The function

MbResultType Cosinusoid( const MbCartPoint & point0,
                         const MbCartPoint & point1,
                               MbCartPoint & point2,
                               double        phase,
                               double        waveLength,
                               MbCurve *&    result );

constructs a cosine wave (two-dimensional harmonic curve).

Input parameters of the function are as follows:

  • point0 — an origin of the local coordinate system;

  • point1 — a point located on the X axis of the local coordinate system;

  • point2 — a point defining the Y axis of the local coordinate system;

  • phase — a phase shift of the harmonic curve (in radians);

  • waveLength — a wavelength of the harmonic curve.

The output parameter of the function is the pointer result to the constructed two-dimensional curve of type MbCurve representing the cosine wave.

If successful, the function returns rt_Success, otherwise it returns an error code from MbResultType enumeration.

The function is declared in action_curve.h file.

point0, point1 and point2 points define the local coordinate system of the cosine wave. point0 will be the origin of the local coordinate system of the cosine wave, axisX of the local coordinate system will be directed from point0 to point1, axisY of the local coordinate system will be orthogonal to axisX and directed from point0 to point2.

point0, point1 and point2 points should not lie along a single straight line.

Two-dimensional cosine waves are described in Item MbCosinusoid Two-Dimensional Cosine Wave.

The amplitude of the cosine wave is equal to the length of the projection of the vector (point2 − point0) onto the Y axis axisY. The wavelength of the cosine wave is equal to waveLength. The number of waves of the cosine wave is determined by the distance between the points point0 and point1.

phase defines the phase shift of the cosine wave:

../../../../_images/M.3.6.1.png