Skip to content

Crossing

Defined in: root.rs:95

pub enum Crossing {
Rising,
Falling,
Either,
Reversal,
}

Which way across zero counts as reaching the boundary.

From negative to positive.


From positive to negative.


Either direction.


Either direction, counted only where the value was not already zero.

For an event that stands for a quantity turning around rather than a margin running out: a value sitting at zero and leaving it has not turned around, it has started moving. A walk’s first state can hold exactly that — a motor whose realized torque is zero with a command to follow — and reporting a root there splits a step where nothing happened. Arriving at zero still counts, so the turn itself is not lost where a step happens to end on it.

A step that starts at zero and reverses inside it is reported only where the event says which way the value leaves that zero (RootEvent::leaves_zero_towards). g(t) = t (0.5 - t) over [0, 1] rises from zero and falls back through it at 0.5, and its two ends are (0, -0.5) — the same pair a value falling straight from zero gives, so the ends cannot tell the two apart. An event that answers with the direction has that sign used in place of the start’s, and the fall is found; one that answers None owes the condition the others do not: a step it is searched over does not start at exactly zero and turn around within that step. Crossing::Either is the other side of the same trade, reporting the departure itself as a root.