Matrix.FixAngle Method

Overload List

#SignatureDescription
1function FixAngle: TMtxVec;Sets angle in [-2Pi,2Pi].
└ indexed: function FixAngle(Index: Integer; Len: Integer): TMtxVec;
2function FixAngle(const Src: TMtxVec): TMtxVec;Sets angle in [-2Pi,2Pi] for all Src elements.
└ indexed: function FixAngle(const Src: TMtxVec; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Overload 1: function FixAngle: TMtxVec;

Sets angle in [-2Pi,2Pi].

Result: stored in self (calling object), returns self for chaining

Returns: ThetaRad within [-2Pi,2Pi] interval.

Remarks:

Calling this function prior to passing the value to trigonometric functions can significantly improve numerical accuracy. For arguments larger than 10000, the computation of sine/cosine is speeded up by about 10x for SSE2/SSE3. The performance gains for classic FPU math are also significant. The cost of this function call is approx 30% of the cost of the sine function.

It is important to mention that the sine/cosine appear within many other functions especially complex versions of trigonometric functions. FixAngle method is never used implicitely within TMtxVec methods. To achieve maximum performance make sure that the arguments passed to complex trigonometric functions are "small" or scaled down.

Note
The Matrix must be real.

Indexed: function FixAngle(Index: Integer; Len: Integer): TMtxVec;

FixAngle for calling object complex elements [Index]..[Index+Len-1] in-place.

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

An exception is raised if calling object Matrix.Complex property is True or if array borders are overrun/underrun.

Overload 2: function FixAngle(const Src: TMtxVec): TMtxVec;

Sets angle in [-2Pi,2Pi] for all Src elements.

#NameTypeDescription
1SrcTMtxVec

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in the calling object. Size and Matrix.Complex properties of the calling Matrix are set implicitly to match the Src object.

Indexed: function FixAngle(const Src: TMtxVec; SrcIndex: Integer; Index: Integer; Len: Integer): TMtxVec;

Sets angle in [-2Pi,2Pi] for Src elements [SrcIndex]..[SrcIndex+Len-1].

#NameTypeDescription
1SrcTMtxVec
2SrcIndexIntegersource start index
3IndexIntegerstart index
4LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in the calling object elements [Index]..[Index+Len-1]. Size and Matrix.Complex properties of the calling object must be set explicitly. An exception is raised if Matrix.ConditionCheck is True and array borders are overrun.