Skip to content

Commit 2562e2f

Browse files
authored
examples: Add ComputationalGeometry (#243)
* examples: Add ComputationalGeometry Signed-off-by: Ce Gao <ce.gao@outlook.com> * README: Add a new demo Signed-off-by: Ce Gao <ce.gao@outlook.com>
1 parent 7a9a4db commit 2562e2f

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
iso <- 0
2+
3+
settings <- function() {
4+
# Please install the peasycam before you run the example.
5+
importLibrary("ComputationalGeometry")
6+
size(250, 250, P3D)
7+
}
8+
9+
setup <- function() {
10+
iso = IsoSurface$new(processing, PVector$new(0, 0, 0), PVector$new(100,
11+
100, 100), as.integer(8))
12+
for (i in 0:9) {
13+
pt = PVector$new(random(100), random(100), random(100))
14+
iso$addPoint(pt)
15+
}
16+
}
17+
18+
draw <- function() {
19+
camera(150, 150, 150, 50, 50, 40, 0, 0, -1)
20+
lights()
21+
background(220)
22+
23+
noFill()
24+
stroke(0, 10)
25+
iso$plotVoxels()
26+
27+
fill(255, 255, 0)
28+
iso$plot(mouseX/10000)
29+
}

raw-docs/img/demo-geo.gif

809 KB
Loading

readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ Processing.R supports:
3333
</div>
3434

3535
<div align="center">
36-
<img src="./raw-docs/img/demo.gif" alt="Demo" width="300">
36+
<img src="./raw-docs/img/demo.gif" alt="Demo" width="200">
37+
</div>
38+
39+
<div align="center">
40+
<img src="./raw-docs/img/demo-geo.gif" alt="Demo" width="200">
3741
</div>
3842

3943
## Early Development

0 commit comments

Comments
 (0)