Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

Vertex.BarycentricInterpolate

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void BarycentricInterpolate(ref Vertex a, ref Vertex b, ref Vertex c, float u, float v, float w, out Vertex result);

Parameters

Parameter Description
a The first triangle vertex, weighted by u.
b The second triangle vertex, weighted by v.
c The third triangle vertex, weighted by w.
u The barycentric weight of a.
v The barycentric weight of b.
w The barycentric weight of c.
result Receives the interpolated vertex.

Description

Interpolates between three vertices using barycentric weights, writing into result a vertex at an arbitrary point inside (or outside) the triangle they form.

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.


Declaration

public static Vertex BarycentricInterpolate(ref Vertex a, ref Vertex b, ref Vertex c, float u, float v, float w);

Parameters

Parameter Description
a The first triangle vertex, weighted by u.
b The second triangle vertex, weighted by v.
c The third triangle vertex, weighted by w.
u The barycentric weight of a.
v The barycentric weight of b.
w The barycentric weight of c.

Returns

Vertex The interpolated vertex.

Description

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.