please help me to program of this equation of triangular patch bezier

<</matlabcentral/answers/uploaded_files/22004/Capture
.JPG>> please help me to program of this equation of triangular patch bezier

 Accepted Answer

It's sort of the 2D version of the Bézier curve case I discussed in a blog post the other day .
It's 2D because you'll find that you probably want to rewrite it in terms of two independent variables and derive the third from those. For example, you could have something like this:
[u,v] = meshgrid(linspace(0,1,50));
w = 1-(u+v)
out = w<0;
u(out) = nan;
v(out) = nan;
w(out) = nan;
If you do surf(u,v,w) at this point, you'll see something like this:
Now you can use the same kron technique I described in that blog post to multiply these three arrays by your input points.
In the teapotdemo I was doing square patches instead of triangular patches, but you might find something you can mine from there.
I hope that's enough to get you rolling. Have fun, this is an interesting problem! There's a lot of interesting math hiding in these simple objects.

5 Comments

hi Mike, thank you for the idea that you have given me, but i still find difficulties. here is my points P004=[ 0;0.7000;-0.7000] P013=[ 0;0.8387;-0.5599] P022=[0;0.9309;-0.4118] P031=[ 0;0.9827;-0.2327] P040=[ 0;1;0] P103=[ 0.2783;0.8033;-0.5250] P112=[0.1268; 0.8620; -0.4897] P121=[0.1079; 0.9813 ;-0.2827] P130=[0.1925 ;1.0000 ;0] P202=[0.4648;0.8378;-0.3730] P211= [0.3947; 0.9323; -0.2107] P220=[0.3616;0.9524;0] P301=[0.5939;0.8033;-0.2094] P310=[0.5250;0.8536;0] P400=[ 0.7000;0.7000;0]
I'm just guessing, but my first guess would be that you've been thrown by how kron works with 2D arrays. It smashes the whole thing together and you need to pick it apart again.
For example, if our code looks something like this:
z = kron(P004, w.^4) ...
+ 4*kron(P013, v .*w.^3) ...
+ 6*kron(P022, v.^2.*w.^2) ...
... % etc, etc, etc
then we'd give it to surf like so:
surf(z(1:n,:),z((n+1):(2*n),:),z((2*n+1):end,:));
Where n is the width of our u,v,w arrays (50 in my example above).
The result looks something like this:
Does that make sense?
how continuity between 3 Bezier triangular patch
I don't remember the rules for triangular patches, but I know that for a rectangular cubic you get C1 continuity when the lines through the shared edge vertices to the control points in the next row are collinear. I would assume it's pretty similar for triangular.
This paper has an interesting derivation in terms of barycentric coordinates.

Sign in to comment.

More Answers (1)

you told me pultiplier the control points by 3 please tableaus how     greetings thank you in advance

1 Comment

hello, mike how to present these results as the patch and the surface as this picture thank you very match

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!