Geometries located in space (all except directions and vectors), have one or more points supporting it. Those can be extracted with vertex(). For geometries with a cardinality above one there's a choice of which support point to extract.

vertex(x, which = 1L)

Arguments

x

A vector of geometries

which

An integer vector giving the vertex to extract in cases of higher cardinality geometries

Value

A euclid_point vector matching the dimensionality of x

Vertex definition

For geometries that are defined exclusively by points the definition of the output is straight forward, e.g. for triangles vertex() will extract one of the corners depending on the value of which. For the other geometries the output is defined according to the below:

  • circles and spheres: The vertex is the center

  • rays: The vertex is the source

  • lines and planes: The vertex is an arbitrary point on the geometry

Examples

# Get the source vertex in a segment s <- segment(point(3, 6), point(1, -7)) vertex(s, 1)
#> <2D points [1]> #> [1] <x:3, y:6>
# And the target vertex(s, 2)
#> <2D points [1]> #> [1] <x:1, y:-7>
# Arguments are recycled vertex(s, c(1, 2))
#> <2D points [1]> #> [1] <x:3, y:6>
# Get a point on a line vertex(line(4, 7, -1))
#> <2D points [1]> #> [1] <x:1, y:-0.429>