Documentation

Unity Engine

Download Unity

Unity Engine

projectonplanesafe

Returns the projection of a onto the line through the origin that is perpendicular to planeNormal. If the result is not finite, returns the default value instead.
Read time 4 minutesLast updated 5 days ago

Definition

projectonplanesafe(float2, float2, float2)

Returns the projection of a onto the line through the origin that is perpendicular to planeNormal. If the result is not finite, returns the default value instead.
public static float2 projectonplanesafe(float2 a, float2 planeNormal, float2 defaultValue = default)

Parameters

Vector to project.

planeNormal

Non-zero normal of the line to project onto.

defaultValue

Default value to return if the projection is not finite.

Returns

Type

Description

float2The projection of a onto the line perpendicular to planeNormal, or the default value.

Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.projectonplane instead which is faster than this function.

projectonplanesafe(float3, float3, float3)

Returns the projection of a onto the plane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.
public static float3 projectonplanesafe(float3 a, float3 planeNormal, float3 defaultValue = default)

Parameters

Vector to project.

planeNormal

Non-zero normal of the plane to project onto.

defaultValue

Default value to return if the projection is not finite.

Returns

Type

Description

float3The projection of a onto the plane, or the default value.

Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.projectonplane instead which is faster than this function.

projectonplanesafe(float4, float4, float4)

Returns the projection of a onto the hyperplane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.
public static float4 projectonplanesafe(float4 a, float4 planeNormal, float4 defaultValue = default)

Parameters

Vector to project.

planeNormal

Non-zero normal of the hyperplane to project onto.

defaultValue

Default value to return if the projection is not finite.

Returns

Type

Description

float4The projection of a onto the hyperplane, or the default value.

Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.projectonplane instead which is faster than this function.

projectonplanesafe(double2, double2, double2)

Returns the projection of a onto the line through the origin that is perpendicular to planeNormal. If the result is not finite, returns the default value instead.
public static double2 projectonplanesafe(double2 a, double2 planeNormal, double2 defaultValue = default)

Parameters

Vector to project.

planeNormal

Non-zero normal of the line to project onto.

defaultValue

Default value to return if the projection is not finite.

Returns

Type

Description

double2The projection of a onto the line perpendicular to planeNormal, or the default value.

Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.projectonplane instead which is faster than this function.

projectonplanesafe(double3, double3, double3)

Returns the projection of a onto the plane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.
public static double3 projectonplanesafe(double3 a, double3 planeNormal, double3 defaultValue = default)

Parameters

Vector to project.

planeNormal

Non-zero normal of the plane to project onto.

defaultValue

Default value to return if the projection is not finite.

Returns

Type

Description

double3The projection of a onto the plane, or the default value.

Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.projectonplane instead which is faster than this function.

projectonplanesafe(double4, double4, double4)

Returns the projection of a onto the hyperplane through the origin with normal planeNormal. If the result is not finite, returns the default value instead.
public static double4 projectonplanesafe(double4 a, double4 planeNormal, double4 defaultValue = default)

Parameters

Vector to project.

planeNormal

Non-zero normal of the hyperplane to project onto.

defaultValue

Default value to return if the projection is not finite.

Returns

Type

Description

double4The projection of a onto the hyperplane, or the default value.

Remarks

This function performs extra checks to see if the result is finite. If you know that your inputs will generate a finite result or you don't care if the result is finite, then you can call math.projectonplane instead which is faster than this function.