## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 5,
                      dpi = 96, out.width = "100%")
# on Linux the default X11 png device cannot draw semi-transparent fills; use cairo there
if (Sys.info()[["sysname"]] == "Linux" && isTRUE(capabilities("cairo"))) knitr::opts_chunk$set(dev.args = list(png = list(type = "cairo")))
library(forensicR)

## ----report, eval = FALSE-----------------------------------------------------
# out <- render_scene_report(
#   output_dir = "report",
#   formats = c("docx", "pdf", "html"),      # any subset
#   params = list(
#     case_id      = "2026-004417",
#     agency       = "Douglas County Sheriff's Office",
#     investigator = "K. Quadros",
#     scene_date   = as.Date("2026-09-06"),
#     units        = "m",
#     narrative    = "Single-family residence, living room. ...",   # markdown text
#     points       = scene,          # coords_*() tibble
#     walls        = walls,          # room_rect() + opening()
#     furniture    = furn,           # furniture() tibble
#     wall_height  = 2.5,
#     shooting     = list(
#       impact       = impact_angle(c(9.1, 6.0), c(9.3, 12.5), se = 0.5),
#       trajectories = list(t_rod, t_2pt, shot4),     # trajectories and/or paths
#       heights      = c(standing = 1.5, kneeling = 1.0, prone = 0.3),
#       max_distance = 12
#     ),
#     evidence     = log,            # evidence_log()
#     death_scene  = ds,             # death_scene_record()
#     scene3d      = TRUE            # 3D figure (PDF/Word) or widget (HTML)
#   )
# )
# out          # named paths of the files produced

## ----template, eval = FALSE---------------------------------------------------
# scene_report_skeleton("my-agency-report.Rmd")   # editable copy of the template
# render_scene_report(input = "my-agency-report.Rmd", output_dir = "report", params = list(...))

## ----still, eval = FALSE------------------------------------------------------
# render_scene_3d(walls, scene, trajs, furniture = furn,
#                 file = "scene3d.png",
#                 view = "dollhouse",        # or "door", "corner", "overhead"
#                 grid_on = c("floor", "walls"), grid_strength = 0.6, grid_labels = TRUE,
#                 furniture_alpha = NULL,    # per-object opacity unless overridden
#                 samples = 128)             # more samples = less grain, more time

## ----fig-doll, echo = FALSE, fig.cap = "view = \"dollhouse\": from outside, south wall removed."----
knitr::include_graphics("figures/getting-started-dollhouse.png")

## ----fig-door, echo = FALSE, fig.cap = "view = \"door\": standing in the doorway at eye level, looking at the defects. The rings are the bases of the uncertainty cones, i.e. roughly where the shooter stood."----
knitr::include_graphics("figures/getting-started-door.png")

## ----widget, eval = FALSE-----------------------------------------------------
# w <- scene_3d_widget(walls, scene, trajs, furniture = furn)
# w                                                   # in RStudio's viewer
# htmlwidgets::saveWidget(w, "scene3d.html", selfcontained = TRUE)   # to share

## ----install, eval = FALSE----------------------------------------------------
# install.packages(c("rayrender", "rgl"))   # 3D still image and interactive model
# tinytex::install_tinytex()                # if you have no LaTeX and want PDF output

