R/00_vertex.R

Defines functions sc_vertex.pslg sc_vertex.PATH0 sc_vertex.PATH sc_vertex.TRI0 sc_vertex.TRI sc_vertex.ARC sc_vertex.SC0 sc_vertex.SC sc_vertex.default sc_vertex

Documented in sc_vertex sc_vertex.ARC sc_vertex.default sc_vertex.PATH sc_vertex.PATH0 sc_vertex.pslg sc_vertex.SC sc_vertex.SC0 sc_vertex.TRI sc_vertex.TRI0

#' Extract unique vertices
#'
#' @param x model
#' @param ... passed to methods
#' @return data frame of only the unique coordinates
#' @export
#' @examples
#' sc_vertex(minimal_mesh)
#' sc_vertex(SC0(minimal_mesh))
sc_vertex <- function(x, ...) {
  UseMethod("sc_vertex")
}
#' @name sc_vertex
#' @export
sc_vertex.default <- function(x, ...) {
  SC0(x)[["vertex"]]
}

#' @name sc_vertex
#' @export
sc_vertex.SC <- function(x, ...) {
  x[["vertex"]]
}
#' @name sc_vertex
#' @export
sc_vertex.SC0 <- function(x, ...) {
  x[["vertex"]]
}
#' @name sc_vertex
#' @export
sc_vertex.ARC <- function(x, ...) {
  x[["vertex"]]
}
#' @name sc_vertex
#' @export
sc_vertex.TRI <- function(x, ...) {
  x[["vertex"]]
}
#' @name sc_vertex
#' @export
sc_vertex.TRI0 <- function(x, ...) {
  x[["vertex"]]
}

#' @name sc_vertex
#' @export
sc_vertex.PATH <- function(x, ...) {
  x[["vertex"]]
}
#' @name sc_vertex
#' @export
sc_vertex.PATH0 <- function(x, ...) {
  x[["vertex"]]
}

#' @name sc_vertex
#' @export
sc_vertex.pslg <- function(x, ...) {
  tibble::tibble(x_ = x$P[,1L], y_ = x$P[,2L])
}
mdsumner/sc documentation built on Jan. 16, 2024, 2:03 a.m.