Cover
Reference
Tutorials
Bugs
settings <- function() {
size(100, 100, P3D)
}
draw <- function() {
noFill()
background(0)
pushMatrix()
# start at the middle of the screen
translate(width/2, height/2, -100)
# some random rotation to make things interesting
rotateY(1) #yrot)
rotateZ(2) #zrot)
rotateX(0)
# offset from center
translate(0, 50, 0)
# draw a white box outline at (0, 0, 0)
stroke(255)
box(50)
# the box was drawn at (0, 0, 0), store that location
x = modelX(0, 0, 0)
y = modelY(0, 0, 0)
z = modelZ(0, 0, 0)
# clear out all the transformations
popMatrix()
# draw another box at the same (x, y, z) coordinate as the other
pushMatrix()
translate(x, y, z)
stroke(255, 0, 0)
box(50)
popMatrix()
}
modelY(x ,y ,z )
| x | float: 3D x-coordinate to be mapped |
|---|---|
| y | float: 3D y-coordinate to be mapped |
| z | float: 3D z-coordinate to be mapped |