From: Svjatoslav Agejenko Date: Mon, 24 Feb 2025 15:55:32 +0000 (+0200) Subject: Improve code readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=d5f6775a62516c6f474316c5f0e6aba824320712;p=qbasicapps.git Improve code readability --- diff --git a/Graphics/Presentations/AI/AI demo.bas b/Graphics/Presentations/AI/AI demo.bas index 43a24c3..a467ed5 100644 --- a/Graphics/Presentations/AI/AI demo.bas +++ b/Graphics/Presentations/AI/AI demo.bas @@ -12,13 +12,13 @@ DECLARE SUB sc9 () DECLARE SUB box (x1!, y1!, x2!, y2!) DECLARE SUB calc (tx1!, ty1!, tz1!, tx2!, ty2!, tz2!, tx3!, ty3!, tz3!, c!) DECLARE SUB getan (x1!, y1!, x2!, y2!, N!) -DECLARE SUB rot (zx!, zy!, x1!, y1!, N!) +DECLARE SUB RotatePoint (zx!, zy!, x1!, y1!, N!) DECLARE SUB fp (x1!, y1!, x2!, y2!, x3!, y3!, c!) DECLARE SUB InitializeFont () DECLARE SUB inpur () DECLARE SUB mkback () DECLARE SUB SetPalette (r!, g!, b!, c!) -DECLARE SUB pri (x!, y!, s!, c!, a$) +DECLARE SUB PrintText (x!, y!, s!, c!, a$) ' AI presentation ' made by Svjatoslav Agejenko ' in 2002 @@ -82,26 +82,26 @@ SUB calc (tx1, ty1, tz1, tx2, ty2, tz2, tx3, ty3, tz3, c) z3 = tz3 getan x1, y1, x2, y2, n1 - rot x1, y1, x2, y2, -n1 - rot x1, y1, x3, y3, -n1 + RotatePoint x1, y1, x2, y2, -n1 + RotatePoint x1, y1, x3, y3, -n1 getan y1, z1, y2, z2, n2 n2 = n2 + pi / 2 - rot y1, z1, y2, z2, -n2 - rot y1, z1, y3, z3, -n2 + RotatePoint y1, z1, y2, z2, -n2 + RotatePoint y1, z1, y3, z3, -n2 getan x1, z1, x3, z3, n3 n3 = n3 + pi / 2 - rot x1, z1, x2, z2, -n3 - rot x1, z1, x3, z3, -n3 + RotatePoint x1, z1, x2, z2, -n3 + RotatePoint x1, z1, x3, z3, -n3 x4 = x1 y4 = y1 z4 = z1 + 30 - rot x1, z1, x4, z4, n3 - rot y1, z1, y4, z4, n2 - rot x1, y1, x4, y4, n1 + RotatePoint x1, z1, x4, z4, n3 + RotatePoint y1, z1, y4, z4, n2 + RotatePoint x1, y1, x4, y4, n1 'LINE (tx1, ty1)-(x4, y4), 255 x1 = tx1 + 20 @@ -270,7 +270,8 @@ IF s > 2 THEN GOTO 5 END SUB DEFSNG A-Z -SUB pri (x, y, s, c, a$) +' Subroutine to print text on screen +SUB PrintText (x, y, s, c, a$) IF s = 1 THEN x2 = x FOR a = 1 TO LEN(a$) @@ -283,12 +284,13 @@ SUB pri (x, y, s, c, a$) NEXT x1 NEXT y1 7 - x2 = x2 + 8 - NEXT a + x2 = x2 + 8 + NEXT a END IF END SUB -SUB rot (zx, zy, x1, y1, N) +' Subroutine to rotate a point around an axis +SUB RotatePoint (zx, zy, x1, y1, N) x2 = x1 - zx y2 = y1 - zy c1 = SIN(N) @@ -454,21 +456,21 @@ box 30, 50, 250, 180 SetPalette 32, 64, 32, 250 y = -8 -pri 30, 70 + y, 1, 250, " Kasutatud kirjandus:" +PrintText 30, 70 + y, 1, 250, " Kasutatud kirjandus:" y = y + 20 -pri 30, 70 + y, 1, 250, "An augmented computer vision" +PrintText 30, 70 + y, 1, 250, "An augmented computer vision" y = y + 13 -pri 30, 70 + y, 1, 250, "approach for anhanced" +PrintText 30, 70 + y, 1, 250, "approach for anhanced" y = y + 13 -pri 30, 70 + y, 1, 250, "understanding. M.Adjouadi," +PrintText 30, 70 + y, 1, 250, "understanding. M.Adjouadi," y = y + 13 -pri 30, 70 + y, 1, 250, "J.Riley; " +PrintText 30, 70 + y, 1, 250, "J.Riley; " y = y + 13 -pri 30, 70 + y, 1, 250, "Journal of Rehabilitation" +PrintText 30, 70 + y, 1, 250, "Journal of Rehabilitation" y = y + 13 -pri 30, 70 + y, 1, 250, "Research & Development," +PrintText 30, 70 + y, 1, 250, "Research & Development," y = y + 13 -pri 30, 70 + y, 1, 250, "Oct 95, Vol. 32 issue 3" +PrintText 30, 70 + y, 1, 250, "Oct 95, Vol. 32 issue 3" inpur @@ -652,13 +654,13 @@ box 30, 50, 290, 150 SetPalette 32, 64, 32, 250 y = 0 -pri 30, 70 + y, 1, 250, " Spatial vision" +PrintText 30, 70 + y, 1, 250, " Spatial vision" y = y + 16 -pri 30, 70 + y, 1, 250, "Object recognition" +PrintText 30, 70 + y, 1, 250, "Object recognition" y = y + 20 -pri 30, 70 + y, 1, 250, "Goal: + interpriteerimine" +PrintText 30, 70 + y, 1, 250, "Goal: + interpriteerimine" y = y + 16 -pri 30, 70 + y, 1, 250, " + automaatjuhtimine" +PrintText 30, 70 + y, 1, 250, " + automaatjuhtimine" inpur END SUB @@ -671,17 +673,17 @@ box 30, 50, 290, 150 SetPalette 32, 64, 32, 250 y = -8 -pri 30, 70 + y, 1, 250, "Tunnuste ekstraheerimise protsess" +PrintText 30, 70 + y, 1, 250, "Tunnuste ekstraheerimise protsess" y = y + 20 -pri 30, 70 + y, 1, 250, "a) Laplace - Gaussi operaator;" +PrintText 30, 70 + y, 1, 250, "a) Laplace - Gaussi operaator;" y = y + 12 -pri 30, 70 + y, 1, 250, "b) lainekese teisenduse multi-" +PrintText 30, 70 + y, 1, 250, "b) lainekese teisenduse multi-" y = y + 12 -pri 30, 70 + y, 1, 250, " skaalaline serva avastamine;" +PrintText 30, 70 + y, 1, 250, " skaalaline serva avastamine;" y = y + 12 -pri 30, 70 + y, 1, 250, "c) h�perveeru teooria lihtsate" +PrintText 30, 70 + y, 1, 250, "c) h�perveeru teooria lihtsate" y = y + 12 -pri 30, 70 + y, 1, 250, " rakkude p�him�tted." +PrintText 30, 70 + y, 1, 250, " rakkude p�him�tted." inpur END SUB @@ -694,13 +696,13 @@ box 30, 50, 290, 150 SetPalette 32, 64, 32, 250 y = -8 -pri 30, 70 + y, 1, 250, "* Depth extraction" +PrintText 30, 70 + y, 1, 250, "* Depth extraction" y = y + 20 -pri 30, 70 + y, 1, 250, "* Usage of spatial vision" +PrintText 30, 70 + y, 1, 250, "* Usage of spatial vision" y = y + 20 -pri 30, 70 + y, 1, 250, "* Similarity" +PrintText 30, 70 + y, 1, 250, "* Similarity" y = y + 20 -pri 30, 70 + y, 1, 250, "* Matching strategy" +PrintText 30, 70 + y, 1, 250, "* Matching strategy" inpur END SUB @@ -1064,7 +1066,7 @@ box 30, 50, 290, 80 SetPalette 32, 64, 32, 250 y = -8 -pri 30, 70 + y, 1, 250, " T�nan t�helepanu eest" +PrintText 30, 70 + y, 1, 250, " T�nan t�helepanu eest" inpur END SUB