Docsity

conception graphique, Exercices de Conception graphique

Toggle sidebar
bg1
Attribute VB_Name = "Module1"
Function bezier2(p1, p2, p3, t)
bezier2 = (1 - t) ^ 2 * p1 + _
(2 * t * (1 - t)) * p2 + _
(t ^ 2) * p3
End Function
Function bezier3(p1, p2, p3, p4, t)
bezier3 = ((1 - t) ^ 3) * p1 + _
(3 * t * (1 - t) ^ 2) * p2 + _
(3 * (t ^ 2)) * (1 - t) * p3 + _
(t ^ 3) * p4
End Function
Function parabole(img, vx0, vy0, x1, y1, x2, y2, x4, y4, pas)
For t = 0 To 1.01 Step 1 / pas
vx = bezier2(x1, x2, x4, t)
vy = bezier2(y1, y2, y4, t)
img.Line (vx0, vy0)-(vx, vy)
vx0 = vx
vy0 = vy
Next t
End Function
Function courbe(img, vx0, vy0, x1, y1, x2, y2, x3, y3, x4, y4, pas)
For t = 0 To 1.01 Step 1 / pas
vx = bezier3(x1, x2, x3, x4, t)
vy = bezier3(y1, y2, y3, y4, t)
img.Line (vx0, vy0)-(vx, vy)
vx0 = vx
vy0 = vy
Next t
End Function
Function construction_tangente(img, xp1, yp1, xp2, yp2)
img.DrawWidth = 2
img.Line (xp1, yp1)-(xp2, yp2), vbRed
img.DrawWidth = 1
End Function

Aperçu partiel du texte

Télécharge conception graphique et plus Exercices au format PDF de Conception graphique sur Docsity uniquement!

Attribute VB_Name = "Module1" Function bezier2(p1, p2, p3, t) bezier2 = (1 - t) ^ 2 * p1 + _ (2 * t * (1 - t)) * p2 + _ (t ^ 2) * p End Function

Function bezier3(p1, p2, p3, p4, t) bezier3 = ((1 - t) ^ 3) * p1 + _ (3 * t * (1 - t) ^ 2) * p2 + _ (3 * (t ^ 2)) * (1 - t) * p3 + _ (t ^ 3) * p End Function

Function parabole(img, vx0, vy0, x1, y1, x2, y2, x4, y4, pas) For t = 0 To 1.01 Step 1 / pas vx = bezier2(x1, x2, x4, t) vy = bezier2(y1, y2, y4, t) img.Line (vx0, vy0)-(vx, vy) vx0 = vx vy0 = vy Next t End Function

Function courbe(img, vx0, vy0, x1, y1, x2, y2, x3, y3, x4, y4, pas) For t = 0 To 1.01 Step 1 / pas vx = bezier3(x1, x2, x3, x4, t) vy = bezier3(y1, y2, y3, y4, t) img.Line (vx0, vy0)-(vx, vy) vx0 = vx vy0 = vy Next t End Function

Function construction_tangente(img, xp1, yp1, xp2, yp2) img.DrawWidth = 2 img.Line (xp1, yp1)-(xp2, yp2), vbRed img.DrawWidth = 1 End Function