Method normalizesafe
normalizesafe(float2, float2)
Returns a safe normalized version of the float2 vector x by scaling it by 1 / length(x). Returns the given default value when 1 / length(x) does not produce a finite number.
Declaration
public static float2 normalizesafe(float2 x, float2 defaultvalue = default(float2))
Parameters
Type | Name | Description |
---|---|---|
float2 | x | Vector to normalize. |
float2 | defaultvalue | Vector to return if normalized vector is not finite. |
Returns
Type | Description |
---|---|
float2 | The normalized vector or the default value if the normalized vector is not finite. |
normalizesafe(float3, float3)
Returns a safe normalized version of the float3 vector x by scaling it by 1 / length(x). Returns the given default value when 1 / length(x) does not produce a finite number.
Declaration
public static float3 normalizesafe(float3 x, float3 defaultvalue = default(float3))
Parameters
Type | Name | Description |
---|---|---|
float3 | x | Vector to normalize. |
float3 | defaultvalue | Vector to return if normalized vector is not finite. |
Returns
Type | Description |
---|---|
float3 | The normalized vector or the default value if the normalized vector is not finite. |
normalizesafe(float4, float4)
Returns a safe normalized version of the float4 vector x by scaling it by 1 / length(x). Returns the given default value when 1 / length(x) does not produce a finite number.
Declaration
public static float4 normalizesafe(float4 x, float4 defaultvalue = default(float4))
Parameters
Type | Name | Description |
---|---|---|
float4 | x | Vector to normalize. |
float4 | defaultvalue | Vector to return if normalized vector is not finite. |
Returns
Type | Description |
---|---|
float4 | The normalized vector or the default value if the normalized vector is not finite. |
normalizesafe(double2, double2)
Returns a safe normalized version of the double4 vector x by scaling it by 1 / length(x). Returns the given default value when 1 / length(x) does not produce a finite number.
Declaration
public static double2 normalizesafe(double2 x, double2 defaultvalue = default(double2))
Parameters
Type | Name | Description |
---|---|---|
double2 | x | Vector to normalize. |
double2 | defaultvalue | Vector to return if normalized vector is not finite. |
Returns
Type | Description |
---|---|
double2 | The normalized vector or the default value if the normalized vector is not finite. |
normalizesafe(double3, double3)
Returns a safe normalized version of the double4 vector x by scaling it by 1 / length(x). Returns the given default value when 1 / length(x) does not produce a finite number.
Declaration
public static double3 normalizesafe(double3 x, double3 defaultvalue = default(double3))
Parameters
Type | Name | Description |
---|---|---|
double3 | x | Vector to normalize. |
double3 | defaultvalue | Vector to return if normalized vector is not finite. |
Returns
Type | Description |
---|---|
double3 | The normalized vector or the default value if the normalized vector is not finite. |
normalizesafe(double4, double4)
Returns a safe normalized version of the double4 vector x by scaling it by 1 / length(x). Returns the given default value when 1 / length(x) does not produce a finite number.
Declaration
public static double4 normalizesafe(double4 x, double4 defaultvalue = default(double4))
Parameters
Type | Name | Description |
---|---|---|
double4 | x | Vector to normalize. |
double4 | defaultvalue | Vector to return if normalized vector is not finite. |
Returns
Type | Description |
---|---|
double4 | The normalized vector or the default value if the normalized vector is not finite. |
normalizesafe(quaternion)
Returns a safe normalized version of the q by scaling it by 1 / length(q). Returns the identity when 1 / length(q) does not produce a finite number.
Declaration
public static quaternion normalizesafe(quaternion q)
Parameters
Type | Name | Description |
---|---|---|
quaternion | q | The quaternion to normalize. |
Returns
Type | Description |
---|---|
quaternion | The normalized quaternion or the identity quaternion. |
normalizesafe(quaternion, quaternion)
Returns a safe normalized version of the q by scaling it by 1 / length(q). Returns the given default value when 1 / length(q) does not produce a finite number.
Declaration
public static quaternion normalizesafe(quaternion q, quaternion defaultvalue)
Parameters
Type | Name | Description |
---|---|---|
quaternion | q | The quaternion to normalize. |
quaternion | defaultvalue | The default value. |
Returns
Type | Description |
---|---|
quaternion | The normalized quaternion or the default value. |