Skip to content

Commit 1c3aa2f

Browse files
committed
docs: Update
Signed-off-by: Ce Gao <ce.gao@outlook.com>
1 parent 83e1ae9 commit 1c3aa2f

32 files changed

+635
-0
lines changed

docs/beginContour.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@
3838
<td><h3>beginContour</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># beginContour 1 https://processing.org/reference/beginContour_.html
43+
44+
size(100, 100)
45+
translate(50, 50)
46+
stroke(255, 0, 0)
47+
beginShape()
48+
# Exterior part of shape, clockwise winding
49+
vertex(-40, -40)
50+
vertex(40, -40)
51+
vertex(40, 40)
52+
vertex(-40, 40)
53+
# Interior part of shape, counter-clockwise winding
54+
beginContour()
55+
vertex(-20, -20)
56+
vertex(-20, 20)
57+
vertex(20, 20)
58+
vertex(20, -20)
59+
endContour()
60+
endShape(CLOSE)
61+
</pre>
62+
</div>
63+
</tr>
4164

4265
<tr class="">
4366
<th scope="row">Description</th>

docs/beginShape.html

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,60 @@
3838
<td><h3>beginShape</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># beginShape 4 https://processing.org/reference/beginShape_.html
43+
44+
noFill()
45+
beginShape()
46+
vertex(30, 20)
47+
vertex(85, 20)
48+
vertex(85, 75)
49+
vertex(30, 75)
50+
endShape()
51+
</pre>
52+
</div>
53+
<div class="example"> <pre># beginShape 1 https://processing.org/reference/beginShape_.html
54+
55+
beginShape()
56+
vertex(30, 20)
57+
vertex(85, 20)
58+
vertex(85, 75)
59+
vertex(30, 75)
60+
endShape(CLOSE)
61+
</pre>
62+
</div>
63+
<div class="example"> <pre># beginShape 5 https://processing.org/reference/beginShape_.html
64+
65+
noFill()
66+
beginShape()
67+
vertex(30, 20)
68+
vertex(85, 20)
69+
vertex(85, 75)
70+
vertex(30, 75)
71+
endShape(CLOSE)
72+
</pre>
73+
</div>
74+
<div class="example"> <pre># beginShape 3 https://processing.org/reference/beginShape_.html
75+
76+
beginShape(LINES)
77+
vertex(30, 20)
78+
vertex(85, 20)
79+
vertex(85, 75)
80+
vertex(30, 75)
81+
endShape()
82+
</pre>
83+
</div>
84+
<div class="example"> <pre># beginShape 2 https://processing.org/reference/beginShape_.html
85+
86+
beginShape(POINTS)
87+
vertex(30, 20)
88+
vertex(85, 20)
89+
vertex(85, 75)
90+
vertex(30, 75)
91+
endShape()
92+
</pre>
93+
</div>
94+
</tr>
4195

4296
<tr class="">
4397
<th scope="row">Description</th>

docs/bezier.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@
3838
<td><h3>bezier</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># bezier 1 https://processing.org/reference/bezier_.html
43+
44+
noFill()
45+
stroke(255, 102, 0)
46+
line(85, 20, 10, 10)
47+
line(90, 90, 15, 80)
48+
stroke(0, 0, 0)
49+
bezier(85, 20, 10, 10, 90, 90, 15, 80)
50+
</pre>
51+
</div>
52+
<div class="example"> <pre># bezier 2 https://processing.org/reference/bezier_.html
53+
54+
noFill()
55+
stroke(255, 102, 0)
56+
line(30, 20, 80, 5)
57+
line(80, 75, 30, 75)
58+
stroke(0, 0, 0)
59+
bezier(30, 20, 80, 5, 80, 75, 30, 75)
60+
</pre>
61+
</div>
62+
</tr>
4163

4264
<tr class="">
4365
<th scope="row">Description</th>

docs/bezierPoint.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@
3838
<td><h3>bezierPoint</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># bezierPoint 1 https://processing.org/reference/bezierPoint_.html
43+
44+
noFill()
45+
bezier(85, 20, 10, 10, 90, 90, 15, 80)
46+
fill(255)
47+
steps &lt;- 10
48+
for (i in 0:steps) {
49+
t &lt;- i/steps
50+
x = bezierPoint(85, 10, 90, 15, t)
51+
y = bezierPoint(20, 10, 90, 80, t)
52+
ellipse(x, y, 5, 5)
53+
}
54+
</pre>
55+
</div>
56+
</tr>
4157

