Composite object (cone + segment)

arrow(
start = c(0, 0, 0),
end = c(0, 1, 0),
tail_proportion = 0.5,
direction = NA,
from_center = TRUE,
material = diffuse(),
velocity = c(0, 0, 0),
flipped = FALSE,
scale = c(1, 1, 1)
)

## Arguments

start Default c(0, 0, 0). Base of the arrow, specifying x, y, z. Default c(0, 1, 0). Tip of the arrow, specifying x, y, z. Default 0.5. Radius of the top of the arrow. Default 0.2. Radius of the tail of the arrow. Default 0.5. Proportion of the arrow that is the tail. Default NA. Alternative to start and end, specify the direction (via a length-3 vector) of the arrow. Arrow will be centered at start, and the length will be determined by the magnitude of the direction vector. Default TRUE. If orientation specified via direction, setting this argument to FALSE will make start specify the bottom of the cone, instead of the middle. Default diffuse.The material, called from one of the material functions diffuse, metal, or dielectric. Default c(0, 0, 0). Velocity of the segment. Default FALSE. Whether to flip the normals. Default c(1, 1, 1). Scale transformation in the x, y, and z directions. If this is a single value, number, the object will be scaled uniformly. Notes: this will change the stated start/end position of the cone. Emissive objects may not currently function correctly when scaled.

## Value

Single row of a tibble describing the cone in the scene.

## Examples

#Draw a simple arrow from x = -1 to x = 1
# \donttest{
generate_studio() %>%
add_object(arrow(start = c(-1,0,0), end = c(1,0,0), material=glossy(color="red"))) %>%
render_scene(clamp_value=10,  samples=400)
#Change the proportion of tail to top
generate_studio(depth=-2) %>%
add_object(arrow(start = c(-1,-1,0), end = c(1,-1,0), tail_proportion = 0.5,
material=glossy(color="red"))) %>%
add_object(arrow(start = c(-1,0,0), end = c(1,0,0), tail_proportion = 0.75,
material=glossy(color="red"))) %>%
add_object(arrow(start = c(-1,1,0), end = c(1,1,0), tail_proportion = 0.9,
material=glossy(color="red"))) %>%
render_scene(clamp_value=10, fov=25,  samples=400)
#Change the radius of the tail/top segments
generate_studio(depth=-1.5) %>%
add_object(arrow(start = c(-1,-1,0), end = c(1,-1,0), tail_proportion = 0.75,
material=glossy(color="red"))) %>%
add_object(arrow(start = c(-1,0,0), end = c(1,0,0), tail_proportion = 0.75,
material=glossy(color="red"))) %>%
add_object(arrow(start = c(-1,1,0), end = c(1,1,0), tail_proportion = 0.75,
material=glossy(color="red"))) %>%
render_scene(clamp_value=10, samples=400)

#We can also specify arrows via a midpoint and direction:
generate_studio(depth=-1) %>%
add_object(arrow(start = c(-1,-0.5,0), direction = c(0,0,1),
material=glossy(color="green"))) %>%
add_object(arrow(start = c(1,-0.5,0), direction = c(0,0,-1),
material=glossy(color="red"))) %>%
add_object(arrow(start = c(0,-0.5,1), direction = c(1,0,0),
material=glossy(color="yellow"))) %>%
add_object(arrow(start = c(0,-0.5,-1), direction = c(-1,0,0),
material=glossy(color="purple"))) %>%
render_scene(clamp_value=10, samples=400,
lookfrom=c(0,5,10), lookat=c(0,-0.5,0), fov=16)
#Plot a 3D vector field for a gravitational well:

r = 1.5
theta_vals = seq(0,2*pi,length.out = 16)[-16]
phi_vals = seq(0,pi,length.out = 16)[-16][-1]
arrow_list = list()
counter = 1
for(theta in theta_vals) {
for(phi in phi_vals) {
rval = c(r*sin(phi)*cos(theta),r*cos(phi),r*sin(phi)*sin(theta))
arrow_list[[counter]] = arrow(rval, direction = -1/2*rval/sqrt(sum(rval*rval))^3,