Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


BarycentricInterpolate

Interpolates between three vertices using barycentric weights, writing into result a vertex at an arbitrary point inside (or outside) the triangle they form.
Read time 1 minuteLast updated 11 days ago

Definition

BarycentricInterpolate(Vertex, Vertex, Vertex, float, float, float, Vertex)

Interpolates between three vertices using barycentric weights, writing into
result
a vertex at an arbitrary point inside (or outside) the triangle they form.
public static void BarycentricInterpolate(in Vertex a, in Vertex b, in Vertex c, float u, float v, float w, out Vertex result)

Parameters

The first triangle vertex, weighted by
u
.

The second triangle vertex, weighted by
v
.

The third triangle vertex, weighted by
w
.

The barycentric weight of
a
.

The barycentric weight of
b
.

The barycentric weight of
c
.

result

Receives the interpolated vertex.

Remarks

Use this to place a vertex anywhere within a triangle — for example when re-meshing or clipping a fill. As with Vertex.Lerp, the continuous vertex data is blended and the discrete identifying data is taken from
a
, so the three vertices must belong to the same fill. The weights are expected to sum to 1 for a point inside the triangle, but are not validated.

BarycentricInterpolate(Vertex, Vertex, Vertex, float, float, float)

Interpolates between three vertices using barycentric weights, returning the vertex at that point. Convenience overload that returns the result instead of writing to an out parameter.
public static Vertex BarycentricInterpolate(in Vertex a, in Vertex b, in Vertex c, float u, float v, float w)

Parameters

The first triangle vertex, weighted by
u
.

The second triangle vertex, weighted by
v
.

The third triangle vertex, weighted by
w
.

The barycentric weight of
a
.

The barycentric weight of
b
.

The barycentric weight of
c
.

Returns

Type

Description

VertexThe interpolated vertex.