[This is preliminary documentation and is subject to change.]

Truncates the length of the vector to the specified value.

Namespace: org.critterai
Assembly: cai-util (in cai-util.dll) Version: 0.5.0.0 (0.5.0.0)

Syntax

         
 C#  Visual Basic  Visual C++ 
public static Vector2 TruncateLength(
	Vector2 v,
	float maxLength
)
Public Shared Function TruncateLength ( _
	v As Vector2, _
	maxLength As Single _
) As Vector2
public:
static Vector2 TruncateLength(
	Vector2 v, 
	float maxLength
)

Parameters

v
Vector2
The vector to truncate.
maxLength
Single
The maximum allowed length of the resulting vector.

Return Value

A vector with a length at or below the maximum length.

Remarks

If the vector's length is longer than the specified value the length of the vector is scaled back to the specified length.

If the vector's length is shorter than the specified value, it is not changed.

This is a potentially costly method.

See Also