# Tangents for Bézier Curves

## Recommended Posts

Hello Everybody,

i just read Chapter 23 GPU Gems 2. It's about rendering hairs. You can read it [url="http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter23.html"]here[/url].
I want to implement this technique but have one problem: In the tesslation step they write:
[quote]
To compute the new vertices' positions, we convert the control hairs to Bezier curves by calculating their tangents (for every frame) and using them to compute the Bezier control points.
[/quote]

I know how to calculate the direction of the tangents at the specified points but how can i calculate the length of them (i think the length specifies the control point for the Bézier Curve).

I hope you can help me.

Nils

##### Share on other sites
spacerat    1182
hi,

you have to compute the drivatives I guess.
http://www.cs.sunysb.edu/~qin/courses/geometry/4.pdf

##### Share on other sites
To my mind the way you compute the tangents cannot be exactly defined.
It's a heuristic.

You can apply, for example, the following steps. These heuristics are used in CorelDraw for control points conversions.

[b]Semgents to cusp bezier (i.e. tangents without conjunction):[/b]
For every tangent of every control point use 1/3 of distance to adjacent point as a length, direction is current point->adjacent point

[b]Cusp bezier - smooth bezier (i.e tangents without conjunction to tangents with conjunction):[/b]
Use bisector of the tangents as their new direction, keeping lengths of the tangents.

[b]Smooth [/b][b]bezier - symmetrical bezier (i.e tangents with conjunction to [/b][b]tangents with conjunction which have the same length[/b][b]):[/b][b]
[/b]The conversion is made by averaging the lengths of the tangents[b].

[/b]I hope I've done a clear explanation =)[b]

UPD:[/b][b] [/b]I guess the article uses very similar, if not exactly the same approach

##### Share on other sites
Thank you for your fantastic advices. I think with the great explanation and the nice article i can get some nice results. Thank you!