File:Barycentriccoordinates.gif
Summary
Description |
English: Barycentric coordinates are a way to identify a point inside a triangle with three numbers, which can be thought as masses on the triangle vertices, and the point inside the triangle as their center of mass. |
Date | |
Source | https://twitter.com/j_bertolotti/status/1127866653981724672 |
Author | Jacopo Bertolotti |
Permission (Reusing this file) |
https://twitter.com/j_bertolotti/status/1030470604418428929 |
Mathematica 11.0 code
p1 = {-1, 0}; p2 = {1, 0}; p3 = {0, 1}; c1 = 1; c2 = 1; c3 = 1; plot1 = Table[ c1 = j; Graphics[{Black, Disk[p1, 0.1], Disk[p2, 0.1], Disk[p3, 0.1], Line[{p1, p2, p3, p1}], White, Text[NumberForm[c1, {3, 2}], p1], Text[NumberForm[c2, {3, 2}], p2], Text[NumberForm[c3, {3, 2}], p3], Red, Disk[(c1 p1 + c2 p2 + c3 p3)/(c1 + c2 + c3), 0.05]}, PlotRange -> {{-1.1, 1.1}, {-0.1, 1.1}}] , {j, 1, 2, 0.02}]; plot2 = Table[ c2 = j; Graphics[{Black, Disk[p1, 0.1], Disk[p2, 0.1], Disk[p3, 0.1], Line[{p1, p2, p3, p1}], White, Text[NumberForm[c1, {3, 2}], p1], Text[NumberForm[c2, {3, 2}], p2], Text[NumberForm[c3, {3, 2}], p3], Red, Disk[(c1 p1 + c2 p2 + c3 p3)/(c1 + c2 + c3), 0.05]}, PlotRange -> {{-1.1, 1.1}, {-0.1, 1.1}}] , {j, 1, 2.5, 0.02}]; plot3 = Table[ p2 = {1, 0} - {j, 0}; Graphics[{Black, Disk[p1, 0.1], Disk[p2, 0.1], Disk[p3, 0.1], Line[{p1, p2, p3, p1}], White, Text[NumberForm[c1, {3, 2}], p1], Text[NumberForm[c2, {3, 2}], p2], Text[NumberForm[c3, {3, 2}], p3], Red, Disk[(c1 p1 + c2 p2 + c3 p3)/(c1 + c2 + c3), 0.05]}, PlotRange -> {{-1.1, 1.1}, {-0.1, 1.1}}] , {j, 0, 0.5, 0.01}]; ListAnimate[Join[plot1, plot2, plot3]]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.