# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Euclidean distance between two points.
#' @param a A point.
#' @param b A point.
#' @return The distance between two points.
#' @noRd
NULL
#' Squared Euclidean distance between two points.
#' @param a A point.
#' @param b A point.
#' @return The distance between two points.
#' @noRd
NULL
#' Move a box into the area specificied by x limits and y limits.
#' @param b A box like \code{c(x1, y1, x2, y2)}
#' @param xlim A Point with limits on the x axis like \code{c(xmin, xmax)}
#' @param ylim A Point with limits on the y axis like \code{c(xmin, xmax)}
#' @param force Magnitude of the force (defaults to \code{1e-6})
#' @noRd
NULL
#' Get the coordinates of the center of a box.
#' @param b A box like \code{c(x1, y1, x2, y2)}
#' @noRd
NULL
#' Test if a box overlaps another box.
#' @param a A box like \code{c(x1, y1, x2, y2)}
#' @param b A box like \code{c(x1, y1, x2, y2)}
#' @noRd
NULL
#' Test if a box overlaps another box.
#' @param a A box like \code{c(x1, y1, x2, y2)}
#' @param b A box like \code{c(x1, y1, x2, y2)}
#' @noRd
NULL
#' Compute the repulsion force upon point \code{a} from point \code{b}.
#'
#' The force decays with the squared distance between the points, similar
#' to the force of repulsion between magnets.
#'
#' @param a A point like \code{c(x, y)}
#' @param b A point like \code{c(x, y)}
#' @param force Magnitude of the force (defaults to \code{1e-6})
#' @param direction direction in which to exert force, either "both", "x", or "y"
#' @noRd
NULL
#' Compute the spring force upon point \code{a} from point \code{b}.
#'
#' The force increases with the distance between the points, similar
#' to Hooke's law for springs.
#'
#' @param a A point like \code{c(x, y)}
#' @param b A point like \code{c(x, y)}
#' @param force Magnitude of the force (defaults to \code{1e-6})
#' @param direction direction in which to exert force, either "both", "x", or "y"
#' @noRd
NULL
#' Euclidean distance between two points.
#' @param a A numeric vector.
#' @param b A numeric vector.
#' @return The distance between two points.
#' @noRd
euclid <- function(a, b) {
.Call('_latticetools_euclid', PACKAGE = 'latticetools', a, b)
}
#' Get the coordinates of the center of a box.
#' @param b A box like \code{c(x1, y1, x2, y2)}
#' @noRd
centroid <- function(b, hjust, vjust) {
.Call('_latticetools_centroid', PACKAGE = 'latticetools', b, hjust, vjust)
}
#' Find the intersections between a line and a rectangle.
#' @param c A circle like \code{c(x, y, r)}
#' @param r A rectangle like \code{c(x1, y1, x2, y2)}
#' @noRd
intersect_circle_rectangle <- function(c, r) {
.Call('_latticetools_intersect_circle_rectangle', PACKAGE = 'latticetools', c, r)
}
#' Find the intersection between a line and a circle.
#' @param p1 A point on the line like \code{c(x, y)}
#' @param p2 A point at the circle's center
#' @param r The circle's radius
#' @noRd
intersect_line_circle <- function(p1, p2, r) {
.Call('_latticetools_intersect_line_circle', PACKAGE = 'latticetools', p1, p2, r)
}
#' Find the intersections between a line and a rectangle.
#' @param p1 A point like \code{c(x, y)}
#' @param p2 A point like \code{c(x, y)}
#' @param b A rectangle like \code{c(x1, y1, x2, y2)}
#' @noRd
intersect_line_rectangle <- function(p1, p2, b) {
.Call('_latticetools_intersect_line_rectangle', PACKAGE = 'latticetools', p1, p2, b)
}
select_line_connection <- function(p1, b) {
.Call('_latticetools_select_line_connection', PACKAGE = 'latticetools', p1, b)
}
approximately_equal <- function(x1, x2) {
.Call('_latticetools_approximately_equal', PACKAGE = 'latticetools', x1, x2)
}
#' Adjust the layout of a list of potentially overlapping boxes.
#' @param data_points A numeric matrix with rows representing points like
#' \code{rbind(c(x, y), c(x, y), ...)}
#' @param point_size A numeric vector representing the sizes of data points.
#' @param point_padding_x Padding around each data point on the x axis.
#' @param point_padding_y Padding around each data point on the y axis.
#' @param boxes A numeric matrix with rows representing boxes like
#' \code{rbind(c(x1, y1, x2, y2), c(x1, y1, x2, y2), ...)}
#' @param xlim A numeric vector representing the limits on the x axis like
#' \code{c(xmin, xmax)}
#' @param ylim A numeric vector representing the limits on the y axis like
#' \code{c(ymin, ymax)}
#' @param hjust Optional horizontal adjustment of labels
#' @param vjust Optional vertical adjustment of labels
#' @param force_push Magnitude of the push force (defaults to \code{1e-7})
#' @param force_pull Magnitude of the pull force (defaults to \code{1e-7})
#' @param max_time Maximum number of seconds to try to resolve overlaps
#' (defaults to 0.1)
#' @param max_overlaps Maximum number of overlaps without triggering a warning
#' @param max_iter Maximum number of iterations to try to resolve overlaps
#' (defaults to 2000)
#' @param direction Character, one of "x", "y", or "both
#' @param verbose Boolean,
#' @export repel_boxes
repel_boxes <- function(data_points, point_size, point_padding_x, point_padding_y, boxes, xlim, ylim, hjust, vjust, force_push = 1e-7, force_pull = 1e-7, max_time = 0.1, max_overlaps = 10, max_iter = 2000L, direction = "both", verbose = 0L) {
.Call('_latticetools_repel_boxes', PACKAGE = 'latticetools', data_points, point_size, point_padding_x, point_padding_y, boxes, xlim, ylim, hjust, vjust, force_push, force_pull, max_time, max_overlaps, max_iter, direction, verbose)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.