As we know,t1*p1 + t2*p2 + t3*p3
is a triangle region whose vertice is {p1,p2,p3}
when t1+t2+t3==1
and 0<t1<1&&0<t2<1&&0<t3<1
.But I don't know how to draw this triangle?I just can estimate it with some points like
SeedRandom[2]
{p1, p2, p3} = RandomReal[1, {3, 3}];
t = Normalize[#, Total] & /@ RandomReal[1, {400, 3}];
Graphics3D[{PointSize[.02],
Point[Dot @@@ Tuples[{t, {{p1, p2, p3}}}]], Red,
Point[{p1, p2, p3}]}]
But how to plot it with a shape?If I use ParametricRegion
,it will be a parallelogram
Region@ParametricRegion[
t1*p1 + t2*p2 + (1 - t1 - t2)*p3, {{t1, 0, 1}, {t2, 0, 1}}]~Show~
Graphics3D[{PointSize[.02], Point /@ {p1, p2, p3}}]
How to implement it?
RegionFunction
for plotting in barycentric coordinates:ParametricPlot3D[{u, v, 1 - u - v}.{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}}, {u, 0, 1}, {v, 0, 1}, RegionFunction -> Function[{x, y, z, u, v}, u + v <= 1]]
$\endgroup$ – J. M. will be back soon♦ Apr 3 '17 at 17:46Region[Simplex[{p1,p2,p3}]
? $\endgroup$ – kglr Apr 3 '17 at 22:40t1+t2+t3==1
is a triangle,and want to plot it to comfirm.If I change it intot1+t2+t3==2
,you cannot useSimplex
anymore. :) $\endgroup$ – yode Apr 3 '17 at 22:52Graphics3D[Polygon[{p1,p2,p3,p1}]]
$\endgroup$ – David G. Stork Apr 3 '17 at 23:17