data-raw/truncatedIcosahedron.R

C0 <- (1 + sqrt(5)) / 4
C1 <- (1 + sqrt(5)) / 2
C2 <- (5 + sqrt(5)) / 4
C3 <- (2 + sqrt(5)) / 2
C4 <- 3*(1 + sqrt(5)) / 4

vertices <- rbind(
  V0  = c( 0.5,  0.0,   C4),
  V1  = c( 0.5,  0.0,  -C4),
  V2  = c(-0.5,  0.0,   C4),
  V3  = c(-0.5,  0.0,  -C4),
  V4  = c(  C4,  0.5,  0.0),
  V5  = c(  C4, -0.5,  0.0),
  V6  = c( -C4,  0.5,  0.0),
  V7  = c( -C4, -0.5,  0.0),
  V8  = c( 0.0,   C4,  0.5),
  V9  = c( 0.0,   C4, -0.5),
  V10 = c( 0.0,  -C4,  0.5),
  V11 = c( 0.0,  -C4, -0.5),
  V12 = c( 1.0,   C0,   C3),
  V13 = c( 1.0,   C0,  -C3),
  V14 = c( 1.0,  -C0,   C3),
  V15 = c( 1.0,  -C0,  -C3),
  V16 = c(-1.0,   C0,   C3),
  V17 = c(-1.0,   C0,  -C3),
  V18 = c(-1.0,  -C0,   C3),
  V19 = c(-1.0,  -C0,  -C3),
  V20 = c(  C3,  1.0,   C0),
  V21 = c(  C3,  1.0,  -C0),
  V22 = c(  C3, -1.0,   C0),
  V23 = c(  C3, -1.0,  -C0),
  V24 = c( -C3,  1.0,   C0),
  V25 = c( -C3,  1.0,  -C0),
  V26 = c( -C3, -1.0,   C0),
  V27 = c( -C3, -1.0,  -C0),
  V28 = c(  C0,   C3,  1.0),
  V29 = c(  C0,   C3, -1.0),
  V30 = c(  C0,  -C3,  1.0),
  V31 = c(  C0,  -C3, -1.0),
  V32 = c( -C0,   C3,  1.0),
  V33 = c( -C0,   C3, -1.0),
  V34 = c( -C0,  -C3,  1.0),
  V35 = c( -C0,  -C3, -1.0),
  V36 = c( 0.5,   C1,   C2),
  V37 = c( 0.5,   C1,  -C2),
  V38 = c( 0.5,  -C1,   C2),
  V39 = c( 0.5,  -C1,  -C2),
  V40 = c(-0.5,   C1,   C2),
  V41 = c(-0.5,   C1,  -C2),
  V42 = c(-0.5,  -C1,   C2),
  V43 = c(-0.5,  -C1,  -C2),
  V44 = c(  C2,  0.5,   C1),
  V45 = c(  C2,  0.5,  -C1),
  V46 = c(  C2, -0.5,   C1),
  V47 = c(  C2, -0.5,  -C1),
  V48 = c( -C2,  0.5,   C1),
  V49 = c( -C2,  0.5,  -C1),
  V50 = c( -C2, -0.5,   C1),
  V51 = c( -C2, -0.5,  -C1),
  V52 = c(  C1,   C2,  0.5),
  V53 = c(  C1,   C2, -0.5),
  V54 = c(  C1,  -C2,  0.5),
  V55 = c(  C1,  -C2, -0.5),
  V56 = c( -C1,   C2,  0.5),
  V57 = c( -C1,   C2, -0.5),
  V58 = c( -C1,  -C2,  0.5),
  V59 = c( -C1,  -C2, -0.5)
)

faces <- list(
  1L + c(  0L,  2L, 18L, 42L, 38L, 14L ),
  1L + c(  1L,  3L, 17L, 41L, 37L, 13L ),
  1L + c(  2L,  0L, 12L, 36L, 40L, 16L ),
  1L + c(  3L,  1L, 15L, 39L, 43L, 19L ),
  1L + c(  4L,  5L, 23L, 47L, 45L, 21L ),
  1L + c(  5L,  4L, 20L, 44L, 46L, 22L ),
  1L + c(  6L,  7L, 26L, 50L, 48L, 24L ),
  1L + c(  7L,  6L, 25L, 49L, 51L, 27L ),
  1L + c(  8L,  9L, 33L, 57L, 56L, 32L ),
  1L + c(  9L,  8L, 28L, 52L, 53L, 29L ),
  1L + c( 10L, 11L, 31L, 55L, 54L, 30L ),
  1L + c( 11L, 10L, 34L, 58L, 59L, 35L ),
  1L + c( 12L, 44L, 20L, 52L, 28L, 36L ),
  1L + c( 13L, 37L, 29L, 53L, 21L, 45L ),
  1L + c( 14L, 38L, 30L, 54L, 22L, 46L ),
  1L + c( 15L, 47L, 23L, 55L, 31L, 39L ),
  1L + c( 16L, 40L, 32L, 56L, 24L, 48L ),
  1L + c( 17L, 49L, 25L, 57L, 33L, 41L ),
  1L + c( 18L, 50L, 26L, 58L, 34L, 42L ),
  1L + c( 19L, 43L, 35L, 59L, 27L, 51L ),
  1L + c(  0L, 14L, 46L, 44L, 12L ),
  1L + c(  1L, 13L, 45L, 47L, 15L ),
  1L + c(  2L, 16L, 48L, 50L, 18L ),
  1L + c(  3L, 19L, 51L, 49L, 17L ),
  1L + c(  4L, 21L, 53L, 52L, 20L ),
  1L + c(  5L, 22L, 54L, 55L, 23L ),
  1L + c(  6L, 24L, 56L, 57L, 25L ),
  1L + c(  7L, 27L, 59L, 58L, 26L ),
  1L + c(  8L, 32L, 40L, 36L, 28L ),
  1L + c(  9L, 29L, 37L, 41L, 33L ),
  1L + c( 10L, 30L, 38L, 42L, 34L ),
  1L + c( 11L, 35L, 43L, 39L, 31L )
)

library(MeshesOperations)
truncatedIcosahedron <- Mesh(vertices, faces)
stla/MeshesOperations documentation built on Oct. 23, 2022, 8:23 a.m.