Klaus Petersen wrote:
> Er der nogen her der har erfaring med at implementere benzier kurver?
>
> Jeg skal til at implementere det så jeg kunne godt bruge noget information
> om hvordan det fungerer og andre relavante ting.
Hvis det bare drejer sig om at få svar på spørgsmålet
"Hvad går Bezier-kurver egentlig ud på?", så er der en
fin rekursiv formulering af løsningen på "tegn en Bezier-
kurve fra p1 til p3 med kontrolpunkt p3 på i "How to Design Programs"
Exercise 27.1.5. In mathematics and computer graphics, people must
often connect some given points with a smooth curve. One popular method
for this purpose is due to Bezier.58 Here is a sequence of pictures that
illustrate the idea:
[Billederne er her ca. 1/4 nede på siden, de viser tre stadier
i konstruktionen
<
http://www.htdp.org/2002-09-22/Book/curriculum-Z-H-34.html>
]
For simplicity, we start with three points: p1, p2, and p3. The goal is
to draw a smooth curve from p1 to p3, viewed from p2. The original
triangle is shown on the left; the desired curve appears on the right.
To draw the curve from a given triangle, we proceed as follows. If the
triangle is small enough, draw it. It appears as a large point. If not,
generate two smaller triangles as illustrated in the center picture. The
outermost points, p1 and p3, remain the respective outermost points. The
replacements for the point in the middle are r2 and q2, which are the
midpoints between p1 and p2 and between p2 and p3, respectively. The
midpoint between r2 and q2 (marked with ) is the new left-most and
right-most endpoint, respectively, for the two new triangles.
--
Jens Axel Søgaard