diff --git a/frontend/textbooks/geometry_8_ch4.html b/frontend/textbooks/geometry_8_ch4.html
index e5df4fc..2d89766 100644
--- a/frontend/textbooks/geometry_8_ch4.html
+++ b/frontend/textbooks/geometry_8_ch4.html
@@ -1259,10 +1259,13 @@ function buildP3(){
-
-
-
-
+
+
+
+
+
+
+
O
A
@@ -1391,16 +1394,15 @@ function buildP3(){
const sinA=R/OA, cosA=AT/OA;
const T1x=cx+R*sinA, T1y=cy-R*cosA;
const T2x=cx+R*sinA, T2y=cy+R*cosA;
- // right angle markers — ut must point TOWARD A from each tangent point
- const ur1x=(T1x-cx)/R, ur1y=(T1y-cy)/R; // T1 is upper; radius points upper-right
- // CCW perp of upper-right radius = lower-right = toward A ✓
- const ut1x=-(ur1y), ut1y=ur1x;
+ // right angle markers — arms must point INWARD (toward O) and toward A
+ const ur1x=(T1x-cx)/R, ur1y=(T1y-cy)/R; // outward radial unit
+ const ut1x=-(ur1y), ut1y=ur1x; // CCW perp = toward A for upper T1
const s=8;
- const rm1=`${(T1x+ur1x*s).toFixed(1)},${(T1y+ur1y*s).toFixed(1)} ${(T1x+ur1x*s+ut1x*s).toFixed(1)},${(T1y+ur1y*s+ut1y*s).toFixed(1)} ${(T1x+ut1x*s).toFixed(1)},${(T1y+ut1y*s).toFixed(1)}`;
- const ur2x=(T2x-cx)/R, ur2y=(T2y-cy)/R; // T2 is lower; radius points lower-right
- // CW perp of lower-right radius = upper-right = toward A ✓
- const ut2x=ur2y, ut2y=-ur2x;
- const rm2=`${(T2x+ur2x*s).toFixed(1)},${(T2y+ur2y*s).toFixed(1)} ${(T2x+ur2x*s+ut2x*s).toFixed(1)},${(T2y+ur2y*s+ut2y*s).toFixed(1)} ${(T2x+ut2x*s).toFixed(1)},${(T2y+ut2y*s).toFixed(1)}`;
+ // marker: T+s·(-u_r), T+s·(-u_r)+s·u_t, T+s·u_t — uses INWARD direction (-u_r)
+ const rm1=`${(T1x-ur1x*s).toFixed(1)},${(T1y-ur1y*s).toFixed(1)} ${(T1x-ur1x*s+ut1x*s).toFixed(1)},${(T1y-ur1y*s+ut1y*s).toFixed(1)} ${(T1x+ut1x*s).toFixed(1)},${(T1y+ut1y*s).toFixed(1)}`;
+ const ur2x=(T2x-cx)/R, ur2y=(T2y-cy)/R;
+ const ut2x=ur2y, ut2y=-ur2x; // CW perp = toward A for lower T2
+ const rm2=`${(T2x-ur2x*s).toFixed(1)},${(T2y-ur2y*s).toFixed(1)} ${(T2x-ur2x*s+ut2x*s).toFixed(1)},${(T2y-ur2y*s+ut2y*s).toFixed(1)} ${(T2x+ut2x*s).toFixed(1)},${(T2y+ut2y*s).toFixed(1)}`;
/* Position T₁ label OUTSIDE circle, above-left of T₁ (away from upper tangent) */
const T1lx=(T1x-cx)/R, T1ly=(T1y-cy)/R; /* outward unit */
const T1labelX=T1x+T1lx*14-6, T1labelY=T1y+T1ly*14+3;
@@ -1475,12 +1477,13 @@ function buildP3(){
tri1=``;
tri2=``;
const s=7;
- const ur1x=(T1x-cx)/R, ur1y=(T1y-cy)/R; // T1 upper
- const ut1x=-(ur1y), ut1y=ur1x; // CCW perp → toward A ✓
- const rm1=`${(T1x+ur1x*s).toFixed(1)},${(T1y+ur1y*s).toFixed(1)} ${(T1x+ur1x*s+ut1x*s).toFixed(1)},${(T1y+ur1y*s+ut1y*s).toFixed(1)} ${(T1x+ut1x*s).toFixed(1)},${(T1y+ut1y*s).toFixed(1)}`;
- const ur2x=(T2x-cx)/R, ur2y=(T2y-cy)/R; // T2 lower
- const ut2x=ur2y, ut2y=-ur2x; // CW perp → toward A ✓
- const rm2=`${(T2x+ur2x*s).toFixed(1)},${(T2y+ur2y*s).toFixed(1)} ${(T2x+ur2x*s+ut2x*s).toFixed(1)},${(T2y+ur2y*s+ut2y*s).toFixed(1)} ${(T2x+ut2x*s).toFixed(1)},${(T2y+ut2y*s).toFixed(1)}`;
+ const ur1x=(T1x-cx)/R, ur1y=(T1y-cy)/R; // outward
+ const ut1x=-(ur1y), ut1y=ur1x; // CCW perp → toward A for upper T1
+ // marker INWARD: T+s·(-u_r) and T+s·u_t
+ const rm1=`${(T1x-ur1x*s).toFixed(1)},${(T1y-ur1y*s).toFixed(1)} ${(T1x-ur1x*s+ut1x*s).toFixed(1)},${(T1y-ur1y*s+ut1y*s).toFixed(1)} ${(T1x+ut1x*s).toFixed(1)},${(T1y+ut1y*s).toFixed(1)}`;
+ const ur2x=(T2x-cx)/R, ur2y=(T2y-cy)/R;
+ const ut2x=ur2y, ut2y=-ur2x; // CW perp → toward A for lower T2
+ const rm2=`${(T2x-ur2x*s).toFixed(1)},${(T2y-ur2y*s).toFixed(1)} ${(T2x-ur2x*s+ut2x*s).toFixed(1)},${(T2y-ur2y*s+ut2y*s).toFixed(1)} ${(T2x+ut2x*s).toFixed(1)},${(T2y+ut2y*s).toFixed(1)}`;
equal=``;
}
if(ph==='done'||ph==='equal'){