-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rayrender basics #120
Comments
In rayrender a At the end of the loop (before us_states = spData::us_states
p = us_states[1:3, ] #us_states$NAME == "Texas",]
class(p$geometry) = c("list","sfc")
library(rayrender)
rd <- extruded_polygon(p, center = F,
material=diffuse(color="#ff2222",sigma=90),
flip_horizontal = F, flip_vertical = F)
gibble::gibble(p)
# A tibble: 3 x 5
nrow ncol type subobject object
<int> <int> <chr> <int> <int>
1 51 2 MULTIPOLYGON 1 1
2 58 2 MULTIPOLYGON 1 2
3 28 2 MULTIPOLYGON 1 3
The first 3 objects of us_states then look like this: Browse[1]> lapply(poly_list, nrow)
[[1]]
[1] 51
[[2]]
[1] 58
[[3]]
[1] 28
lapply(poly_list, head)
[1]]
x y hole
[1,] 88.20006 34.99563 0
[2,] 88.20296 35.00803 0
[3,] 87.42861 35.00279 0
[4,] 86.86215 34.99196 0
[5,] 85.60516 34.98468 0
[6,] 85.47047 34.32824 0
[[2]]
x y hole
[1,] 114.7196 32.71876 0
[2,] 114.5391 32.75695 0
[3,] 114.4690 32.84515 0
[4,] 114.5061 33.01701 0
[5,] 114.6708 33.03798 0
[6,] 114.7079 33.09743 0
[[3]]
x y hole
[1,] 109.0501 41.00066 0
[2,] 108.2506 41.00011 0
[3,] 107.6256 41.00212 0
[4,] 106.2176 40.99773 0
[5,] 105.7304 40.99689 0
[6,] 104.8553 40.99805 0 and above that code has
and by this stage vertex_list is the indices into poly_list poly_list[[1]] = as.matrix(data.frame(x=x,y=y,hole=holes))
vertex_list[[1]] = decido::earcut(poly_list[[1]][,1:2],holes = holes) It doesn't look like polygons are extruded, it looks like the triangles have walls put on them (check this). I expect n triangles + 2 * n-segments per feature, or n triangles + n*3-edges * 2 for the walls, but it's not that exactly - not sure yet. dim(rd)
[1] 524 34
silicate::TRI0(p)
class : TRI0
type : Primitive
vertices : 133 (2-space)
primitives : 128 (2-space)
crs : EPSG:4269
silicate::SC(p)
128 + 2 * 128
[1] 384
128 + 3 * 128
[1] 512 After that
I don't know about speed, but at least the handling could be simplified and not care if input is sp or sf. |
I have no idea about using rayrender, so this is just notes as I learn what it's about.
With
we can do
woo
The text was updated successfully, but these errors were encountered: