You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 7-animation/1-bezier-curve/article.md
+42-43Lines changed: 42 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,58 +1,59 @@
1
-
# Bezier curve
1
+
# _Bezier curve_
2
2
3
-
Bezier curves are used in computer graphics to draw shapes, for CSS animation and in many other places.
3
+
_Bezier Curves_ digunakan didalam grafis komputer untuk menggambar bentuk, untuk animasi _CSS_ dan di bagian lainnya.
4
4
5
-
They are a very simple thing, worth to study once and then feel comfortable in the world of vector graphics and advanced animations.
5
+
_Bezier Curves_ merupakan hal yang cukup simple, dan sangat layak untuk dipelajari dan akan terasa kenyamanan penggunaannya didalam grafis vektor dan animasi lanjutan.
6
6
7
-
## Control points
7
+
## Titik Kontrol
8
8
9
-
A[bezier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve)is defined by control points.
9
+
Sebuah[bezier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve)didefinisikan dengan menggunakan titik kontrol.
10
10
11
-
There may be 2, 3, 4 or more.
11
+
Kemungkinan akan terdapat 2, 3, 4 atau lebih.
12
12
13
13
For instance, two points curve:
14
+
Untuk contoh ini menggunakan dua titik lengkungan.
14
15
15
16

16
17
17
-
Three points curve:
18
+
Tiga titik lengkungan:
18
19
19
20

20
21
21
-
Four points curve:
22
+
Empat titik lengkungan:
22
23
23
24