4258
<tr class="">
4359
<th scope="row">Description</th>

docs/bezierTangent.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,52 @@
3838
<td><h3>bezierTangent</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># bezierTangent 2 https://processing.org/reference/bezierTangent_.html
43+
44+
noFill()
45+
bezier(85, 20, 10, 10, 90, 90, 15, 80)
46+
stroke(255, 102, 0)
47+
steps &lt;- 16
48+
for (i in 0:steps) {
49+
t &lt;- i/steps
50+
x &lt;- bezierPoint(85, 10, 90, 15, t)
51+
y &lt;- bezierPoint(20, 10, 90, 80, t)
52+
tx &lt;- bezierTangent(85, 10, 90, 15, t)
53+
ty &lt;- bezierTangent(20, 10, 90, 80, t)
54+
a &lt;- atan2(ty, tx)
55+
a &lt;- a - HALF_PI
56+
line(x, y, cos(a) * 8 + x, sin(a) * 8 + y)
57+
}
58+
</pre>
59+
</div>
60+
<div class="example"> <pre># bezierTangent 1 https://processing.org/reference/bezierTangent_.html
61+
62+
noFill()
63+
bezier(85, 20, 10, 10, 90, 90, 15, 80)
64+
steps &lt;- 6
65+
fill(255)
66+
for (i in 0:steps) {
67+
t &lt;- i/steps
68+
# Get the location of the point
69+
x &lt;- bezierPoint(85, 10, 90, 15, t)
70+
y &lt;- bezierPoint(20, 10, 90, 80, t)
71+
# Get the tangent points
72+
tx &lt;- bezierTangent(85, 10, 90, 15, t)
73+
ty &lt;- bezierTangent(20, 10, 90, 80, t)
74+
# Calculate an angle from the tangent points
75+
a &lt;- atan2(ty, tx)
76+
a = a + PI
77+
stroke(255, 102, 0)
78+
line(x, y, cos(a) * 30 + x, sin(a) * 30 + y)
79+
# The following line of code makes a line inverse of the above line line(x, y,
80+
# cos(a)*-30 + x, sin(a)*-30 + y)
81+
stroke(0)
82+
ellipse(x, y, 5, 5)
83+
}
84+
</pre>
85+
</div>
86+
</tr>
4187

4288
<tr class="">
4389
<th scope="row">Description</th>

docs/bezierVertex.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@
3838
<td><h3>bezierVertex</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># bezierVertex 1 https://processing.org/reference/bezierVertex_.html
43+
44+
noFill()
45+
beginShape()
46+
vertex(30, 20)
47+
bezierVertex(80, 0, 80, 75, 30, 75)
48+
endShape()
49+
</pre>
50+
</div>
51+
<div class="example"> <pre># bezierVertex 2 https://processing.org/reference/bezierVertex_.html
52+
53+
beginShape()
54+
vertex(30, 20)
55+
bezierVertex(80, 0, 80, 75, 30, 75)
56+
bezierVertex(50, 80, 60, 25, 30, 20)
57+
endShape()
58+
</pre>
59+
</div>
60+
</tr>
4161

4262
<tr class="">
4363
<th scope="row">Description</th>

