pA <- ob_point(0,0)
pB <- ob_point(2,0)
sAB <- ob_segment(pA,pB, color = red)
pC <- ob_circle(sAB@midpoint(),
radius = distance(pA, pB) / 2)@point_at(120)
sAC <- ob_segment(pA, pC, color = yellow)
sBC <- ob_segment(pB, pC, color = blue)
pD <- rotate(pB, degree(-90), origin = pA)
pE <- rotate(pA, degree(90), origin = pB)
pF <- rotate(pB, degree(90), origin = pC)
pG <- rotate(pC, degree(-90), origin = pB)
pH <- rotate(pA, degree(-90), origin = pC)
pI <- rotate(pC, degree(90), origin = pA)
# make copy so underlying dash is background color
sBE <- ob_segment(pB,
pE,
color = red,
linetype = "11")
sBE2 <- sBE %>% set_props(color = bg, linetype = "solid")
sCE <- ob_segment(pC, pE, color = yellow, linewidth = 1)
sAG <- ob_segment(pA, pG, color = yellow, linewidth = 1)
sCD <- ob_segment(pC, pD, color = blue, linewidth = 1)
sBI <- ob_segment(pB, pI, color = blue, linewidth = 1)
sBG <- ob_segment(pB,
pG,
color = blue,
linetype = "11")
sBG2 <- sBG %>%
set_props(color = bg,
linetype = "solid")
lC <- ob_line(xintercept = pC@x)
sDE <- ob_segment(pD, pE)
pJ <- intersection(lC, sDE)
pK <- intersection(lC, sAB)
sCJ <- ob_segment(pC,
pJ,
color = black,
linetype = "11")
sCJ2 <- sCJ %>%
set_props(color = bg,
linetype = "solid")
# Bind points
p <- bind(c(pA, pB, pC, pD, pE, pF, pG, pH, pI, pJ, pK))
# points for orienting labels
p_orient <- bind(
c(pG, pA, pE, pB, pA, pB, pC, pA, pC, pC, nudge(pK, -.01, -.01))
)
# polar adjustments for labels
p_just <- ob_polar((p - p_orient)@theta , r = 1.4)
baseplot +
scale_y_continuous(expand = expansion(.2)) +
ob_polygon(bind(c(pB, pC, pF, pG)), fill = red, color = NA) +
ob_polygon(bind(c(pA, pB, pE, pD)), fill = blue, color = NA) +
ob_polygon(bind(c(pA, pC, pH, pI)), fill = black, color = NA) +
ob_polygon(bind(c(pA, pD, pJ, pK)), fill = yellow, color = NA) +
ob_wedge(
pB,
radius = .4,
start = (pC - pB)@theta,
end = (pA - pB)@theta,
fill = black,
color = NA
) +
ob_wedge(
pB,
radius = .4,
start = (pA - pB)@theta,
end = (pE - pB)@theta@positive,
fill = yellow,
color = NA
) +
ob_wedge(
pB,
radius = .4,
start = (pG - pB)@theta,
end = (pC - pB)@theta,
fill = yellow,
color = NA
) +
sBC +
sAB +
sCE +
sAG +
sAC +
sCJ2 + sCJ +
sBE2 + sBE +
sBG2 + sBG +
ob_label(
c(LETTERS[seq(1, p@length)]),
center = p,
fill = NA,
color = black,
polar_just = p_just,
label.r = unit(9, units = "pt"),
label.padding = margin(4, 3, 1, 3)
)