-
Notifications
You must be signed in to change notification settings - Fork 16
How to document Processing.R
Please help migrate documentation from Processing to Processing.R by following these instructions.
The process is:
- Choose an undocumented reference folder containing no example subfolders, e.g.
/examples/reference/ambient/
- Look up the Processing(Java) reference page, e.g.
https://processing.org/reference/ambient_.html
- In the reference folder, update
.property.yml
from Processing.py to Processing.R details (if needed) - For each example appearing in the Processing(Java) reference:
- add an example subfolder, e.g.
/examples/reference/ambient/ambient0/
- add a name-matching .rpde file, e.g.
/examples/reference/ambient/ambient0/ambient0.rpde
- if the Processing(Java) reference example has an image, create a
.test.yml
pointing to that image
- add an example subfolder, e.g.
First choose a function or keyword that is not documented in Processing.R. This will be a folder in /master/examples/reference that contains only a .yml file, or nothing (no example folders. It corresponds to a reference keyword on the Processing Reference page. We will be translating the example code sketches from that reference into R and added tests to confirm that the R documentation will generate the same visual output as the official reference.
As an example:
- Choose a function or keyword. We choose:
ambient
. - Add a new folder in the corresponding folder: Create ambient0 in examples/reference/ambient, which means that this is the first example for ambient.
- Create two files in the folder, one is
.test.yml
, and the other isambient0.rpde
. Inambient0.rpde
you should put the example code, and in.test.yml
you need to put the link to example's image in Processing.org. In this case, the code in ambient0 should be:
P3D <- "processing.opengl.PGraphics3D"
settings <- function() {
size(100, 100, P3D)
}
draw <- function() {
background(0)
noStroke()
background(0)
directionalLight(204, 204, 204, 0.5, 0, -1)
emissive(0, 26, 51)
translate(70, 50, 0)
sphere(30)
}
You can see it is a little different with the example code in Processing Reference, since this is written in R.
and the code in .test.yml
should be:
test:
reference: https://processing.org/reference/images/ambient_.png
Finally, run ./hack/generate-e2e-test.py
to generate e2e test cases for your change and run ant test
to test it. If it passes, you have added a new item for Processing.R documentation.
You can start from these functions since it is simple.
applyMatrix()
popMatrix()
printMatrix()
pushMatrix()
resetMatrix()
rotate()
rotateX()
rotateY()
rotateZ()
scale()
shearX()
shearY()
translate()