docs/controlflow.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@
3838
<td><h3>controlflow</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre>for(i in 1:5) print(1:i)
43+
for(n in c(2,5,10,20,50)) {
44+
x &lt;- stats::rnorm(n)
45+
cat(n, &#34;: &#34;, sum(x^2), &#34;\n&#34;, sep = &#34;&#34;)
46+
}
47+
f &lt;- factor(sample(letters[1:5], 10, replace = TRUE))
48+
for(i in unique(f)) print(i)
49+
</pre>
50+
</div>
51+
</tr>
4152

4253
<tr class="">
4354
<th scope="row">Description</th>

docs/curve.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@
3838
<td><h3>curve</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># curve 1 https://processing.org/reference/curve_.html
43+
44+
noFill()
45+
stroke(255, 102, 0)
46+
curve(5, 26, 5, 26, 73, 24, 73, 61)
47+
stroke(0)
48+
curve(5, 26, 73, 24, 73, 61, 15, 65)
49+
stroke(255, 102, 0)
50+
curve(73, 24, 73, 61, 15, 65, 15, 65)
51+
</pre>
52+
</div>
53+
</tr>
4154

4255
<tr class="">
4356
<th scope="row">Description</th>

docs/curvePoint.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@
3838
<td><h3>curvePoint</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># curvePoint 1 https://processing.org/reference/curvePoint_.html
43+
44+
noFill()
45+
curve(5, 26, 5, 26, 73, 24, 73, 61)
46+
curve(5, 26, 73, 24, 73, 61, 15, 65)
47+
fill(255)
48+
ellipseMode(CENTER)
49+
50+
steps &lt;- 6
51+
for (i in 0:steps) {
52+
t &lt;- i/steps
53+
x &lt;- curvePoint(5, 5, 73, 73, t)
54+
y &lt;- curvePoint(26, 26, 24, 61, t)
55+
ellipse(x, y, 5, 5)
56+
x &lt;- curvePoint(5, 73, 73, 15, t)
57+
y &lt;- curvePoint(26, 24, 61, 65, t)
58+
ellipse(x, y, 5, 5)
59+
}
60+
</pre>
61+
</div>
62+
</tr>
4163

4264
<tr class="">
4365
<th scope="row">Description</th>

docs/curveTangent.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@
3838
<td><h3>curveTangent</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># curveTangent 1 https://processing.org/reference/curveTangent_.html
43+
44+
noFill()
45+
curve(5, 26, 73, 24, 73, 61, 15, 65)
46+
steps &lt;- 6
47+
for (i in 0:steps) {
48+
t &lt;- i/steps
49+
x &lt;- curvePoint(5, 73, 73, 15, t)
50+
y &lt;- curvePoint(26, 24, 61, 65, t)
51+
# ellipse(x, y, 5, 5)
52+
tx &lt;- curveTangent(5, 73, 73, 15, t)
53+
ty &lt;- curveTangent(26, 24, 61, 65, t)
54+
a &lt;- atan2(ty, tx)
55+
a = a - HALF_PI
56+
line(x, y, cos(a) * 8 + x, sin(a) * 8 + y)
57+
}
58+
</pre>
59+
</div>
60+
</tr>
4161

4262
<tr class="">
4363
<th scope="row">Description</th>

docs/curveTightness.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,47 @@
3838
<td><h3>curveTightness</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># curveTightness 1x -- original fails on map, mouseX
43+
# https://processing.org/reference/curveTightness_.html
44+
45+
settings &lt;- function() {
46+
size(100, 100, P3D)
47+
}
48+
49+
setup &lt;- function() {
50+
noFill()
51+
noLoop()
52+
}
53+
54+
draw &lt;- function() {
55+
# t &lt;- map(50, 0, width, -5, 5)
56+
background(204)
57+
# curveTightness(t)
58+
59+
mycurve(-1)
60+
translate(0, 10)
61+
mycurve(0)
62+
translate(0, 10)
63+
mycurve(1)
64+
translate(0, 10)
65+
mycurve(2)
66+
}
67+
68+
mycurve &lt;- function(tightness) {
69+
curveTightness(tightness)
70+
beginShape()
71+
curveVertex(10, 26)
72+
curveVertex(10, 26)
73+
curveVertex(83, 24)
74+
curveVertex(83, 61)
75+
curveVertex(25, 65)
76+
curveVertex(25, 65)
77+
endShape()
78+
}
79+
</pre>
80+
</div>
81+
</tr>
4182

4283
<tr class="">
4384
<th scope="row">Description</th>

docs/curveVertex.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@
3838
<td><h3>curveVertex</h3></td>
3939
</tr>
4040

41+
<tr class=""><th scope="row">Examples</th><td>
42+
<div class="example"> <pre># curveVertex 1 https://processing.org/reference/curveVertex_.html
43+
44+
noFill()
45+
beginShape()
46+
curveVertex(84, 91)
47+
curveVertex(84, 91)
48+
curveVertex(68, 19)
49+
curveVertex(21, 17)
50+
curveVertex(32, 100)
51+
curveVertex(32, 100)
52+
endShape()
53+
</pre>
54+
</div>
55+
</tr>
4156

4257
<tr class="">
4358
<th scope="row">Description</th>

0 commit comments

Comments
 (0)