0
$\begingroup$

I have to construct a bezier triangle that interpolates these 4 points:

$\qquad (0,0,1),\,(1,0,0),\,(0,1,0),\,(0.5,0.5,0.75)$

However, the surface that I get is so weird. Anyone please can help me to solve this problem?

pts = 
  {{{0, 0, 1}, {0.5, 0.5, 0.75}, {1, 0, 0}}, 
   {{0, 0, 1}, {0, 1, 0}, {0.5, 0.5, 0.75}}, 
   {{0, 1, 0}, {0.5, 0.5, 0.75}, {1, 0, 0}}};
f = BezierFunction[pts]

Show[
  Graphics3D[{PointSize[Medium], Red, Map[Point, pts]}],
  Graphics3D[{Gray, Line[pts], Line[Transpose[pts]]}],
  ParametricPlot3D[f[u, v], {u, 0, 1}, {v, 0, 1},
    ColorFunction -> "Rainbow"], 
    Mesh -> Full, 
    Axes -> True,
    AxesLabel -> {"x", "y", "z"}]

bezier triangle

$\endgroup$
3
  • 2
    $\begingroup$ It is not clear to me what you want to correct in your plot $\endgroup$
    – m_goldberg
    Commented Nov 29, 2020 at 7:01
  • 2
    $\begingroup$ Please add a new question in this forum instead of edit your old question! Your original problem is about Bezier Surface! $\endgroup$
    – cvgmt
    Commented Dec 1, 2020 at 2:02
  • $\begingroup$ The usual definition of Bezier triangle is not equivalent to some degenerated Bezier quadrilateral patch. So it can't be represented by BezierFunction with some control points being "squeezed" together. For more details, please check my Community post A Gentle Introduction to Bézier Triangle. $\endgroup$
    – Silvia
    Commented Jan 18, 2023 at 20:59

1 Answer 1

4
$\begingroup$
a = {1, 0, 0};
b = {0, 1, 0};
c = {0, 0, 1};
d = {0.5, 0.5, 0.75};
m = 1.38 d;
pts = {{a, a, a, a}, 
      {2/3 a + 1/3 b, m, m, 2/3 a + 1/3 c}, 
      {2/3 b + 1/3 a, m, m, 2/3 c + 1/3 a}, 
      {b, 2/3 b + 1/3 c, 2/3 c + 1/3 b, c}};
f = BezierFunction[pts];
Show[Graphics3D[{PointSize[0.04], Point[{a, b, c, d}]}], 
 Graphics3D[{PointSize[Medium], Red, Map[Point, pts]}], 
 Graphics3D[{Gray, Line[pts], Line[Transpose[pts]]}], 
 ParametricPlot3D[f[u, v], {u, 0, 1}, {v, 0, 1}, 
  ColorFunction -> "Rainbow"], Mesh -> Full, Axes -> True, 
 AxesLabel -> {"x", "y", "z"}, ViewPoint -> {1.64, -0.14, 2.95}]

enter image description here

$\endgroup$
2
  • $\begingroup$ @cvgmat can we convert B-spline to Bezier spline in mathematica? $\endgroup$
    – ABCDEMMM
    Commented May 28, 2021 at 1:54
  • $\begingroup$ The attempt to represent Bezier triangle with BezierFunction is not quite correct. Please see my comment under OP. $\endgroup$
    – Silvia
    Commented Jan 18, 2023 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.