Function Polygon.ClosestPointOnTriangleProjected

ClosestPointOnTriangleProjected (refInt3 vi1, refInt3 vi2, refInt3 vi3, refBBTree.ProjectionParams projection, ref float3 point, out float3 closest, out float sqrDist, out float distAlongProjection)

Closest point on a triangle when one axis is scaled.

Public Static
void ClosestPointOnTriangleProjected (

refInt3

vi1

First vertex of the triangle, in graph space.

refInt3

vi2

Second vertex of the triangle, in graph space.

refInt3

vi3

Third vertex of the triangle, in graph space.

refBBTree.ProjectionParams

projection

Projection parameters that are for example constructed from a movement plane.

ref float3

point

Point to find the closest point to.

out float3

closest

Closest point on the triangle to the point.

out float

sqrDist

Squared cost from the point to the closest point on the triangle.

out float

distAlongProjection

Distance from the point to the closest point on the triangle along the projection axis.

)

Closest point on a triangle when one axis is scaled.

Project the triangle onto the plane defined by the projection axis. Then find the closest point on the triangle in the plane. Calculate the distance to the closest point in the plane, call that D1. Convert the closest point into 3D space, and calculate the distance to the query point along the plane's normal, call that D2. The final cost for a given point is D1 + D2 * distanceScaleAlongProjectionDirection.

This will form a diamond shape of equivalent cost points around the query point (x). The ratio of the width of this diamond to the height is equal to distanceScaleAlongProjectionDirection.

^ / \ / \ / x \ \ / \ / \ / v