This function gives access to the underlying values defining the geometries in a vector. As such they return the same information as calling as.matrix() on a geometry vector except the return value is kept as an exact numeric and that you can extract from single elements if the cardinality of the geometry exceeds 1.

parameter(x, ...)

# S3 method for euclid_geometry
parameter(x, which, element = NA, ...)

# S3 method for euclid_affine_transformation
parameter(x, i, j, ...)

## Arguments

x

A geometry vector

...

parameters to pass on

which

Either a name or the index of the definition to extract, as matched to definition_names(x)

element

For geometries with a cardinality above 1, which element of the geometry should the definition be extracted for. If NA the definition for all elements will be returned and the length of the returned vector will be sum(cardinality(x)) (matching the return of as.matrix(x))

i, j

The row and column of the cell in the transformation to fetch.

## Value

An exact_numeric vector

Other Geometry methods: euclid_geometry, vertex()

## Examples

# Get squared radius of circle
circ <- circle(point(4, 7), 25)
parameter(circ, "r2")
#> <exact numerics [1]>
#> [1] 25

# Get all the x values from the source of segments
s <- segment(point(sample(10, 4), sample(10, 4)),
point(sample(10, 4), sample(10, 4)))
parameter(s, "x", 1L)
#> <exact numerics [4]>
#> [1] 1 7 4 6

# Get y for all subelements
parameter(s, "y")
#> <exact numerics [8]>
#> [1] 8 1 9 2 4 4 5 3

# Extract cell values from transformation matrices
m <- affine_rotate(c(pi/2, pi/3))
parameter(m, 1, 2)
#> <exact numerics [2]>
#> [1] -1.0000000 -0.8660254