Chapter 2: Direction & Distance Test — Interactive Study Guide
:root {
color-scheme: light;
/* Page and surfaces */
–background: #ffffff;
–surface-container-low: #f3f2f1;
–surface-container: #e8e7e5;
–surface-container-high: #dbdad9;
/* Ink */
–on-surface: #0b0c0c;
–on-surface-variant: #505a5f;
/* Rules */
–outline: #0b0c0c;
–outline-variant: #b1b4b6;
/* Accents */
–primary: #162e51;
–on-primary: #ffffff;
–primary-container: #d2e2f1;
–on-primary-container: #0c2d4a;
–secondary: #4c2c92;
–tertiary: #1a569e;
–error: #d4351c;
–on-error: #ffffff;
/* Data series */
–data-1: #1a569e;
–data-2: #c75a0a;
–data-3: #28a197;
–data-4: #4c2c92;
–data-context: #b1b4b6;
/* Semantic states */
–positive: #00703c;
–positive-container: #e4f2eb;
–warning: #8f4700;
–error-container: #fceae7;
–sun-gold: #c75a0a;
–shadow-ink: #343a3e;
/* Fonts */
–font-headline: ‘Public Sans’, sans-serif;
–font-body: ‘Public Sans’, sans-serif;
–font-label: ‘Public Sans’, sans-serif;
/* Shape */
–rounded: 0;
–rounded-lg: 0;
–rounded-full: 0;
/* Style effects */
–top-index-rule: 6px solid var(–primary);
–inset-rule: 5px solid var(–tertiary);
–inset-rule-accent: 5px solid var(–data-2);
–inset-rule-primary: 6px solid var(–primary);
–button-ground: 0 2px 0 #091526;
–button-ground-secondary: 0 2px 0 #858686;
–focus-yellow: #ffdd00;
–focus-ring: 3px solid var(–focus-yellow);
–focus-bar: inset 0 0 0 2px var(–on-surface);
–focus-underline: 0 -2px var(–focus-yellow), 0 4px var(–on-surface);
–focus: var(–focus-yellow);
/* Type scale (Narrative) */
–display-size: clamp(2.25rem, 1.4rem + 3.4vw, 3.75rem);
–headline-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem);
–subhead-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem);
–body-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
–label-size: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
/* Spacing scale (4pt base) */
–space-xs: 0.25rem;
–space-sm: 0.5rem;
–space-md: 1rem;
–space-lg: 1.5rem;
–space-xl: 2.5rem;
–space-2xl: 4rem;
–space-3xl: 6rem;
/* Motion */
–ease-out: cubic-bezier(0.16, 1, 0.3, 1);
–ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
–dur-micro: 120ms;
–dur-short: 220ms;
–dur-long: 420ms;
}
/* Base reset */
*, *::before, *::after { box-sizing: border-box; }
html, body {
overflow-x: clip;
margin: 0;
padding: 0;
background: var(–background);
color: var(–on-surface);
font-family: var(–font-body);
font-size: var(–body-size);
line-height: 1.55;
-webkit-font-smoothing: antialiased;
}
header { position: static !important; }
.page-grid {
display: grid;
gap: var(–space-xl);
padding: var(–space-lg);
max-width: 1120px;
margin: 0 auto;
overflow: hidden;
}
.page-grid * { min-width: 0; }
/* Focus rings */
a {
color: var(–tertiary);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 3px; }
a:visited { color: var(–secondary); }
a:focus-visible {
outline: none;
background: var(–focus-yellow);
color: var(–on-surface);
text-decoration: none;
box-shadow: var(–focus-underline);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
outline: var(–focus-ring);
outline-offset: 0;
box-shadow: var(–focus-bar);
}
/* Typography */
h1, h2, h3, h4 {
font-family: var(–font-headline);
color: var(–on-surface);
margin: 0;
letter-spacing: -0.015em;
}
h1 {
font-size: var(–display-size);
font-weight: 800;
line-height: 1.08;
margin-bottom: var(–space-md);
}
h2 {
font-size: var(–headline-size);
font-weight: 800;
line-height: 1.12;
}
h3 {
font-size: var(–subhead-size);
font-weight: 700;
line-height: 1.2;
}
p {
margin: 0 0 var(–space-md) 0;
max-width: 68ch;
}
p:last-child { margin-bottom: 0; }
.lead {
font-size: clamp(1.1875rem, 1.08rem + 0.4vw, 1.375rem);
line-height: 1.5;
color: var(–on-surface);
max-width: 62ch;
}
.caption {
font-size: 0.9375rem;
color: var(–on-surface-variant);
line-height: 1.45;
}
.tabular {
font-variant-numeric: tabular-nums;
}
/* Top index header */
.index-header {
border-top: var(–top-index-rule);
border-bottom: 1px solid var(–on-surface);
padding: var(–space-sm) 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
gap: var(–space-sm);
font-family: var(–font-label);
font-weight: 700;
font-size: var(–label-size);
text-transform: uppercase;
letter-spacing: 0.06em;
margin-bottom: var(–space-lg);
}
.status-tag {
display: inline-block;
background: var(–primary-container);
color: var(–on-primary-container);
font-family: var(–font-label);
font-weight: 700;
font-size: var(–label-size);
text-transform: uppercase;
letter-spacing: 0.04em;
padding: var(–space-xs) var(–space-sm);
}
.status-tag–orange {
background: var(–data-2);
color: var(–on-primary);
}
.status-tag–green {
background: var(–positive-container);
color: var(–positive);
}
/* Step badges & section headers */
.section-block {
border-top: 1px solid var(–outline-variant);
padding-top: var(–space-xl);
display: grid;
gap: var(–space-lg);
}
.section-head {
display: flex;
align-items: flex-start;
gap: var(–space-md);
}
.step-badge {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 34px;
height: 34px;
background: var(–primary);
color: var(–on-primary);
font-weight: 800;
font-size: 0.9375rem;
font-variant-numeric: tabular-nums;
margin-top: 0.15rem;
}
.step-badge–sm {
width: 26px;
height: 26px;
font-size: 0.8125rem;
margin-top: 0;
}
/* Chapter Contents Index */
.toc-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
gap: var(–space-sm) var(–space-lg);
border-top: 1px solid var(–on-surface);
border-bottom: 1px solid var(–on-surface);
padding: var(–space-md) 0;
margin-top: var(–space-lg);
}
.toc-item {
display: flex;
align-items: center;
gap: var(–space-sm);
padding: var(–space-xs) 0;
}
.toc-item a {
font-weight: 700;
font-size: 0.95rem;
}
/* Inset callouts */
.inset {
border-left: var(–inset-rule);
background: var(–surface-container-low);
padding: var(–space-md) var(–space-lg);
}
.inset–accent {
border-left: var(–inset-rule-accent);
}
.inset–white {
background: var(–background);
}
.inset-title {
font-weight: 800;
font-size: 1rem;
margin-bottom: var(–space-xs);
display: block;
color: var(–on-surface);
}
/* Highlighted NESW Special Section */
.nesw-spotlight {
border-top: var(–top-index-rule);
border-bottom: var(–top-index-rule);
border-left: var(–inset-rule-primary);
border-right: 1px solid var(–outline-variant);
background: var(–background);
padding: var(–space-xl) var(–space-lg);
display: grid;
gap: var(–space-lg);
}
.nesw-banner {
background: var(–primary-container);
color: var(–on-primary-container);
padding: var(–space-md) var(–space-lg);
border-left: var(–inset-rule);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
gap: var(–space-md);
}
.nesw-cycle-strip {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
border: 2px solid var(–on-surface);
background: var(–background);
}
.nesw-cell {
padding: var(–space-md);
border-right: 1px solid var(–outline-variant);
display: grid;
gap: var(–space-xs);
}
.nesw-cell:last-child { border-right: none; }
.nesw-cell–active {
background: var(–primary-container);
}
.nesw-letter {
font-size: 2rem;
font-weight: 800;
line-height: 1;
color: var(–primary);
}
.nesw-sum {
font-size: 1.5rem;
font-weight: 800;
font-variant-numeric: tabular-nums;
color: var(–on-surface);
}
/* Asymmetric split layout for text + interactive lab */
.lab-split {
display: grid;
grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
gap: var(–space-xl);
align-items: start;
}
.lab-panel {
container-type: inline-size;
background: var(–surface-container-low);
border-top: 3px solid var(–primary);
padding: var(–space-lg);
display: grid;
gap: var(–space-md);
}
.lab-panel–white {
background: var(–background);
border: 1px solid var(–outline-variant);
border-top: 3px solid var(–primary);
}
/* Key figure readouts */
.figure-strip {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
gap: var(–space-md);
}
.key-figure {
border-left: var(–inset-rule);
background: var(–background);
padding: var(–space-sm) var(–space-md);
}
.key-figure__label {
font-size: 0.8125rem;
color: var(–on-surface-variant);
font-weight: 700;
display: block;
}
.key-figure__value {
font-size: 1.5rem;
font-weight: 800;
line-height: 1.15;
color: var(–on-surface);
font-variant-numeric: tabular-nums;
margin: var(–space-xs) 0;
}
.key-figure__sub {
font-size: 0.875rem;
color: var(–on-surface);
}
/* Buttons (Grounded action buttons per Handbook) */
.button-row {
display: flex;
flex-wrap: wrap;
gap: var(–space-sm);
align-items: center;
}
.button {
font-family: var(–font-label);
font-weight: 600;
font-size: 0.9375rem;
line-height: 1.2;
background: var(–primary);
color: var(–on-primary);
border: 0;
border-radius: var(–rounded);
padding: 0.625rem var(–space-md);
min-height: 44px;
cursor: pointer;
box-shadow: var(–button-ground);
transition: background-color var(–dur-micro) var(–ease-out), transform var(–dur-micro) var(–ease-out);
text-align: left;
}
.button:hover:not(:disabled) {
background: var(–tertiary);
}
.button:active:not(:disabled) {
transform: translateY(2px);
box-shadow: none;
}
.button:disabled {
opacity: 0.48;
cursor: not-allowed;
}
.button–secondary {
background: var(–background);
color: var(–on-surface);
border: 1px solid var(–outline);
box-shadow: var(–button-ground-secondary);
}
.button–secondary:hover:not(:disabled) {
background: var(–surface-container-low);
}
.button–secondary[aria-pressed=”true”] {
background: var(–primary-container);
color: var(–on-primary-container);
border-color: var(–primary);
font-weight: 700;
}
/* Form controls: always-visible labels above inputs */
.controls-row {
display: flex;
flex-wrap: wrap;
gap: var(–space-md);
align-items: end;
}
.field {
display: grid;
gap: var(–space-xs);
flex: 1 1 150px;
}
.field label {
font-weight: 700;
font-size: 0.9375rem;
color: var(–on-surface);
}
.field .hint {
font-size: 0.8125rem;
color: var(–on-surface-variant);
}
input[type=”number”],
input[type=”text”],
select {
font-family: var(–font-body);
font-size: 1rem;
color: var(–on-surface);
background: var(–background);
border: 2px solid var(–outline);
border-radius: var(–rounded);
padding: 0.5rem 0.75rem;
min-height: 44px;
width: 100%;
}
select {
padding-right: 2rem;
}
input[type=”range”] {
width: 100%;
min-height: 44px;
accent-color: var(–primary);
cursor: pointer;
}
/* Tables */
.table-wrap {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
text-align: left;
font-size: 0.95rem;
}
thead th {
border-bottom: 2px solid var(–on-surface);
padding: var(–space-sm) var(–space-sm);
font-weight: 800;
color: var(–on-surface);
vertical-align: bottom;
}
tbody td {
border-bottom: 1px solid var(–outline-variant);
padding: var(–space-sm) var(–space-sm);
vertical-align: top;
}
.num {
text-align: right;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
/* Formula display */
.formula-box {
background: var(–background);
border: 2px solid var(–on-surface);
padding: var(–space-md) var(–space-lg);
font-weight: 800;
font-size: 1.15rem;
font-variant-numeric: tabular-nums;
display: grid;
gap: var(–space-xs);
}
.formula-sub {
font-weight: 400;
font-size: 0.9375rem;
color: var(–on-surface-variant);
}
/* SVG Diagram Styling */
.diagram-frame {
background: var(–background);
border: 1px solid var(–outline-variant);
padding: var(–space-md);
display: grid;
gap: var(–space-sm);
}
.diagram-svg {
width: 100%;
max-width: 340px;
height: auto;
display: block;
}
.svg-axis { stroke: var(–outline-variant); stroke-width: 1.5; }
.svg-axis-dashed { stroke: var(–outline-variant); stroke-width: 1.5; stroke-dasharray: 4 4; }
.svg-ring { fill: none; stroke: var(–outline-variant); stroke-width: 1.5; }
.svg-ink { stroke: var(–on-surface); fill: none; }
.svg-ink-fill { fill: var(–on-surface); }
.svg-primary-stroke { stroke: var(–primary); fill: none; }
.svg-primary-fill { fill: var(–primary); }
.svg-data1-stroke { stroke: var(–data-1); fill: none; }
.svg-data1-fill { fill: var(–data-1); }
.svg-data2-stroke { stroke: var(–data-2); fill: none; }
.svg-data2-fill { fill: var(–data-2); }
.svg-data3-stroke { stroke: var(–data-3); fill: none; }
.svg-data3-fill { fill: var(–data-3); }
.svg-data4-stroke { stroke: var(–data-4); fill: none; }
.svg-sun-fill { fill: var(–sun-gold); }
.svg-shadow-fill { fill: var(–shadow-ink); }
.svg-label {
font-family: var(–font-label);
font-size: 13px;
font-weight: 700;
fill: var(–on-surface);
}
.svg-label-muted {
font-family: var(–font-label);
font-size: 11px;
font-weight: 600;
fill: var(–on-surface-variant);
}
.svg-label-data1 {
font-family: var(–font-label);
font-size: 13px;
font-weight: 800;
fill: var(–data-1);
}
.svg-label-data2 {
font-family: var(–font-label);
font-size: 13px;
font-weight: 800;
fill: var(–data-2);
}
/* NESW step log */
.step-list {
list-style: none;
margin: 0;
padding: 0;
border-top: 1px solid var(–outline-variant);
}
.step-list li {
display: flex;
justify-content: space-between;
align-items: center;
gap: var(–space-sm);
padding: var(–space-sm) 0;
border-bottom: 1px solid var(–outline-variant);
font-size: 0.9375rem;
}
/* Practice Question Bank */
.practice-toolbar {
background: var(–surface-container-low);
border-left: var(–inset-rule);
padding: var(–space-md) var(–space-lg);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
gap: var(–space-md);
}
.question-list {
display: grid;
gap: var(–space-lg);
}
.question-card {
border-top: 2px solid var(–on-surface);
border-bottom: 1px solid var(–outline-variant);
padding: var(–space-lg) 0;
display: grid;
gap: var(–space-md);
}
.question-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(–space-sm);
}
.options-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
gap: var(–space-sm);
}
.option-btn {
font-family: var(–font-body);
font-size: 0.96875rem;
font-weight: 600;
text-align: left;
background: var(–background);
color: var(–on-surface);
border: 2px solid var(–outline-variant);
padding: 0.65rem var(–space-md);
min-height: 44px;
cursor: pointer;
display: flex;
align-items: center;
gap: var(–space-sm);
transition: background-color var(–dur-micro) var(–ease-out), border-color var(–dur-micro) var(–ease-out);
}
.option-btn:hover {
background: var(–surface-container-low);
border-color: var(–on-surface);
}
.option-btn–correct {
background: var(–positive-container);
border-color: var(–positive);
color: var(–on-surface);
}
.option-btn–wrong {
background: var(–error-container);
border-color: var(–error);
color: var(–on-surface);
}
.option-key {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: var(–surface-container-low);
border: 1px solid var(–outline);
font-weight: 800;
font-size: 0.8125rem;
flex-shrink: 0;
}
.feedback-banner {
padding: var(–space-sm) var(–space-md);
font-weight: 700;
font-size: 0.9375rem;
border-left: 5px solid var(–outline);
background: var(–surface-container-low);
}
.feedback-banner–correct {
border-left-color: var(–positive);
background: var(–positive-container);
color: var(–positive);
}
.feedback-banner–wrong {
border-left-color: var(–error);
background: var(–error-container);
color: var(–error);
}
.solution-drawer {
border-left: var(–inset-rule);
background: var(–surface-container-low);
padding: var(–space-md) var(–space-lg);
display: grid;
gap: var(–space-sm);
}
.solution-drawer[hidden] {
display: none;
}
.hidden-card {
display: none;
}
@container (max-width: 440px) {
.nesw-cycle-strip {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nesw-cell {
border-bottom: 1px solid var(–outline-variant);
}
}
@media (max-width: 820px) {
.lab-split {
grid-template-columns: 1fr;
}
}
@media (max-width: 640px) {
.page-grid {
padding: var(–space-md);
gap: var(–space-lg);
}
.nesw-spotlight {
padding: var(–space-md);
}
.nesw-cycle-strip {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nesw-cell {
border-bottom: 1px solid var(–outline-variant);
}
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
Chapter 2: Direction & Distance Test
A complete reference and interactive problem-solving handbook covering all eight compass directions, angular rotation rules, the mental NESW directional cycle trick, Pythagoras displacement geometry, sun-shadow deduction, and train-smoke vector problems.
01
Cardinal & Sub-Cardinal Directions
The eight-point compass grid, 90° and 45° angular spacing, and fundamental Left/Right turn mechanics.
Every direction problem begins from a fixed eight-point reference frame. On a standard sheet of paper, North (N) points toward the top edge, South (S) points toward the bottom, East (E) points to your right, and West (W) points to your left.
Between these four Cardinal (Main) Directions lie four Sub-Cardinal (Ordinal) Directions : North-East (NE) , South-East (SE) , South-West (SW) , and North-West (NW) . Each adjacent cardinal axis is separated by 90° , while every sub-cardinal direction bisects its quadrant at 45° .
Core Turning Rules (90° Standard Turns)
Unless an explicit angle is stated, every Right Turn rotates 90° Clockwise (CW) and every Left Turn rotates 90° Anti-Clockwise (ACW) .
Turn Sequence
Net Angle
Resulting Direction
1 Right Turn or 1 Left Turn
90° CW / 90° ACW
Perpendicular direction
2 Right Turns or 2 Left Turns
180°
Exact opposite direction (e.g., N ↔ S)
3 Right Turns
270° CW
Equivalent to 1 Left Turn (90° ACW)
3 Left Turns
270° ACW
Equivalent to 1 Right Turn (90° CW)
4 Right or 4 Left Turns
360°
Same original direction (no net change)
1 Right + 1 Left Turn
0°
Cancel each other out completely
Interactive Compass & Turn Explorer
Select a starting direction or click turn buttons to watch your heading update around the 8-point compass.
N (0°)
NE (45°)
E (90°)
SE (135°)
S (180°)
SW (225°)
W (270°)
NW (315°)
Set Direction
North (0°)
North-East (45°)
East (90°)
South-East (135°)
South (180°)
South-West (225°)
West (270°)
North-West (315°)
Left 90° (ACW)
Right 90° (CW)
Left 45°
Right 45°
180°
Reset
Turn log: Started at North (0°).
02
Angular Rotation Rules
Solving multi-step clockwise and anti-clockwise degree turns with one single net subtraction.
Angular rotation problems give an initial facing direction followed by several turns in degrees (such as 45°, 90°, 135°, 180°, or 270°), alternating between Clockwise (CW) and Anti-Clockwise (ACW) .
Rotating step-by-step after each sentence wastes time and invites arithmetic errors. Instead, apply the Net Angular Cancellation Rule : sum all clockwise angles, sum all anti-clockwise angles, and subtract the smaller total from the larger total.
Net Rotation = |Σ Clockwise − Σ Anti-Clockwise|
Rotate only once from the initial direction toward whichever side has the larger sum.
Angle
Step Shift (8-Point Compass)
Example from North
45°
1 sub-sector (Cardinal ↔ Sub-cardinal)
45° CW → North-East
90°
2 sub-sectors (Adjacent Cardinal)
90° CW → East
135°
3 sub-sectors (Opposite Sub-cardinal)
135° CW → South-East
180°
4 sub-sectors (Exact Opposite)
180° CW/ACW → South
270°
6 sub-sectors (= 90° opposite sense)
270° CW → West (= 90° ACW)
Angular Net-Rotation Calculator
Queue clockwise and anti-clockwise turns to compute the net cancellation angle immediately.
N
E
S
W
Dashed gray: Start ray · Solid blue: Final heading · Orange arc: Net rotation.
Initial Facing
North (0°)
North-East (45°)
East (90°)
South-East (135°)
South (180°)
South-West (225°)
West (270°)
North-West (315°)
+45° CW
+90° CW
+135° CW
+45° ACW
+90° ACW
+135° ACW
Clear Turns
High-Speed Mental Shortcut
The NESW Directional Cycle Trick
Solve movement & displacement mentally without drawing diagrams
Drawing arrows on rough paper wastes precious seconds—and makes diagonal or multi-turn paths prone to crooked sketches. The N – E – S – W Directional Cycle replaces every drawing with four mental columns and simple subtraction.
How the 4-Step NESW Method Works
Step 1: Write or Visualize the Cycle — N · E · S · W
Always keep the letters in exact clockwise order: N — E — S — W (it loops seamlessly: moving right from W wraps back to N ; moving left from N wraps back to W ).
Turn Rule: Every Right Turn (R) shifts 1 column to the Right . Every Left Turn (L) shifts 1 column to the Left .
Step 2: Log Distances Under the Active Letter
Start under your initial direction and record the first distance walked. Each time the problem states a Right or Left turn, step one letter right or left and add the new distance to that column.
Step 3: Cancel Opposite Pairs (N ↔ S and E ↔ W)
North and South are direct opposites, and East and West are direct opposites. Subtract the smaller value from the larger value in each pair, keeping the winning direction:
Net Vertical = |N − S| | Net Horizontal = |E − W|
Step 4: Read Displacement & Final Facing Instantly
• If one axis cancels to 0 , the remaining column gives your exact straight-line distance and direction (e.g., E = 13, N/S = 0 → 13 m East ).
• If both axes have leftovers (e.g., N = 3 and E = 4), combine their names for the direction (North-East ) and apply Pythagoras: √(3² + 4²) = 5 m .
• Facing-Only Bonus: If a question asks only for the final facing direction, ignore all distances! Cancel each L + R pair (1L + 1R = 0), take the remainder mod 4, and step along N-E-S-W.
Worked Mental Example (Zero Sketching)
“A hiker walks 10 km North, turns Right and walks 4 km, turns Right and walks 7 km.”
Columns: N = 10 → (Right → E) E = 4 → (Right → S) S = 7 .
Cancel N & S: 10 N − 7 S = 3 km North. Leftover East: 4 km East.
Result: North-East , distance = √(3² + 4²) = 5 km .
Live NESW Cycle Ledger
Mental Tracker
Build a route or load a preset to watch distances sort into N, E, S, W columns and cancel opposites automatically.
N
North
10
E
East
4
S
South
7
W
West
0
Preset: 3-4-5 Example
Preset: 5-12-13 Loop
Preset: Full Cancel
Next Action
Turn Right (+1 step →)
Turn Left (−1 step ←)
Continue Straight
Distance (units)
Add Leg
Change Initial Facing
North (N)
East (E)
South (S)
West (W)
Undo Last
Clear
Verify with Coordinate Diagram
04
Pythagoras Distance Formulas
Distinguishing total path distance from shortest straight-line displacement using right triangles and standard triplets.
When a path ends with both a net North/South offset (Δy ) and a net East/West offset (Δx ), the route forms the two perpendicular legs of a right-angled triangle. Always verify whether a question asks for Total Distance Covered (add every leg) or Shortest / Minimum Distance (compute the hypotenuse).
Shortest Distance (H) = √(Δx² + Δy²)
Where Δx = |East − West| (Base) and Δy = |North − South| (Perpendicular)
Essential Pythagorean Triplets to Memorize
Recognizing these integer ratios lets you state the hypotenuse instantaneously without computing square roots:
Base (Δx)
Perpendicular (Δy)
Hypotenuse (H)
Common Scaled Multiples
3
4
5
(6, 8, 10) · (9, 12, 15) · (12, 16, 20) · (15, 20, 25)
5
12
13
(10, 24, 26) · (15, 36, 39)
8
15
17
(16, 30, 34)
7
24
25
(14, 48, 50)
9
40
41
(18, 80, 82)
1
1
√2 ≈ 1.414
Equal legs (a, a, a√2) — 45° diagonal
Right-Triangle Displacement Solver
Adjust Base (Δx) and Perpendicular (Δy) or click a standard triplet to visualize the shortest distance.
3-4-5
5-12-13
8-15-17
7-24-25
10-10 (a√2)
Horizontal Offset (Δx)
Vertical Offset (Δy)
05
Shadow Geometry Rules
Deducing facing directions at sunrise, noon, and sunset from Left/Right shadow placement.
Shadow questions test whether you can translate the sun’s east–west position into a person’s left or right hand. Only two physical facts govern every problem:
Three Absolute Sun-Shadow Rules
1. Morning (Sunrise / Before 12:00 PM): The sun is in the East , so every shadow falls toward the West .
2. Evening (Sunset / After 12:00 PM): The sun is in the West , so every shadow falls toward the East .
3. 12:00 Noon: The sun is directly overhead, so no shadow is cast in any direction.
Person Facing
Morning Shadow (Falls West)
Evening Shadow (Falls East)
North
To their Left
To their Right
South
To their Right
To their Left
East
Behind them (Back)
In front of them
West
In front of them
Behind them (Back)
Exam Trap in Two-Person Shadow Questions
When a question says “Amit’s shadow fell to Sumit’s right,” the clue identifies Sumit’s facing direction first (whose Left/Right is named), not Amit’s! If they face each other, Amit faces the exact opposite of Sumit.
Sun & Shadow Geometry Simulator
Choose the time of day and facing direction to see which side of the observer the shadow falls on.
Time of Day
Morning / Sunrise (Sun East)
12:00 Noon (Sun Overhead)
Evening / Sunset (Sun West)
Person Facing
North
South
East
West
06
Train & Smoke Rules
Combining opposite motion drag and wind direction to determine smoke trails—plus the electric-train trap.
Train smoke direction depends on two independent forces: the apparent backward drag created by the train’s forward motion, and the wind vector pushing the smoke once it leaves the chimney.
Smoke Direction = (Opposite of Train’s Motion) + (Wind Direction)
First flip the train’s travel direction 180°, then combine it with the wind’s direction.
Train Condition
Wind Condition
Smoke Direction
Stationary
Calm (No Wind)
Straight Up (Vertical)
Stationary
Blowing toward East
East (Wind direction)
Moving North
Calm (No Wind)
South (Opposite to train)
Moving North
Blowing toward East
South-East (South + East)
Moving North
Blowing toward South
South (Both push South)
Electric Train (Any)
Any Wind
No Smoke (Zero emission)
Watch Out for the Electric Train Concept Check
If a problem specifies an electric train (or electric locomotive), it emits no smoke at all , regardless of speed or wind direction. Always read the locomotive type carefully before applying vector addition.
Train, Wind & Smoke Vector Simulator
Combine train travel and wind direction to see the resulting smoke plume vector.
Train State & Heading
Steam/Diesel Moving North
Steam/Diesel Moving East
Steam/Diesel Moving South
Steam/Diesel Moving West
Steam/Diesel Stationary
Electric Train (Any Direction)
Wind Blowing Towards
Calm (No Wind)
Towards North
Towards East
Towards South
Towards West
07
Practice Questions & Interactive Solutions
Test every rule from this chapter with instant answer checking and collapsible step-by-step explanations.
Chapter 2 Study Reference: Direction & Distance Test — Grounded in standard competitive reasoning principles for cardinal orientation, angular net rotation, NESW mental cancellation, Pythagorean triples, solar shadow casting, and relative vector motion.
/* =========================================================
SECTION 01: 8-POINT COMPASS EXPLORER
========================================================= */
const COMPASS_POINTS = [
{ deg: 0, code: `N`, name: `North`, opp: `South (S)`, left: `W`, right: `E` },
{ deg: 45, code: `NE`, name: `North-East`, opp: `South-West (SW)`, left: `NW`, right: `SE` },
{ deg: 90, code: `E`, name: `East`, opp: `West (W)`, left: `N`, right: `S` },
{ deg: 135, code: `SE`, name: `South-East`, opp: `North-West (NW)`, left: `NE`, right: `SW` },
{ deg: 180, code: `S`, name: `South`, opp: `North (N)`, left: `E`, right: `W` },
{ deg: 225, code: `SW`, name: `South-West`, opp: `North-East (NE)`, left: `SE`, right: `NW` },
{ deg: 270, code: `W`, name: `West`, opp: `East (E)`, left: `S`, right: `N` },
{ deg: 315, code: `NW`, name: `North-West`, opp: `South-East (SE)`, left: `SW`, right: `NE` }
];
let compassDeg = 0;
let compassMoves = [];
function normalizeDeg(d) {
return ((d % 360) + 360) % 360;
}
function getCompassInfo(deg) {
const norm = normalizeDeg(deg);
const found = COMPASS_POINTS.find(function (p) { return p.deg === norm; });
return found || COMPASS_POINTS[0];
}
function renderCompass() {
const info = getCompassInfo(compassDeg);
const pointer = document.getElementById(‘compass-pointer’);
if (pointer) {
pointer.setAttribute(‘transform’, `rotate(${info.deg} 150 150)`);
}
const facingOut = document.getElementById(‘compass-facing-out’);
const bearingOut = document.getElementById(‘compass-bearing-out’);
const oppOut = document.getElementById(‘compass-opp-out’);
const lrOut = document.getElementById(‘compass-lr-out’);
const selectEl = document.getElementById(‘compass-start-select’);
const histEl = document.getElementById(‘compass-history’);
if (facingOut) facingOut.textContent = `${info.name} (${info.code})`;
if (bearingOut) bearingOut.textContent = `Bearing: ${info.deg}°`;
if (oppOut) oppOut.textContent = info.opp;
if (lrOut) lrOut.textContent = `90° Left: ${info.left} · 90° Right: ${info.right}`;
if (selectEl) selectEl.value = String(info.deg);
if (histEl) {
if (compassMoves.length === 0) {
histEl.textContent = `Turn log: Facing ${info.name} (${info.deg}°).`;
} else {
histEl.textContent = `Turn log: ${compassMoves.join(‘ → ‘)} → ${info.name} (${info.deg}°)`;
}
}
}
function setCompassDirection(val) {
compassDeg = normalizeDeg(Number(val) || 0);
const info = getCompassInfo(compassDeg);
compassMoves = [`Set ${info.code}`];
renderCompass();
}
function turnCompass(delta, label) {
compassDeg = normalizeDeg(compassDeg + delta);
compassMoves.push(label);
if (compassMoves.length > 6) {
compassMoves = compassMoves.slice(compassMoves.length – 6);
}
renderCompass();
}
function resetCompass() {
compassDeg = 0;
compassMoves = [];
renderCompass();
}
/* =========================================================
SECTION 02: ANGULAR NET-ROTATION CALCULATOR
========================================================= */
let rotationSteps = [
{ deg: 90, sense: `CW` },
{ deg: 135, sense: `ACW` },
{ deg: 90, sense: `CW` }
];
function polarToXY(cx, cy, r, degFromNorth) {
const rad = (degFromNorth – 90) * (Math.PI / 180);
return {
x: cx + r * Math.cos(rad),
y: cy + r * Math.sin(rad)
};
}
function describeSweepArc(cx, cy, r, startDeg, signedDelta) {
if (signedDelta === 0) return “;
const clamped = Math.abs(signedDelta) >= 360 ? (signedDelta > 0 ? 359.9 : -359.9) : signedDelta;
const endDeg = startDeg + clamped;
const p1 = polarToXY(cx, cy, r, startDeg);
const p2 = polarToXY(cx, cy, r, endDeg);
const largeArc = Math.abs(clamped) > 180 ? 1 : 0;
const sweep = clamped >= 0 ? 1 : 0;
return `M ${p1.x.toFixed(1)} ${p1.y.toFixed(1)} A ${r} ${r} 0 ${largeArc} ${sweep} ${p2.x.toFixed(1)} ${p2.y.toFixed(1)}`;
}
function updateRotationCalc() {
const startSel = document.getElementById(‘rot-start-dir’);
const startDeg = startSel ? Number(startSel.value) : 315;
let cwSum = 0;
let acwSum = 0;
rotationSteps.forEach(function (st) {
if (st.sense === `CW`) cwSum += st.deg;
else acwSum += st.deg;
});
const signedNet = cwSum – acwSum;
const netAbs = Math.abs(signedNet) % 360;
const netSense = signedNet > 0 ? `CW` : (signedNet < 0 ? `ACW` : `None`);
const finalDeg = normalizeDeg(startDeg + signedNet);
const finalInfo = getCompassInfo(finalDeg);
const sumsOut = document.getElementById('rot-sums-out');
const netOut = document.getElementById('rot-net-out');
const finalOut = document.getElementById('rot-final-out');
const queueOut = document.getElementById('rot-queue-out');
if (sumsOut) sumsOut.textContent = `${cwSum}° vs ${acwSum}°`;
if (netOut) {
netOut.textContent = netAbs === 0 ? `Net: 0° (No shift)` : `Net: ${netAbs}° ${netSense}`;
}
if (finalOut) finalOut.textContent = `${finalInfo.name} (${finalInfo.code})`;
if (queueOut) {
if (rotationSteps.length === 0) {
queueOut.textContent = `Turns: None queued`;
} else {
queueOut.textContent = `Turns: ${rotationSteps.map(function (s) { return `${s.deg}° ${s.sense}`; }).join(', ')}`;
}
}
const startPt = polarToXY(150, 145, 90, startDeg);
const endPt = polarToXY(150, 145, 90, finalDeg);
const startRay = document.getElementById('rot-start-ray');
const endRay = document.getElementById('rot-end-ray');
const endDot = document.getElementById('rot-end-dot');
const arcPath = document.getElementById('rot-arc-path');
if (startRay) {
startRay.setAttribute('x2', startPt.x.toFixed(1));
startRay.setAttribute('y2', startPt.y.toFixed(1));
}
if (endRay) {
endRay.setAttribute('x2', endPt.x.toFixed(1));
endRay.setAttribute('y2', endPt.y.toFixed(1));
}
if (endDot) {
endDot.setAttribute('cx', endPt.x.toFixed(1));
endDot.setAttribute('cy', endPt.y.toFixed(1));
}
if (arcPath) {
const modDelta = signedNet % 360;
arcPath.setAttribute('d', describeSweepArc(150, 145, 58, startDeg, modDelta));
}
}
function addRotationStep(deg, sense) {
rotationSteps.push({ deg: deg, sense: sense });
updateRotationCalc();
}
function resetRotationSteps() {
rotationSteps = [];
updateRotationCalc();
}
/* =========================================================
SECTION 03: NESW DIRECTIONAL CYCLE CALCULATOR
========================================================= */
const NESW_ORDER = [`N`, `E`, `S`, `W`];
const DIR_FULL = { N: `North`, E: `East`, S: `South`, W: `West` };
let neswInitDir = `N`;
let neswLegs = [
{ turn: `S`, dist: 10 },
{ turn: `R`, dist: 4 },
{ turn: `R`, dist: 7 }
];
function stepNeswDir(currentDir, turn) {
const idx = NESW_ORDER.indexOf(currentDir);
if (turn === `R`) return NESW_ORDER[(idx + 1) % 4];
if (turn === `L`) return NESW_ORDER[(idx + 3) % 4];
return currentDir;
}
function renderNeswLedger() {
const sums = { N: 0, E: 0, S: 0, W: 0 };
let activeDir = neswInitDir;
const computedLegs = [];
const points = [{ x: 0, y: 0 }];
let curX = 0;
let curY = 0;
neswLegs.forEach(function (leg, index) {
if (index === 0 && leg.turn === `S`) {
activeDir = neswInitDir;
} else {
activeDir = stepNeswDir(activeDir, leg.turn);
}
sums[activeDir] += leg.dist;
if (activeDir === `N`) curY += leg.dist;
else if (activeDir === `S`) curY -= leg.dist;
else if (activeDir === `E`) curX += leg.dist;
else if (activeDir === `W`) curX -= leg.dist;
points.push({ x: curX, y: curY });
const turnLabel = leg.turn === `R` ? `Right →` : (leg.turn === `L` ? `← Left` : `Start / Straight`);
computedLegs.push({
stepNum: index + 1,
turnLabel: turnLabel,
dir: activeDir,
dist: leg.dist
});
});
NESW_ORDER.forEach(function (d) {
const sumEl = document.getElementById(`nesw-sum-${d}`);
if (sumEl) sumEl.textContent = String(sums[d]);
});
const strip = document.getElementById('nesw-strip');
if (strip) {
const cells = strip.querySelectorAll('.nesw-cell');
cells.forEach(function (cell) {
if (cell.getAttribute('data-dir') === activeDir) {
cell.classList.add('nesw-cell–active');
} else {
cell.classList.remove('nesw-cell–active');
}
});
}
const listEl = document.getElementById('nesw-leg-list');
if (listEl) {
if (computedLegs.length === 0) {
listEl.innerHTML = `
No legs added yet. Enter a distance and click Add Leg. — `;
} else {
listEl.innerHTML = computedLegs.map(function (c) {
return `
Leg ${c.stepNum}: ${c.turnLabel} facing ${DIR_FULL[c.dir]} (${c.dir}) +${c.dist} under ${c.dir}`;
}).join(”);
}
}
const netNS = sums.N – sums.S;
const netEW = sums.E – sums.W;
const nsAbs = Math.abs(netNS);
const ewAbs = Math.abs(netEW);
const nsLabel = netNS > 0 ? `${nsAbs} N` : (netNS 0 ? `${ewAbs} E` : (netEW 0) cancelParts.push(nsLabel);
if (ewAbs > 0) cancelParts.push(ewLabel);
const cancelStr = cancelParts.length > 0 ? cancelParts.join(‘, ‘) : `0 (Returned to Start)`;
const disp = Math.sqrt(nsAbs * nsAbs + ewAbs * ewAbs);
const dispStr = Number.isInteger(disp) ? `${disp} units` : `${disp.toFixed(2)} units (√${nsAbs * nsAbs + ewAbs * ewAbs})`;
let dirFromStart = `At Starting Point`;
const vWord = netNS > 0 ? `North` : (netNS 0 ? `East` : (netEW < 0 ? `West` : “);
if (vWord && hWord) dirFromStart = `${vWord}-${hWord} of Start`;
else if (vWord) dirFromStart = `${vWord} of Start`;
else if (hWord) dirFromStart = `${hWord} of Start`;
const cancelOut = document.getElementById('nesw-cancel-out');
const facingOut = document.getElementById('nesw-facing-out');
const dispOut = document.getElementById('nesw-disp-out');
const dirOut = document.getElementById('nesw-dir-out');
if (cancelOut) cancelOut.textContent = cancelStr;
if (facingOut) facingOut.textContent = `Facing now: ${DIR_FULL[activeDir]}`;
if (dispOut) dispOut.textContent = dispStr;
if (dirOut) dirOut.textContent = dirFromStart;
renderNeswVerifyDiagram(points, curX, curY);
}
function renderNeswVerifyDiagram(points, endX, endY) {
const svg = document.getElementById('nesw-path-svg');
const cap = document.getElementById('nesw-path-caption');
if (!svg) return;
let minX = 0, maxX = 0, minY = 0, maxY = 0;
points.forEach(function (p) {
if (p.x maxX) maxX = p.x;
if (p.y maxY) maxY = p.y;
});
const spanX = Math.max(maxX – minX, 4);
const spanY = Math.max(maxY – minY, 4);
const pad = 34;
const w = 280 – pad * 2;
const h = 220 – pad * 2;
const scale = Math.min(w / spanX, h / spanY);
const midX = (minX + maxX) / 2;
const midY = (minY + maxY) / 2;
function mapPt(pt) {
return {
sx: 140 + (pt.x – midX) * scale,
sy: 110 – (pt.y – midY) * scale
};
}
const mapped = points.map(mapPt);
const pathD = mapped.map(function (m, i) {
return `${i === 0 ? ‘M’ : ‘L’} ${m.sx.toFixed(1)} ${m.sy.toFixed(1)}`;
}).join(‘ ‘);
const startM = mapped[0];
const endM = mapped[mapped.length – 1];
svg.innerHTML = `
Start
End
`;
if (cap) {
cap.textContent = `Blue solid line: walked path · Orange dashed line: shortest displacement (Δx = ${endX}, Δy = ${endY}).`;
}
}
function addNeswLeg() {
const turnSel = document.getElementById(‘nesw-turn-select’);
const distIn = document.getElementById(‘nesw-dist-input’);
const turn = turnSel ? turnSel.value : `R`;
const dist = distIn ? Math.max(1, Math.round(Number(distIn.value) || 0)) : 5;
neswLegs.push({ turn: turn, dist: dist });
renderNeswLedger();
}
function undoNeswLeg() {
if (neswLegs.length > 0) {
neswLegs.pop();
renderNeswLedger();
}
}
function clearNeswCustom() {
neswLegs = [];
renderNeswLedger();
}
function resetNeswWithInit(dir) {
neswInitDir = dir;
const sel = document.getElementById(‘nesw-init-select’);
if (sel) sel.value = dir;
renderNeswLedger();
}
function loadNeswPreset(id) {
if (id === 1) {
neswInitDir = `N`;
neswLegs = [{ turn: `S`, dist: 10 }, { turn: `R`, dist: 4 }, { turn: `R`, dist: 7 }];
} else if (id === 2) {
neswInitDir = `E`;
neswLegs = [{ turn: `S`, dist: 8 }, { turn: `L`, dist: 15 }, { turn: `L`, dist: 20 }, { turn: `L`, dist: 10 }];
} else if (id === 3) {
neswInitDir = `N`;
neswLegs = [{ turn: `S`, dist: 12 }, { turn: `R`, dist: 8 }, { turn: `R`, dist: 12 }, { turn: `R`, dist: 8 }];
}
const sel = document.getElementById(‘nesw-init-select’);
if (sel) sel.value = neswInitDir;
renderNeswLedger();
}
function toggleNeswDiagram(btn) {
const wrap = document.getElementById(‘nesw-diagram-wrap’);
if (!wrap || !btn) return;
const isHidden = wrap.hasAttribute(‘hidden’);
if (isHidden) {
wrap.removeAttribute(‘hidden’);
btn.setAttribute(‘aria-expanded’, ‘true’);
btn.textContent = `Hide Coordinate Diagram`;
} else {
wrap.setAttribute(‘hidden’, ”);
btn.setAttribute(‘aria-expanded’, ‘false’);
btn.textContent = `Verify with Coordinate Diagram`;
}
}
/* =========================================================
SECTION 04: PYTHAGORAS TRIANGLE SOLVER
========================================================= */
function updatePythagoras() {
const dxIn = document.getElementById(‘pyth-dx’);
const dyIn = document.getElementById(‘pyth-dy’);
const dx = dxIn ? Math.max(0, Number(dxIn.value) || 0) : 5;
const dy = dyIn ? Math.max(0, Number(dyIn.value) || 0) : 12;
const sqX = dx * dx;
const sqY = dy * dy;
const sumSq = sqX + sqY;
const hyp = Math.sqrt(sumSq);
const isInt = Math.abs(hyp – Math.round(hyp)) < 1e-9;
const sqOut = document.getElementById('pyth-sq-out');
const pathOut = document.getElementById('pyth-path-out');
const hOut = document.getElementById('pyth-h-out');
const radOut = document.getElementById('pyth-rad-out');
if (sqOut) sqOut.textContent = `${sqX} + ${sqY} = ${sumSq}`;
if (pathOut) pathOut.textContent = `Walked path: ${dx + dy} units`;
if (hOut) hOut.textContent = isInt ? `${Math.round(hyp)} units` : `${hyp.toFixed(2)} units`;
if (radOut) radOut.textContent = isInt ? `Exact: √${sumSq} = ${Math.round(hyp)}` : `Exact: √${sumSq}`;
const svg = document.getElementById('pyth-svg');
if (!svg) return;
const maxLeg = Math.max(dx, dy, 1);
const drawW = Math.max(24, (dx / maxLeg) * 185);
const drawH = Math.max(24, (dy / maxLeg) * 140);
const x0 = 52;
const y0 = 186;
const x1 = x0 + drawW;
const y1 = y0 – drawH;
svg.innerHTML = `
Δx = ${dx}
Δy = ${dy}
H = ${isInt ? Math.round(hyp) : hyp.toFixed(2)}
`;
}
function setTriplet(x, y) {
const dxIn = document.getElementById(‘pyth-dx’);
const dyIn = document.getElementById(‘pyth-dy’);
if (dxIn) dxIn.value = String(x);
if (dyIn) dyIn.value = String(y);
updatePythagoras();
}
/* =========================================================
SECTION 05: SHADOW GEOMETRY SIMULATOR
========================================================= */
function updateShadowSim() {
const timeSel = document.getElementById(‘shadow-time’);
const faceSel = document.getElementById(‘shadow-facing’);
const timeVal = timeSel ? timeSel.value : `morning`;
const faceVal = faceSel ? faceSel.value : `N`;
const compassOut = document.getElementById(‘shadow-compass-out’);
const sunOut = document.getElementById(‘shadow-sun-out’);
const relOut = document.getElementById(‘shadow-rel-out’);
const noteOut = document.getElementById(‘shadow-note-out’);
const svg = document.getElementById(‘shadow-svg’);
const lrMap = {
N: { left: `West`, right: `East`, front: `North`, back: `South`, deg: 0 },
S: { left: `East`, right: `West`, front: `South`, back: `North`, deg: 180 },
E: { left: `North`, right: `South`, front: `East`, back: `West`, deg: 90 },
W: { left: `South`, right: `North`, front: `West`, back: `East`, deg: 270 }
};
const info = lrMap[faceVal] || lrMap.N;
let shadowDir = `None`;
let sunPos = `Overhead (Zenith)`;
let relativeStr = `No Shadow Cast`;
if (timeVal === `morning`) {
shadowDir = `West`;
sunPos = `East`;
} else if (timeVal === `evening`) {
shadowDir = `East`;
sunPos = `West`;
}
if (shadowDir !== `None`) {
if (info.left === shadowDir) relativeStr = `To Their Left`;
else if (info.right === shadowDir) relativeStr = `To Their Right`;
else if (info.front === shadowDir) relativeStr = `In Front of Them`;
else if (info.back === shadowDir) relativeStr = `Behind Them`;
}
if (compassOut) compassOut.textContent = shadowDir;
if (sunOut) sunOut.textContent = `Sun position: ${sunPos}`;
if (relOut) relOut.textContent = relativeStr;
if (noteOut) noteOut.textContent = `Facing ${info.front}: Left = ${info.left}, Right = ${info.right}`;
if (!svg) return;
let sunMarkup = `SUN OVERHEAD`;
let shadowMarkup = “;
if (timeVal === `morning`) {
sunMarkup = `
SUN (E)
`;
shadowMarkup = `
SHADOW → W
`;
} else if (timeVal === `evening`) {
sunMarkup = `
SUN (W)
`;
shadowMarkup = `
SHADOW → E
`;
}
svg.innerHTML = `
NORTH
SOUTH
${sunMarkup}
${shadowMarkup}
L
R
`;
}
/* =========================================================
SECTION 06: TRAIN & SMOKE SIMULATOR
========================================================= */
const VEC_MAP = {
N: { dx: 0, dy: -1, label: `North` },
E: { dx: 1, dy: 0, label: `East` },
S: { dx: 0, dy: 1, label: `South` },
W: { dx: -1, dy: 0, label: `West` },
NONE: { dx: 0, dy: 0, label: `None` }
};
const OPP_MAP = { N: `S`, S: `N`, E: `W`, W: `E` };
function resolveVectorName(dx, dy) {
if (dx === 0 && dy === 0) return `Straight Up (Vertical)`;
const v = dy 0 ? `South` : “);
const h = dx > 0 ? `East` : (dx < 0 ? `West` : “);
if (v && h) return `${v}-${h}`;
return v || h;
}
function updateTrainSim() {
const motionSel = document.getElementById('train-motion');
const windSel = document.getElementById('train-wind');
const motion = motionSel ? motionSel.value : `N`;
const wind = windSel ? windSel.value : `E`;
const compOut = document.getElementById('train-comp-out');
const dragOut = document.getElementById('train-drag-out');
const smokeOut = document.getElementById('train-smoke-out');
const explainOut = document.getElementById('train-explain-out');
const svg = document.getElementById('train-svg');
if (motion === `ELEC`) {
if (compOut) compOut.textContent = `N/A (Electric)`;
if (dragOut) dragOut.textContent = `No combustion exhaust`;
if (smokeOut) smokeOut.textContent = `No Smoke`;
if (explainOut) explainOut.textContent = `Electric trains emit zero smoke regardless of wind.`;
if (svg) {
svg.innerHTML = `
ELECTRIC
NO SMOKE EMITTED
`;
}
return;
}
const dragDir = motion === `STAT` ? `NONE` : OPP_MAP[motion];
const dragVec = VEC_MAP[dragDir];
const windVec = VEC_MAP[wind];
const resDx = dragVec.dx + windVec.dx;
const resDy = dragVec.dy + windVec.dy;
const smokeName = resolveVectorName(resDx, resDy);
if (compOut) {
if (dragDir === `NONE` && wind === `NONE`) compOut.textContent = `Zero Horizontal`;
else if (dragDir === `NONE`) compOut.textContent = `Wind: ${windVec.label}`;
else if (wind === `NONE`) compOut.textContent = `Drag: ${dragVec.label}`;
else compOut.textContent = `${dragVec.label} + ${windVec.label}`;
}
if (dragOut) {
dragOut.textContent = `Train drag: ${dragDir === ‘NONE’ ? ‘None’ : dragVec.label} · Wind: ${wind === ‘NONE’ ? ‘Calm’ : windVec.label}`;
}
if (smokeOut) smokeOut.textContent = smokeName;
if (explainOut) {
if (resDx === 0 && resDy === 0 && dragDir !== `NONE` && wind !== `NONE`) {
explainOut.textContent = `Equal & opposite vectors cancel (depends on faster speed).`;
} else {
explainOut.textContent = `Smoke follows (−Train Motion) + (Wind).`;
}
}
if (!svg) return;
const trainVec = motion === `STAT` ? { dx: 0, dy: 0 } : VEC_MAP[motion];
const trainEndX = 150 + trainVec.dx * 72;
const trainEndY = 135 + trainVec.dy * 72;
const len = Math.sqrt(resDx * resDx + resDy * resDy) || 1;
const smokeEndX = 150 + (resDx / len) * 78;
const smokeEndY = 135 + (resDy / len) * 78;
const windEndX = 150 + windVec.dx * 56;
const windEndY = 135 + windVec.dy * 56;
let trainArrow = `TRAIN (STOPPED)`;
if (motion !== `STAT`) {
trainArrow = `
= 0 ? 18 : -12)}” text-anchor=”middle” class=”svg-label”>TRAIN → ${VEC_MAP[motion].label.toUpperCase()}
`;
}
let windArrow = “;
if (wind !== `NONE`) {
windArrow = `
= 0 ? 15 : -8)}” text-anchor=”middle” class=”svg-label-data1″>Wind (${windVec.label})
`;
}
let smokeArrow = `SMOKE STRAIGHT UP`;
if (resDx !== 0 || resDy !== 0) {
smokeArrow = `
= 0 ? 20 : -14)).toFixed(1)}” text-anchor=”middle” class=”svg-label-data2″>SMOKE: ${smokeName.toUpperCase()}
`;
}
svg.innerHTML = `
N
E
S
W
${windArrow}
${trainArrow}
${smokeArrow}
`;
}
/* =========================================================
SECTION 07: PRACTICE QUESTION BANK
========================================================= */
const PRACTICE_QUESTIONS = [
{
id: 1,
category: `nesw`,
badge: `NESW & Turns`,
prompt: `A student walks 12 m North, turns right and walks 8 m, turns right again and walks 12 m, and finally turns left and walks 5 m. How far and in which direction is the student from the starting point, and which way is the student facing?`,
options: [
`13 m East, facing East`,
`13 m West, facing West`,
`3 m East, facing North`,
`17 m North-East, facing East`
],
correct: 0,
solution: `
NESW Cycle Shortcut: Write
N — E — S — W.
1. Start North:
N = 12.
2. Turn Right (N → E):
E = 8.
3. Turn Right (E → S):
S = 12.
4. Turn Left (S → E):
E = 8 + 5 = 13.
Cancel opposites:
|N − S| = |12 − 12| = 0. Remaining:
13 m East , and final active column is
East .`
},
{
id: 2,
category: `nesw`,
badge: `NESW + Pythagoras`,
prompt: `Priya starts from her home and walks 7 km North. She turns right and walks 4 km, then turns right again and walks 4 km. What is the shortest distance between her home and her current position, and in which direction is she from home?`,
options: [
`5 km, North-West`,
`5 km, North-East`,
`7 km, East`,
`11 km, North-East`
],
correct: 1,
solution: `
NESW Cycle Shortcut: 1. Start North:
N = 7.
2. Right (N → E):
E = 4.
3. Right (E → S):
S = 4.
Cancel N & S:
7 N − 4 S = 3 km North; leftover
4 km East.
Combined direction:
North-East . Shortest distance by 3-4-5 triplet:
√(3² + 4²) = √25 = 5 km.`
},
{
id: 3,
category: `rotation`,
badge: `Angular Rotation`,
prompt: `Rohan is facing North-West. He turns 90° clockwise, then 135° anti-clockwise, and finally 90° clockwise again. Which direction is he facing now?`,
options: [
`North-East`,
`West`,
`North`,
`South-West`
],
correct: 2,
solution: `
Net Angle Cancellation: Sum Clockwise:
90° + 90° = 180° CW.
Sum Anti-Clockwise:
135° ACW.
Net rotation:
180° − 135° = 45° Clockwise.
Rotating 45° clockwise from
North-West (315°) lands directly on
North (0°) .`
},
{
id: 4,
category: `rotation`,
badge: `Angular Rotation`,
prompt: `A security guard is facing South. She turns 135° anti-clockwise, then 270° clockwise, and then 45° anti-clockwise. Which direction is she facing now?`,
options: [
`East`,
`North-West`,
`North`,
`West`
],
correct: 3,
solution: `
Net Angle Cancellation: Sum Clockwise:
270° CW.
Sum Anti-Clockwise:
135° + 45° = 180° ACW.
Net rotation:
270° − 180° = 90° Clockwise.
Rotating 90° clockwise from
South (180°) leads directly to
West (270°) .`
},
{
id: 5,
category: `pythagoras`,
badge: `Pythagoras (5-12-13)`,
prompt: `A cyclist rides 8 km East, turns left and rides 15 km, turns left and rides 20 km, and finally turns left and rides 10 km. What is the shortest straight-line distance back to the starting point?`,
options: [
`12 km`,
`13 km`,
`15 km`,
`17 km`
],
correct: 1,
solution: `
NESW Columns + Triplet: 1. Start East:
E = 8.
2. Left (E → N):
N = 15.
3. Left (N → W):
W = 20.
4. Left (W → S):
S = 10.
Cancel opposites:
|15 N − 10 S| = 5 km North;
|20 W − 8 E| = 12 km West.
By the 5-12-13 triplet:
√(5² + 12²) = √169 = 13 km.`
},
{
id: 6,
category: `pythagoras`,
badge: `Relative Position`,
prompt: `Town B is 8 km East of Town A. Town C is 6 km North of Town B. Town D is 16 km West of Town C. What is the shortest distance and direction of Town D from Town A?`,
options: [
`10 km, North-West`,
`10 km, North-East`,
`14 km, North-West`,
`12 km, South-West`
],
correct: 0,
solution: `
Coordinate Offset from A (0, 0): Town B =
8 km East; Town C =
8 km East, 6 km North; Town D moves 16 km West from C:
8 E − 16 W = 8 km West and
6 km North.
Direction of D from A:
North-West .
Distance:
√(8² + 6²) = √(64 + 36) = √100 = 10 km.`
},
{
id: 7,
category: `shadow`,
badge: `Morning Shadow`,
prompt: `One morning after sunrise, Vikram and Suman were standing facing each other in an open ground. Vikram noticed that Suman’s shadow fell exactly to Vikram’s own right. Which direction was Suman facing?`,
options: [
`South`,
`East`,
`West`,
`North`
],
correct: 3,
solution: `
Step 1 (Time): Morning sunrise means the sun is in the East, so all shadows fall toward the
West .
Step 2 (Whose Right?): The shadow fell to
Vikram’s right , meaning West is on Vikram’s right hand. Facing
South places West on your right—so Vikram faces
South .
Step 3 (Facing Each Other): Therefore, Suman faces the opposite direction:
North .`
},
{
id: 8,
category: `shadow`,
badge: `Evening Shadow`,
prompt: `One evening before sunset, Meera was walking directly toward a flagpole. The shadow of the flagpole fell exactly to Meera’s left. Which direction was Meera walking?`,
options: [
`North`,
`South`,
`East`,
`West`
],
correct: 1,
solution: `
Step 1 (Time): Before sunset (evening), the sun is in the West, so all shadows fall toward the
East .
Step 2 (Observer Side): The shadow fell to
Meera’s left , so East is to her left.
Step 3 (Facing): When you face
South , your left hand points East. Thus, Meera was walking
South .`
},
{
id: 9,
category: `train`,
badge: `Train & Wind`,
prompt: `A steam train is running due South at 60 km/h while wind blows directly toward the East. In which direction will the smoke of the train travel?`,
options: [
`North-East`,
`South-East`,
`North-West`,
`South-West`
],
correct: 0,
solution: `
Vector Rule: Smoke = (−Train Motion) + (Wind).
1. Train moves South → opposite drag vector is
North .
2. Wind pushes toward
East .
3. Combining North + East produces
North-East .`
},
{
id: 10,
category: `train`,
badge: `Electric Train Check`,
prompt: `An electric express train is running from West to East at 90 km/h while a strong wind blows from North to South. In which direction will the train’s smoke move?`,
options: [
`South-West`,
`North-West`,
`South-East`,
`No smoke is produced`
],
correct: 3,
solution: `
Concept Check: Although a steam or diesel train moving East in a South-blowing wind would trail smoke South-West, the question specifies an
electric express train . Electric locomotives do not emit smoke.`
}
];
let activeCategory = `all`;
let answeredMap = {};
function renderPracticeBank() {
const list = document.getElementById(‘question-list’);
if (!list) return;
const html = PRACTICE_QUESTIONS.map(function (q) {
const hiddenCls = (activeCategory === `all` || q.category === activeCategory) ? “ : ` hidden-card`;
const chosen = answeredMap[q.id];
const hasAnswered = typeof chosen === `number`;
const letters = [`A`, `B`, `C`, `D`];
const optsHtml = q.options.map(function (opt, idx) {
let cls = `option-btn`;
if (hasAnswered) {
if (idx === q.correct) cls += ` option-btn–correct`;
else if (idx === chosen) cls += ` option-btn–wrong`;
}
return `
${letters[idx]} ${opt} `;
}).join(”);
let feedbackHtml = “;
if (hasAnswered) {
if (chosen === q.correct) {
feedbackHtml = `
Correct — Option ${letters[q.correct]} is right.
`;
} else {
feedbackHtml = `
Not quite — you picked ${letters[chosen]}, while the correct answer is ${letters[q.correct]}.
`;
}
}
return `
Q${q.id}
${q.badge}
${q.prompt}
${optsHtml}
${feedbackHtml}
Show Step-by-Step Solution
`;
}).join(”);
list.innerHTML = html;
updatePracticeScore();
}
function selectOption(qId, optIdx) {
answeredMap[qId] = optIdx;
const solDrawer = document.getElementById(`sol-${qId}`);
const wasOpen = solDrawer ? !solDrawer.hasAttribute(`hidden`) : false;
renderPracticeBank();
if (wasOpen) {
const newSol = document.getElementById(`sol-${qId}`);
if (newSol) newSol.removeAttribute(`hidden`);
}
}
function toggleSolution(qId, btn) {
const drawer = document.getElementById(`sol-${qId}`);
if (!drawer || !btn) return;
const isHidden = drawer.hasAttribute(`hidden`);
if (isHidden) {
drawer.removeAttribute(`hidden`);
btn.setAttribute(`aria-expanded`, `true`);
btn.textContent = `Hide Step-by-Step Solution`;
} else {
drawer.setAttribute(`hidden`, “);
btn.setAttribute(`aria-expanded`, `false`);
btn.textContent = `Show Step-by-Step Solution`;
}
}
function filterQuestions(cat, btn) {
activeCategory = cat;
const group = btn ? btn.parentElement : null;
if (group) {
const btns = group.querySelectorAll(‘button’);
btns.forEach(function (b) { b.setAttribute(‘aria-pressed’, ‘false’); });
}
if (btn) btn.setAttribute(‘aria-pressed’, ‘true’);
renderPracticeBank();
}
function updatePracticeScore() {
const scoreEl = document.getElementById(‘practice-score’);
if (!scoreEl) return;
const attemptedIds = Object.keys(answeredMap);
let correctCount = 0;
attemptedIds.forEach(function (idStr) {
const q = PRACTICE_QUESTIONS.find(function (item) { return item.id === Number(idStr); });
if (q && answeredMap[idStr] === q.correct) correctCount += 1;
});
scoreEl.textContent = `Score: ${correctCount} / ${attemptedIds.length} attempted (${PRACTICE_QUESTIONS.length} total)`;
}
function resetPractice(btn) {
if (!btn) return;
if (btn.dataset.armed !== `true`) {
btn.dataset.armed = `true`;
btn.textContent = `Click again to confirm reset`;
return;
}
btn.dataset.armed = `false`;
btn.textContent = `Reset Practice`;
answeredMap = {};
renderPracticeBank();
}
/* =========================================================
INITIALIZE ALL INTERACTIVE LABS ON LOAD
========================================================= */
document.addEventListener(‘DOMContentLoaded’, function () {
renderCompass();
updateRotationCalc();
renderNeswLedger();
updatePythagoras();
updateShadowSim();
updateTrainSim();
renderPracticeBank();
});