a, The PFNd/PFNv circuit converts the fly’s egocentric traveling direction, as signaled in sensory inputs to the central complex, into an allocentric-traveling direction signal in h∆B cells (adapted from ref. 4). Two arrays of PFNd cells and two arrays of PFNv cells express sinusoidal activity patterns whose phase and amplitude represent four vectors with a specific angle and length (brown and orange vectors). To calculate the allocentric traveling direction, the four neurally represented vectors all initially signal the angle in which the fly is translating in relation to its body axis, with the amplitude of each activity pattern representing a projection of that egocentric traveling vector onto a different (basis) direction. All four vectors are then rotated together based on the fly’s heading relative to external cues, (e.g., the sun), which implements the egocentric-to-allocentric transformation. Finally, the circuit finds the max position of the summed, output vector, which represents the fly’s traveling angle in reference to external cues. When the fly is traveling forward, the two forward-facing PFNd vectors are long and the two backward-facing PFNv vectors are short, yielding an output traveling vector in h∆B cells (pink vector) that points in the direction of the fly’s heading, as encoded by the EPG bump (left schematic). When the fly is traveling backward, the two, forward-facing, PFNd vectors are short and the two, backward-facing, PFNv vectors are long, yielding an output traveling vector in h∆B cells that points in a direction 180° opposite of the fly’s heading, as encoded by the EPG bump (right schematic). b, Left: The PFL3 circuit that converts an allocentric goal angle into an egocentric steering signal can be considered, computationally, to be taking the difference between two dot products. The left and right PFL3 neurons form two non-orthogonal axes (blue and red dotted lines). Each axis represents the fly’s heading angle rotated either clockwise and counter-clockwise by the same angle. The fly’s allocentric goal angle, signaled by the position of the FC2 bump in the fan-shaped body, is represented by the purple vector. The projection of the goal vector onto the blue PFL3 axis (which can be considered as the output of a dot product between the goal vector and a unit vector pointing along the blue axis) reflects the sum of the left PFL3 activity in the LAL (and vice versa for the right PFL3 axis). When the fly is aligned with its goal, the difference between the red and blue dot products is zero. Right: When the fly changes its heading, the axes rotate and the difference between the two dot products now tells the fly to turn left. Neuronally, the left and right PFL3 axes represent vectors generated by projecting their heading inputs in the bridge onto the fan-shaped body. The amount by which the left and right PFL3 axes are offset from one another is determined by the anatomical shift in the PFL3 projection pattern from the bridge to the fan-shaped body.