LENGTH(3Cg)

NAME
length - return scalar Euclidean length of a vector

SYNOPSIS
  float length(float v);
  float length(float1 v);
  float length(float2 v);
  float length(float3 v);
  float length(float4 v);

  half length(half v);
  half length(half1 v);
  half length(half2 v);
  half length(half3 v);
  half length(half4 v);

  fixed length(fixed v);
  fixed length(fixed1 v);
  fixed length(fixed2 v);
  fixed length(fixed3 v);
  fixed length(fixed4 v);

PARAMETERS

v   Vector of which to determine the length.

DESCRIPTION
Returns the Euclidean length of a vector.

REFERENCE IMPLEMENTATION
length for a float3 vector could be implemented like this.

  float length(float3 v)
  {
    return sqrt(dot(v,v));
  }

PROFILE SUPPORT
length is supported in all profiles.

Support in the fp20 is limited.

SEE ALSO
max, normalize, sqrt, dot