# Bezier triangle partial derivatives

This topic is 2360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello I am trying to compute the partial derivatives of a bezier triangle (in u and v directions).

I followed this article to build my program.

http://www.gamasutra...hes.php?print=1

The section that interest me is "Derivatives [triangles]:"

question 1 : In the equations... does "p" refer to the actual control points of the triangle?

If this is the case, it seems like the derivative takes into account only 6 of the 10 control points of the patch... Is this normal?

the coefficients computed are for i+j+k=2 so if I plug theses values in the bernstein polynomial definition I get the following coefficients :

i=0, j=0, k=2 ---> w * w
i=0, j=2, k=0 ---> v * v
i=2, j=0, k=0 ---> u * u
i=1, j=1, k=0 ---> 2 * u * v
i=1, j=0, k=1 ---> 2 * u * w
i=0, j=1, k=1 ---> 2 * v * w

question 2 : this seems to contradict another section of the article where a bernstein of degree two is used for indices 110, 101, 011 and there is no x2 multiplication... Is this normal?

Hopefully someone can clarify this... I really need theses derivatives.

Thanks,

Shnoutz. Edited by Shnoutz

##### Share on other sites
Hi,

question 1 : In the equations... does "p" refer to the actual control points of the triangle?

According to the terminology used so far, I’d say yes.

I found an old paper by Sederberg, which has a graphical explanation for the definition of directional derivatives (Fig. 14). The figure depicts the construction of the derivative patch in w-direction (w=const). The construction for the patches in u- and v-direction is similar. Though, it has a little error in there, I think. The top and top left control points are substituted, but I think you can get the gist.

If this is the case, it seems like the derivative takes into account only 6 of the 10 control points of the patch... Is this normal?

It’s expected that the degree of the “derivative patch” goes down, so 6 points instead of 10 seems right. If you derive a polynomial of degree n the outcome is a polynomial of degree n-1.

i=2, j=0, k=0 ---> u * v

Little typo, it’s u*u

question 2 : this seems to contradict another section of the article where a bernstein of degree two is used for indices 110, 101, 011 and there is no x2 multiplication... Is this normal?

This is indeed a little strange. I’d have expected the factor 2, too.
Well, after all, this article seems not to be peer-reviewed, so little errors might be possible. I’d suggest to pick up a book of Farin, e.g. “Curves and Surfaces for CAGD: A Practical Guide” (Chapter 17) if you want to learn more.

Cheers!

##### Share on other sites
Thank you Tsus,

I manually derived the position equation to find the partial derivatives...

For n=3 the code looks like this :

 float3 bezierTriangle(float3 uvw, float3 points[10]) { return uvw.x * uvw.x * uvw.x * points[P300] + uvw.y * uvw.y * uvw.y * points[P030] + uvw.z * uvw.z * uvw.z * points[P003] + 3.0f * uvw.x * uvw.x * uvw.y * points[P210] + 3.0f * uvw.y * uvw.y * uvw.z * points[P021] + 3.0f * uvw.z * uvw.z * uvw.x * points[P102] + 3.0f * uvw.y * uvw.y * uvw.x * points[P120] + 3.0f * uvw.z * uvw.z * uvw.y * points[P012] + 3.0f * uvw.x * uvw.x * uvw.z * points[P201] + 6.0f * uvw.x * uvw.y * uvw.z * points[P111]; } 

...And the derivatives in u and v are :

 float3 bezierTriangle_du(float3 uvw, float3 points[10]) { return 3.0f * uvw.x * uvw.x * (points[P300] - points[P201]) + 3.0f * uvw.y * uvw.y * (points[P120] - points[P021]) + 3.0f * uvw.z * uvw.z * (points[P102] - points[P003]) + 6.0f * uvw.x * uvw.y * (points[P210] - points[P111]) + 6.0f * uvw.x * uvw.z * (points[P201] - points[P102]) + 6.0f * uvw.y * uvw.z * (points[P111] - points[P012]); } float3 bezierTriangle_dv(float3 uvw, float3 points[10]) { return 3.0f * uvw.x * uvw.x * (points[P210] - points[P201]) + 3.0f * uvw.y * uvw.y * (points[P030] - points[P021]) + 3.0f * uvw.z * uvw.z * (points[P012] - points[P003]) + 6.0f * uvw.x * uvw.y * (points[P120] - points[P111]) + 6.0f * uvw.x * uvw.z * (points[P111] - points[P102]) + 6.0f * uvw.y * uvw.z * (points[P021] - points[P012]); } 

As we can see, the derivatives for a degree 3 Bezier triangle is a degree 2 Bezier triangle... But the control points are not like they describe in the article.

We actually use 9 of the 10 initial control points to make 6 new ones.

I guess it could be written like this :

[attachment=8769:du.jpg]
[attachment=8770:dv.jpg]

I also compared the results of adding a a factor 2 to the original N-Patch normal equation... Obviously, it still works without it but I think I looks better with the factor 2.

[attachment=8771:n.jpg]

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 11
• 15
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633004
• Total Posts
3009836
• ### Who's Online (See full list)

There are no registered users currently online

×