Computes the coordinates of a spring from (x, y) to (xend, yend),
in the same units as the coordinates. This is the geometry used by
geom_spring(), which however computes it in mm on the screen. Use
create_spring() to draw a spring in data coordinates, e.g. with
ggplot2::geom_path() and ggplot2::coord_equal().
Usage
create_spring(
x,
y,
xend,
yend,
diameter = 1,
coils = 10,
n = 50,
shape = c("zigzag", "wave", "coil")
)Arguments
- x, y
Starting coordinates.
- xend, yend
Ending coordinates.
- diameter
Diameter of the coils, in the units of
xandy.- coils
Number of coils (turns) in the spring.
- n
Number of points used to draw each coil.
- shape
How the spring is drawn:
"zigzag","wave"or"coil". Seegeom_spring().

