--- title: "Geometry 1" id: 51888 type: "computer_media" slug: "geometry-1" url: "http://localhost/computer_media/geometry-1/" markdown_url: "http://localhost/computer_media/geometry-1.md" published_at: "2023-08-16T01:42:21+00:00" modified_at: "2026-04-03T07:59:10+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2019/02/20230809-041332.jpg" excerpt: "Four geometry utilities in one package tackle polygon area, degree/minute/second conversion, five triangle-solving cases, and full 3D vector analysis with direction cosines." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "Timex Computer Corporation" slug: "timex-computer-corporation" taxonomy: "post_tag" url: "http://localhost/tag/timex-computer-corporation/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Education" slug: "education" taxonomy: "genre" url: "http://localhost/type/education/" - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_type: "Cassette" download_url: "https://archive.org/download/timex-sinclair-software-archive/Geometry 1 (1983)(Timex)(US)(TS1000)(Cassette).zip" mediadate: "1983" producer_company: - id: 11401 title: "Timex Computer Corporation" type: "company" url: "http://localhost/company/timex-computer-corporation/" related_products: - id: 12719 title: "Geometry I" type: "product" url: "http://localhost/product/geometry-i/" media_type_tags: "Education, Mathematics" --- This collection contains four geometry programs: a polygon area calculator, an angle unit converter, a triangle solver, and a 3D vector analyzer. The polygon area calculator implements the shoelace formula, storing vertices in arrays of size N+1 so the closing segment wraps back to the first vertex without a conditional. The angle converter handles full degree/minute/second decomposition in both directions. The triangle solver uses a computed GOTO (GO TO 200*B) to dispatch five triangle-type cases (AAS, ASA, SAS, SSA, SSS), applying the law of sines and law of cosines as appropriate, and includes an SSA ambiguous-case check at line 870. The vector analyzer computes magnitudes, direction cosines, and the angle between two 3D vectors, with clamping guards (lines 265–266 and 505–510) to prevent domain errors in ACS due to floating-point rounding. *** ## Program Analysis ### Program Structure The listing contains four independent programs, each terminated by a `SAVE`/`RUN` pair. They share no variables and are meant to be loaded individually: 1. **AREA** – Polygon area via the shoelace formula (lines 10–240) 2. **DEGREES** – Radians ↔ degrees/minutes/seconds converter (lines 5–430) 3. **PARTS** – Triangle solver for five case types (lines 10–2030) 4. **VECTOR** – 3D vector analysis (lines 10–550) ### AREA – Polygon Area Calculator The program collects N vertex pairs and computes area using the shoelace (Gauss) formula. The array is dimensioned to `N+1` elements, and lines 160–170 copy the first vertex into position `N+1`, elegantly closing the polygon loop without a branch inside the summation. The summation at line 200 accumulates `(X(I)+X(I+1))*(Y(I)-Y(I+1))`; dividing the absolute value by 2 at line 220 yields the correct area regardless of vertex winding order. `FAST` mode is entered at line 156 before the calculation, which on this platform suppresses the display to speed up the arithmetic loop. Input validation at lines 60–80 truncates N to an integer and rejects values below 1, but does not enforce an upper bound. ### DEGREES – Angle Unit Converter A three-option menu dispatches to radians-to-DMS conversion (lines 130–260) or DMS-to-radians conversion (lines 300–430). The radians-to-DMS path multiplies by 3600×180/PI to get total arc-seconds, then uses `INT` arithmetic to peel off degrees, minutes, and seconds. Line 190 handles full rotations by computing `D MOD 360` via `D - 360*INT(D/360)`. The DMS-to-radians path (line 400) similarly normalizes the decimal degree value modulo 360 before converting, though the printed result at line 410 uses the un-normalized `A` value — a minor inconsistency that could cause unexpected output for very large degree inputs. ### PARTS – Triangle Solver This is the most complex of the four programs. The user selects a problem type (1–5), and the computed `GO TO 200*B` at line 160 dispatches to the appropriate case handler: | Input (B) | Jump target | Case | | --- | --- | --- | | 1 | 200 | AAS – two angles and a non-included side | | 2 | 400 | ASA – two angles and the included side | | 3 | 600 | SAA – side and two adjacent angles | | 4 | 800 | SSA – two sides and a non-included angle (ambiguous) | | 5 | 1000 | SSS – three sides given | Shared subroutines at lines 1500 and 2000 handle side and angle input respectively, with the angle subroutine converting from degrees to radians on entry (`A(B)=A(B)*PI/180`). Output at line 1425 converts back to degrees for display. The SSA ambiguous case is handled at lines 860–910: the altitude `T` is computed, and if `S(1) < T` no solution exists (line 520). The code at line 890 checks `S(1) <= T` (which in practice means equality, i.e., a right triangle) to go directly to the angle calculation, otherwise it adds both possible base segments before proceeding. Note that this resolves to only one of the two possible triangles in the genuinely ambiguous case — the second solution is not presented. The `GO TO 15` at line 1450 resets arrays and re-prompts after each solution, using `CLEAR` at line 15 to release dynamic memory before re-dimensioning. ### VECTOR – 3D Vector Analyzer The program computes and displays magnitude, the three direction-cosine angles (with each Cartesian axis), and the angle between two vectors. The constant `S=57.29578` (degrees per radian, i.e., 180/PI) is used in preference to `PI` itself for the degree conversion, avoiding repeated division. A subroutine at line 500 is used for each direction-cosine angle. It applies two layers of rounding and clamping: - Line 500 rounds the cosine value to 8 decimal places to suppress floating-point noise. - Lines 505–510 clamp to [−1, 1] to prevent a domain error in `ACS`. - Line 530 rounds the resulting angle to 5 decimal places for clean output. The same clamping pattern is applied inline at lines 265–266 for the inter-vector angle. Lines 270–290 special-case a dot product of zero (orthogonal vectors) by directly assigning 90° rather than computing `ACS 0`, which is defensively correct but not strictly necessary since `ACS 0` would simply return PI/2. ### Notable Techniques and Anomalies - The computed `GO TO 200*B` idiom in PARTS is an efficient dispatch table, avoiding a chain of `IF` tests. - Re-dimensioning arrays each iteration in AREA (lines 90–100) and PARTS (line 15–17) is the standard way to handle variable-size data on this platform, since arrays cannot be resized after `DIM`. - AREA enters `FAST` mode before computation but never explicitly restores `SLOW` mode; returning to the `PRINT` statement at line 220 implicitly restores normal display since output requires it. - DEGREES line 550 is unreachable dead code (`GOTO 20` at line 430 precedes it); line 550 would be reached only by falling through from line 540, which itself is only reachable after a `GOTO 20` branch at line 430 — there is no actual fall-through path. - VECTOR re-runs the entire program with `RUN` (line 350) on “Y” rather than branching back to line 30, which re-initializes all variables but also re-executes the `DIM` statements, adding slight overhead. ## Source Code ``` 10 CLS 20 PRINT "AREA OF A POLYGON" 30 PRINT 40 PRINT "HOW MANY VERTICES (0 TO END)?" 50 INPUT N 60 LET N=INT N 70 IF N=0 THEN STOP 80 IF N<1 THEN GOTO 40 90 DIM X(N+1) 100 DIM Y(N+1) 110 FOR I=1 TO N 120 CLS 130 PRINT "X COORDINATE OF VERTEX ";I;" "; 135 INPUT X(I) 136 PRINT X(I) 140 PRINT "Y COORDINATE OF VERTEX ";I;" "; 145 INPUT Y(I) 150 NEXT I 155 CLS 156 FAST 160 LET X(N+1)=X(1) 170 LET Y(N+1)=Y(1) 180 LET AREA=0 190 FOR I=1 TO N 200 LET AREA=AREA+(X(I)+X(I+1))*(Y(I)-Y(I+1)) 210 NEXT I 220 PRINT "AREA = ";ABS AREA/2 230 PRINT 240 GOTO 30 250 SAVE "ARE[A]" 260 RUN 5 SCROLL 10 CLS 20 PRINT "ANGLE CONVERSION" 30 PRINT 40 PRINT "1. RADIANS TO DEGREES" 50 PRINT "2. DEGREES TO RADIANS" 60 PRINT "3. STOP" 70 PRINT 80 PRINT "OPTION: "; 90 INPUT A 95 PRINT A 100 IF A=3 THEN STOP 110 IF A=2 THEN GOTO 300 120 IF A<>1 THEN GOTO 10 130 CLS 140 PRINT "ANGLE IN RADIANS: "; 150 INPUT R 160 PRINT R 170 LET A=3600*180*R/PI 180 LET D=INT (A/3600) 190 LET D1=INT (D/360) 200 PRINT " DEGREES = ";D-360*D1 210 LET A=INT (A-D*3600) 220 LET B=INT (A/60) 230 PRINT " MINUTES = ";B 240 PRINT " SECONDS = ";A-60*B 250 PRINT 260 GOTO 20 300 CLS 305 PRINT "DEGREES: "; 310 INPUT D 320 PRINT D 330 PRINT "MINUTES: "; 340 INPUT M 350 PRINT M 360 PRINT "SECONDS: "; 370 INPUT S 380 PRINT S 390 LET A=D+M/60+S/3600 400 LET R=A-360*INT (A/360) 410 PRINT " RADIANS = ";A*PI/180 420 PRINT 430 GOTO 20 440 SAVE "DEGREE[S]" 450 RUN 10 CLS 15 CLEAR 16 DIM S(3) 17 DIM A(3) 120 PRINT "PROBLEM TYPE" 130 INPUT B 140 IF B=0 THEN STOP 150 IF B<1 OR B>5 THEN GOTO 120 155 CLS 160 GOTO 200*B 200 LET B=1 210 GOSUB 2000 220 LET B=3 230 GOSUB 1500 240 LET B=2 250 GOSUB 2000 255 LET A(3)=PI-A(1)-A(2) 260 LET S(1)=S(3)*SIN (A(1))/SIN (A(3)) 270 LET S(2)=S(3)*SIN (A(2))/SIN (A(3)) 280 GOTO 1400 400 FOR B=1 TO 3 410 IF B=1 THEN GOSUB 2000 420 IF B<>1 THEN GOSUB 1500 430 NEXT B 460 LET S(1)=SQR (S(3)*S(3)+S(2)*S(2)-2*S(3)*S(2)*COS (A(1))) 470 LET A(2)=SIN (A(1))/S(1)*S(2) 480 LET A(2)=ASN A(2) 490 LET A(3)=PI-A(1)-A(2) 500 GOTO 1400 520 PRINT 530 PRINT "NO SOLUTION" 540 PRINT 550 GOTO 20 600 LET B=3 605 GOSUB 1500 610 GOSUB 2000 620 LET B=2 630 GOSUB 2000 660 LET A(1)=PI-A(2)-A(3) 670 GOTO 260 800 LET B=1 805 GOSUB 2000 810 GOSUB 1500 820 LET B=2 830 GOSUB 1500 860 LET T=S(2)*SIN (A(1)) 870 IF S(1)1 THEN LET J=1 266 IF J<-1 THEN LET J=-1 270 IF J<>0 THEN GOTO 300 280 LET J=90 290 GOTO 310 300 LET J=S*ACS J 305 LET J=INT (J*1000000+.5)/1000000 310 PRINT "ANGLE BETWEEN VECTORS: ";J 320 PRINT 330 PRINT "MORE?" 340 INPUT A$ 350 IF A$="Y" THEN RUN 360 IF A$="N" THEN STOP 370 PRINT "YES OR NO" 380 GOTO 330 390 SAVE "VECTO[R]" 400 RUN 500 LET J=INT (J*1E8+.5)/1E8 505 IF J>1 THEN LET J=1 510 IF J<-1 THEN LET J=-1 520 LET J=S*ACS J 530 LET J=INT (J*1E5+.5)/1E5 540 PRINT J 550 RETURN ```