cost.active: Relative cost of active movement through a flow

View source: R/wind_functions2.R

cost.activeR Documentation

Relative cost of active movement through a flow

Description

cost.active() is a deliberately simple, general index based on signed flow support. The flow component parallel to movement is speed * cos(angle). Supportive flow lowers cost, opposing flow raises it, and perpendicular flow has no effect. This is a relative index, not physical travel time or energy.

Usage

cost.active(flow.direction, flow.speed, target, speed.scale = NULL)

Arguments

flow.direction

Flow direction in degrees, pointing towards where the flow moves.

flow.speed

Non-negative flow speed.

target

Movement direction in degrees.

speed.scale

Positive reference speed used to make flow support dimensionless. By default, the median positive input speed is used.

Details

Let z = speed * cos(angle) / speed.scale. When z >= 0, cost is 1 / (1 + z); when z < 0, cost is 1 - z. Thus support equal to the reference speed halves cost, opposition equal to the reference speed doubles it, and cost(-z) = 1 / cost(z).

Value

A numeric vector of relative movement costs, or a numeric array when the input supplying the output shape is an array. Scalar inputs are recycled to match the longer input. A value below one indicates support, one indicates calm or perpendicular flow, and a value above one indicates opposition. Invalid flow values give Inf, except that zero speed gives a cost of one even when direction is missing.


rWind documentation built on Oct. 18, 2026, 5:08 p.m.