Skip to contents

An ngon is a regular polygon, meaning that each side is of equal length. The ob_ngon object can be specified with a center, n (number of sides), radius, and angle. Instead of specifying a radius, one can specify either the side_length or the length of the apothem (i.e., the distance from the center to a side's midpoint.

Usage

ob_ngon(
  center = ob_point(0, 0),
  n = 3L,
  radius = numeric(0),
  angle = 0,
  label = character(0),
  side_length = numeric(0),
  apothem = numeric(0),
  vertex_radius = numeric(0),
  alpha = numeric(0),
  color = character(0),
  fill = character(0),
  linewidth = numeric(0),
  linetype = numeric(0),
  style = class_missing,
  x0 = numeric(0),
  y0 = numeric(0),
  ...
)

Arguments

center

point at center of the ngon

n

Number of sides

radius

Distance from center to a vertex

angle

description

label

A character, angle, or label object

side_length

Distance of each side

apothem

Distance from center to a side's midpoint

vertex_radius

A numeric or unit vector of length one, specifying the corner radius

alpha

numeric value for alpha transparency

color

character string for color

fill

character string for fill color

linewidth

Width of lines

linetype

type of lines

style

Gets and sets the styles associated with ob_ngon

...

<dynamic-dots> properties passed to style

Slots

area

The area of the ngons in the ob_ngon object

length

The number of ngons in the ob_ngon object

normal_at

A function that finds a point that is perpendicular from the ngon and at a specified distance

perimeter

The length of all the side segments

point_at

A function that finds a point on the ngon at the specified angle.

segments

side segments of the regular polygon

tangent_at

A function that finds the tangent line at the specified angle.

tibble

Gets a tibble (data.frame) containing parameters and styles used by ggforce::geom_shape.

vertices

points on the regular polygon