Triangle2D t = new Triangle2D(a, b, c);
assertEquals(new Vec3D(1, 0, 0), t.toBarycentric(a));
assertEquals(new Vec3D(0, 1, 0), t.toBarycentric(b));
assertEquals(new Vec3D(0, 0, 1), t.toBarycentric(c));
// test roundtrip
assertEquals(a, t.fromBarycentric(t.toBarycentric(a)));
assertEquals(b, t.fromBarycentric(t.toBarycentric(b)));
assertEquals(c, t.fromBarycentric(t.toBarycentric(c)));
Vec2D p = new Vec2D(0, 0);
assertEquals(p, t.fromBarycentric(t.toBarycentric(p)));
// test point outside