v0.0.4.0 feat(module-2): tam giác đồng dạng (lớp 8, scale slider) (#4)

* feat(component): similarity-scale slider controller

Single-slider similarity demo for Module 2. Fixed △ABC, scaled △A'B'C' computed
each frame as `centroid_target + k · (vertex − centroid_ABC)` for k ∈ [0.5, 2].
The slider's input event is the only event listener — no Pointer Events here
(we're not dragging vertices in this MVP). AbortController teardown on
astro:before-swap as before.

The renderTicks helper is duplicated from congruence-sss.ts for now — when
Module 4 lands we'll factor it out into a shared module. Premature
abstraction would force a circular import structure for one helper.

* feat(module-2): tam giác đồng dạng (lớp 8) with scale slider

Page at /lop-8/tam-giac-dong-dang/. △ABC fixed on the left at scalene scale-72.8 / 83.2 / 93.4 sides. △A'B'C' is the runtime scaled image, controlled by a
single range input k ∈ [0.5, 2] step 0.05.

Live readout table shows all six side lengths and all three ratios. The killer
moment: drag the slider, watch all 3 ratios stay numerically equal to each
other (= 1/k). That equality IS the definition of similarity, made visible.

Tick marks per Decision D3: 1/2/3 ticks color-paired (#D7263D / #1B998B /
#F46036). Triangle 1 ticks rendered once on mount; triangle 2 ticks redrawn
on every slider input.

Hub: lớp 8 card flips to live status. All 3 grade cards now active —
the autoplan 3-module hero set is complete.

* chore: VERSION 0.0.4.0 + CHANGELOG + TODOS update

v0.0.4.0 = scaffold + Module 3 (góc nội tiếp) + Module 1 (tam giác bằng nhau)
+ Module 2 (tam giác đồng dạng). All three MVP modules from autoplan now live.

Move 2 P1 items to Completed (scale slider, ratio readout) and reduce Module 2
remaining items to P2 (free-drag mode) + P3 (numeric angle readouts).

---------
This commit is contained in:
tiennm99 authored and GitHub committed 2026-04-30 00:25:08 +07:00
1 parent 80379c7c08
commit 8c949bf4ca
7 files changed
+406 -12

No files matched your search

+9 -7
View File
@@ -67,15 +67,15 @@ Tracked work, organized by component then priority (P0 highest → P4 lowest). S
**Priority:** P3
**What:** v0.0.3.0 ships 1 example. SGK textbook has many. Add 2 more.
## Module 2 — Lớp 8 Tam giác đồng dạng (weekend 4)
## Module 2 — Lớp 8 Tam giác đồng dạng
- **Similarity ratio + AA/SAS/SSS-similar detectors**
**Priority:** P1
**What:** `src/geom-engine/similarity.ts`. Live ratio display via numeric text-node updates only (KaTeX template rendered at build, never re-parsed during drag).
- **Free-vertex-drag mode (AA / SAS / SSS đồng dạng detectors)**
**Priority:** P2
**What:** v0.0.4.0 ships scale-slider mode. Add a toggle to switch into free-drag mode where both triangles' vertices can be moved independently and the detector identifies which similarity case (if any) holds. Adds `src/geom-engine/similarity.ts`.
- **Scale slider clamped to [0.5, 2.0]**
**Priority:** P1
**What:** `min=0.5, max=2, step=0.05`. Cannot reach 0. Per Eng failure mode #3.
- **Numeric angle readouts on the canvas**
**Priority:** P3
**What:** Currently angles are pinned conceptually in prose. Add live numeric readouts (∠A, ∠B, ∠C and primes) so students see "the angles don't change" empirically.
## Testing & CI infrastructure (with first canvas module)
@@ -152,3 +152,5 @@ Tracked work, organized by component then priority (P0 highest → P4 lowest). S
- **TheoremCanvas primitive first cut** — vanilla TS in Astro `<script>` tag, AbortController teardown on `astro:before-swap`. **Completed:** v0.0.2.0 (2026-04-29). Note: built directly in Astro rather than as a single HTML prototype first; the inscribed-angle pattern proved the shape, and the next module (lớp 7 / 8) will reuse this pattern.
- **SSS detector** — `src/geom-engine/triangle.ts:congruentSSS` with position-strict semantics. 10 unit tests including symmetry and EPSILON tolerance. **Completed:** v0.0.3.0 (2026-04-30)
- **SGK tick-mark encoding** — 1/2/3 ticks paired with the locked 3-color palette, rendered live during drag. Wired in Module 1 (Tam giác bằng nhau). **Completed:** v0.0.3.0 (2026-04-30). Tick rendering helper in `src/components/congruence-sss.ts:renderTicks` is reusable for future modules.
- **Scale slider clamped to [0.5, 2.0]** — `src/components/similarity-scale.ts` step 0.05. Cannot reach 0. **Completed:** v0.0.4.0 (2026-04-30)
- **Similarity ratio readout** — three ratio readouts (AB/A′B′, BC/B′C′, CA/C′A′) showing all-equal under scaling. **Completed:** v0.0.4.0 (2026-04-30) as part of Module 2.