normalizesafe
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.
Read time 3 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
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.
public static float2 normalizesafe(float2 x, float2 defaultvalue = default)
Parameters
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.
public static float3 normalizesafe(float3 x, float3 defaultvalue = default)
Parameters
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.
public static float4 normalizesafe(float4 x, float4 defaultvalue = default)
Parameters
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.
public static double2 normalizesafe(double2 x, double2 defaultvalue = default)
Parameters
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.
public static double3 normalizesafe(double3 x, double3 defaultvalue = default)
Parameters
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.
public static double4 normalizesafe(double4 x, double4 defaultvalue = default)
Parameters
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.
public static quaternion normalizesafe(quaternion q)
Parameters
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.
public static quaternion normalizesafe(quaternion q, quaternion defaultvalue)
Parameters
Returns
Type | Description |
|---|---|
| quaternion | The normalized quaternion or the default value. |