# Zulip Chat Archive

## Stream: Is there code for X?

### Topic: Barycentric coordinates

#### Yakov Pechersky (Apr 12 2021 at 22:01):

Do we have the isometry or any form of equivalence for barycentric coordinates? Even for interpolating in a simple triangle.

#### Bhavik Mehta (Apr 12 2021 at 22:02):

There's `finset.center_mass`

, where the weights can be thought of as the barycentric coordinates for the point in question

#### Yakov Pechersky (Apr 12 2021 at 22:05):

That will give the center. I'm hoping for the affine transform that can help me interpolate for any point in the interior

#### Yakov Pechersky (Apr 12 2021 at 22:12):

I guess it's just some `matrix.mul`

#### Bhavik Mehta (Apr 12 2021 at 22:19):

Yakov Pechersky said:

That will give the center. I'm hoping for the affine transform that can help me interpolate for any point in the interior

It's not restricted to the center. You can specify any weights you wish and get any point in the interior.

#### Bhavik Mehta (Apr 12 2021 at 22:22):

There's also docs#set.finite.convex_hull_eq_image and https://leanprover-community.github.io/mathlib_docs/linear_algebra/affine_space/combination.html

#### Bhavik Mehta (Apr 12 2021 at 22:23):

More specifically docs#affine.finset.affine_combination

Last updated: May 16 2021 at 05:21 UTC