Skip to contents

A grid of arrows representing a 2D vector field. Each arrow is placed at a grid point and oriented/scaled according to the vector function f(x, y) -> c(vx, vy).

Super classes

manimR::MObject -> manimR::VMobject -> ArrowVectorField

Public fields

func

Vector field function f(x, y) -> c(vx, vy)

x_range

c(min, max, step) for sampling grid

y_range

c(min, max, step) for sampling grid

length_func

Function mapping vector magnitude to arrow length

max_length

Maximum arrow length in scene units

color_scheme

Color scheme ("magnitude", "angle", or single color)

colors

Gradient colors for coloring

arrows

List of Arrow submobjects

Methods

Inherited methods


Method new()

Create an ArrowVectorField

Usage

ArrowVectorField$new(
  func,
  x_range = c(-5, 5, 0.5),
  y_range = c(-3, 3, 0.5),
  max_length = 0.5,
  color_scheme = "magnitude",
  colors = c(BLUE, GREEN, YELLOW, RED),
  opacity = 1,
  stroke_width = 2,
  ...
)

Arguments

func

Function(x, y) returning c(vx, vy)

x_range

c(min, max, step) grid range

y_range

c(min, max, step) grid range

max_length

Maximum arrow length

color_scheme

"magnitude", "angle", or a single hex color

colors

Gradient colors (for magnitude/angle scheme)

opacity

Arrow opacity

stroke_width

Arrow stroke width

...

Additional args


Method nudge()

Animate the field by nudging points along the flow

Usage

ArrowVectorField$nudge(dt = 0.05)

Arguments

dt

Time step

Returns

Self (for chaining/updater use)


Method get_vector()

Get the flow at a specific point

Usage

ArrowVectorField$get_vector(x, y)

Arguments

x

X coordinate

y

Y coordinate

Returns

c(vx, vy) velocity vector


Method clone()

The objects of this class are cloneable with this method.

Usage

ArrowVectorField$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.