24
25
25
-
If you look closely at these curves, you can immediately notice:
26
+
Jika kamu perhatikan secara seksama, kamu dapat melihat:
26
27
27
-
1.**Points are not always on curve.**That's perfectly normal, later we'll see how the curve is built.
28
-
2.**The curve order equals the number of points minus one**.
29
-
For two points we have a linear curve (that's a straight line), for three points -- quadratic curve (parabolic), for four points -- cubic curve.
30
-
3.**A curve is always inside the [convex hull](https://en.wikipedia.org/wiki/Convex_hull)of control points:**
28
+
1.**Titik tidak selalu sama dengan lengkungan.**Itu merupakan hal yang normal, kita akan lihat nanti bagaimana lengkungan itu diciptakan.
29
+
2.**Urutan lengkungan sama dengan titik dikurangi satu.**
30
+
Untuk dua titik kita mempunyai lengkungan linear (garis lurus), untuk tiga titik kita mempunyai -- garis kuadratik (parabolik), untuk empat titik -- _cubic curve_ atau lengkungan kubik.
31
+
3.**Sebuah lengkungan selalu didalam [convex hull](https://en.wikipedia.org/wiki/Convex_hull)dari titik kontrol.**
31
32
32
-

33
+

33
34
34
-
Because of that last property, in computer graphics it's possible to optimize intersection tests. If convex hulls do not intersect, then curves do not either. So checking for the convex hulls intersection first can give a very fast "no intersection" result. Checking the intersection of convex hulls is much easier, because they are rectangles, triangles and so on (see the picture above), much simpler figures than the curve.
35
+
Karena properti terakhir, didalam komputer grafis memungkinkan untuk mengoptimalkan test titik potong. Jika _Convex Hull_ tidak berpotongan maka lengkungannya juga tidak akan berpotongan. Jadi memeriksa potongan _convex hull_ di awal akan memberikan hasil "tanpa potongan" dengan cepat. Memeriksa potongan _convex hull_ lebih mudah dilakukan karena bentuknya kotak, segitiga dan lainnya (lihat contoh diatas), bentuk yang lebih simple daripada lengkungan.
35
36
36
-
**The main value of Bezier curves for drawing -- by moving the points the curve is changing *in intuitively obvious way*.**
37
+
**Nilai utaman dari _Bezier Curves_ untuk menggambar -- dengan memindahkan titik lengkungan dengan cara yang jelas secara intuitif.**
37
38
38
-
Try to move control points using a mouse in the example below:
39
+
Cobalah memindahkan titik kontrol menggunakan _mouse_ di contoh dibawah:
**As you can notice, the curve stretches along the tangential lines 1 -> 2 and 3 -> 4.**
43
+
**Seperti yang kamu perhatikan, lengkungannya meregang bersama dengan garis tangen 1 -> 2 dan 3 -> 4.**
43
44
44
-
After some practice it becomes obvious how to place points to get the needed curve. And by connecting several curves we can get practically anything.
45
+
Setelah beberapa latihan nantinya akan jelas bagaimana caranya untuk memasangkan titik agar menjari lengkungan. dan menyambungkan beberapa lengkungan kita dapat membuat apapun.
There's a mathematical formula for Bezier curves, but let's cover it a bit later, because
53
-
[De Casteljau's algorithm](https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm) is identical to the mathematical definition and visually shows how it is constructed.
53
+
Terdapat sebuah rumus matematika untuk _Bezier Curve_, tapi kita akan membahasnya nanti karena [De Casteljau's algorithm](https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm) identik dengan definisinya sendiri dan dapat dilihat jelas bagaimana membangunnya.
54
54
55
55
First let's see the 3-points example.
56
+
Pertama-tama kita lihat contoh 3 titik:
56
57
57
58
Here's the demo, and the explanation follow.
58
59
@@ -66,18 +67,17 @@ Control points (1,2 and 3) can be moved by the mouse. Press the "play" button to
66
67
2. Build segments between control points 1 -> 2 -> 3. In the demo above they are <spanstyle="color:#825E28">brown</span>.
67
68
3. The parameter `t` moves from `0` to `1`. In the example above the step `0.05` is used: the loop goes over `0, 0.05, 0.1, 0.15, ... 0.95, 1`.
68
69
69
-
For each of these values of `t`:
70
+
For each of these values of `t`:
70
71
71
-
- On each <spanstyle="color:#825E28">brown</span> segment we take a point located on the distance proportional to `t` from its beginning. As there are two segments, we have two points.
72
+
- On each <spanstyle="color:#825E28">brown</span> segment we take a point located on the distance proportional to `t` from its beginning. As there are two segments, we have two points.
72
73
73
-
For instance, for `t=0` -- both points will be at the beginning of segments, and for `t=0.25` -- on the 25% of segment length from the beginning, for `t=0.5` -- 50%(the middle), for `t=1` -- in the end of segments.
74
+
For instance, for `t=0` -- both points will be at the beginning of segments, and for `t=0.25` -- on the 25% of segment length from the beginning, for `t=0.5` -- 50%(the middle), for `t=1` -- in the end of segments.
74
75
75
-
- Connect the points. On the picture below the connecting segment is painted <spanstyle="color:#167490">blue</span>.
76
+
- Connect the points. On the picture below the connecting segment is painted <spanstyle="color:#167490">blue</span>.
4. Now in the <spanstyle="color:#167490">blue</span> segment take a point on the distance proportional to the same value of `t`. That is, for `t=0.25` (the left picture) we have a point at the end of the left quarter of the segment, and for `t=0.5` (the right picture) -- in the middle of the segment. On pictures above that point is <spanstyle="color:red">red</span>.
83
83
@@ -93,9 +93,9 @@ The algorithm for 4 points:
93
93
94
94
- Connect control points by segments: 1 -> 2, 2 -> 3, 3 -> 4. There will be 3 <spanstyle="color:#825E28">brown</span> segments.
95
95
- For each `t` in the interval from `0` to `1`:
96
-
- We take points on these segments on the distance proportional to `t` from the beginning. These points are connected, so that we have two <spanstyle="color:#0A0">green segments</span>.
97
-
- On these segments we take points proportional to `t`. We get one <spanstyle="color:#167490">blue segment</span>.
98
-
- On the blue segment we take a point proportional to `t`. On the example above it's <spanstyle="color:red">red</span>.
96
+
- We take points on these segments on the distance proportional to `t` from the beginning. These points are connected, so that we have two <spanstyle="color:#0A0">green segments</span>.
97
+
- On these segments we take points proportional to `t`. We get one <spanstyle="color:#167490">blue segment</span>.
98
+
- On the blue segment we take a point proportional to `t`. On the example above it's <spanstyle="color:red">red</span>.
99
99
- These points together form the curve.
100
100
101
101
The algorithm is recursive and can be generalized for any number of control points.
@@ -112,7 +112,6 @@ These points make the curve.
112
112
**Run and pause examples to clearly see the segments and how the curve is built.**
@@ -144,7 +143,6 @@ Sometimes we have another task: to draw a curve *through several points*, so tha
144
143
There are mathematical formulas for such curves, for instance [Lagrange polynomial](https://en.wikipedia.org/wiki/Lagrange_polynomial). In computer graphics [spline interpolation](https://en.wikipedia.org/wiki/Spline_interpolation) is often used to build smooth curves that connect many points.
145
144
```
146
145
147
-
148
146
## Maths
149
147
150
148
A Bezier curve can be described using a mathematical formula.
@@ -155,14 +153,15 @@ Given the coordinates of control points <code>P<sub>i</sub></code>: the first co
These are vector equations. In other words, we can put `x` and `y` instead of `P` to get corresponding coordinates.
168
167
@@ -173,10 +172,10 @@ For instance, the 3-point curve is formed by points `(x,y)` calculated as:
173
172
174
173
Instead of <code>x<sub>1</sub>, y<sub>1</sub>, x<sub>2</sub>, y<sub>2</sub>, x<sub>3</sub>, y<sub>3</sub></code> we should put coordinates of 3 control points, and then as `t` moves from `0` to `1`, for each value of `t` we'll have `(x,y)` of the curve.
175
174
176
-
For instance, if control points are `(0,0)`, `(0.5, 1)` and `(1, 0)`, the equations become:
175
+
For instance, if control points are `(0,0)`, `(0.5, 1)` and `(1, 0)`, the equations become:
0 commit comments