Author Topic: MAPTRIANGLE in 3D  (Read 1381 times)

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D: textured roller or cone
« Reply #15 on: November 27, 2018, 03:06:50 PM »
Hi.

In sample examples, textured blocks are already available. I was thinking about how to make a textured cylinder. Finally, the program can handle both a textured disk, a cylinder and a cone. The number of cone sides is determined by the Segments variable in the program. The higher Segments is, the body is finer and the texture is more faithful (and the program more demanding). The variables in the Celo0 and Celo1 fields contain the values ​​of the vertices of the individual triangles in the sense of rotation (because the object is a rotating body), celo0 is one untextured side of the cylinder, the cello1 is the second untextured side of the cylinder (bottom). Use the 1,2 keys to change the speed or direction of rotation, 3,4 to move the face to the X axis, 5,6 to move the Y axis, 7,8 to move the X axis to the second bottom, 9, Q to shift the Y axis of the second end, W, E for changing the diameter of the cylinder face, R, T for changing the diameter of the second face of the cylinder, A, S for the zoom, D, F for displacement in the Z axis of the first face, and G, H for the Z axis cell. A beautiful effect can be achieved by using the Stars image by Johnno56. I have one question for developers - why is this happening:

Use the T / R or W / E key to open the cone so that it is a hollow cylinder. Press C. This will enable the _CLOCKWISE parameter. The picture then has a lot of noise. Now close the cylinder (do the cone) (one radius is set to zero), the noise disappears. Why?


Code: [Select]
SCREEN _NEWIMAGE(800, 600, 32)

TYPE crc
    x AS SINGLE
    y AS SINGLE
END TYPE

DIM SHARED Segments, R1, R2, Z1, Z2, Efect, OldX, OldY

'Warning! Segments variable muss be dividible by 2!
Segments = 314: R1 = .1: R2 = 2: Z1 = -1: Z2 = -2
im = _LOADIMAGE("abcde 066.jpg", 32)

restart:
REDIM s(Segments + 1) AS LONG, celo0(Segments + 1) AS crc, celo1(Segments + 1) AS crc

divideimage s(), im
SETCelo R1, celo0()
SETCelo R2, celo1()
S = Segments
rd = .01
PrintIT = 1
DO
    Quad celo0(1).x, celo0(1).y, Z1, celo0(S).x, celo0(S).y, Z1, celo1(1).x, celo1(1).y, Z2, celo1(S).x, celo1(S).y, Z2, s(1)
    FOR d = 2 TO Segments
        Quad celo0(d - 1).x, celo0(d - 1).y, Z1, celo0(d).x, celo0(d).y, Z1, celo1(d - 1).x, celo1(d - 1).y, Z2, celo1(d).x, celo1(d).y, Z2, s(d)
    NEXT d


    i$ = INKEY$

    SELECT CASE UCASE$(i$)
        CASE "1": rd = rd + .001
        CASE "2": rd = rd - .001
        CASE "3": c0x = c0x + .01
        CASE "4": c0x = c0x - .01
        CASE "5": c0y = c0y + .01
        CASE "6": c0y = c0y - .01

        CASE "7": c1x = c1x + .01
        CASE "8": c1x = c1x - .01
        CASE "9": c1y = c1y + .01
        CASE "Q": c1y = c1y - .01

        CASE "W": R1 = R1 - .01: SETCelo R1, celo0()
        CASE "E": R1 = R1 + .01: SETCelo R1, celo0()
        CASE "R": R2 = R2 - .01: SETCelo R2, celo1()
        CASE "T": R2 = R2 + .01: SETCelo R2, celo1()


        CASE "A": Z1 = Z1 + .01: Z2 = Z2 + .01
        CASE "S": Z1 = Z1 - .01: Z2 = Z2 - .01

        CASE "D": Z1 = Z1 + .01
        CASE "F": Z1 = Z1 - .01

        CASE "G": Z2 = Z2 + .01
        CASE "H": Z2 = Z2 - .01

        CASE "C": IF Efect = 0 THEN Efect = 1 ELSE Efect = 0: _DELAY .2
        CASE CHR$(27):
            FOR freemem = 1 TO Segments
                _FREEIMAGE s(freemem)
            NEXT
            SYSTEM

    END SELECT


    i = 0: rot = rot + rd


    FOR f = 360 / Segments TO 360 STEP (360 / Segments)
        i = i + 1
        rad = _D2R(f)
        celo0(i).x = SIN(rad + rot) * R1 + c0x
        celo0(i).y = COS(rad + rot) * R1 + c0y

        celo1(i).x = SIN(rad + rot) * R2 + c1x
        celo1(i).y = COS(rad + rot) * R2 + c1y


    NEXT

    IF PrintIT THEN
        LOCATE 1
        _DISPLAYORDER _HARDWARE , _SOFTWARE
        _PRINTMODE _KEEPBACKGROUND
        PRINT "Press 1,2 for rotation, 3,4 for radius 1 X pos, 5,6 for radius 1 Y pos, 7,8 for radius 2 X pos, 9,Q for radius 2 Y pos, W,E for radius 1, R,T for radius 2, A,S for zoom, D,F for depth 1, G,H for depth 2"
        PRINT "Segments in use: "; Segments
        PrintIT = 0
    END IF

    _DISPLAY
    _LIMIT 55
LOOP


SUB SETCelo (radius AS INTEGER, arr() AS crc)
    FOR f = 0 TO 360 STEP (360 / Segments)
        i = i + 1
        rad = _D2R(f)
        arr(i).x = SIN(rad) * radius
        arr(i).y = COS(rad) * radius
    NEXT
END SUB


SUB divideimage (s() AS LONG, source AS LONG) 'divide image to more images in X
    sir = _WIDTH(source) / UBOUND(S)
    FOR r = 0 TO Segments
        i = i + 1
        s(i) = _NEWIMAGE(sir, _HEIGHT(source), 32)
        _PUTIMAGE (0, 0)-(sir, _HEIGHT(source)), source, s(i), (sirka, 0)-(sirka + sir, _HEIGHT(source))
        s(i) = _COPYIMAGE(s(i), 33)
        sirka = sirka + sir
    NEXT r
END SUB

SUB Quad (dx1, dy1, dz1, dx2, dy2, dz2, dx3, dy3, dz3, dx4, dy4, dz4, imag&)
    W = _WIDTH(imag&)
    H = _HEIGHT(imag&)

    IF Efect THEN
        _MAPTRIANGLE _CLOCKWISE (0, 0)-(W, 0)-(0, H), imag& TO(dx1, dy1, dz1)-(dx2, dy2, dz2)-(dx3, dy3, dz3), 0
        _MAPTRIANGLE _CLOCKWISE (W, 0)-(0, H)-(W, H), imag& TO(dx2, dy2, dz2)-(dx3, dy3, dz3)-(dx4, dy4, dz4), 0
    ELSE
        _MAPTRIANGLE (0, 0)-(W, 0)-(0, H), imag& TO(dx1, dy1, dz1)-(dx2, dy2, dz2)-(dx3, dy3, dz3), 0
        _MAPTRIANGLE (W, 0)-(0, H)-(W, H), imag& TO(dx2, dy2, dz2)-(dx3, dy3, dz3)-(dx4, dy4, dz4), 0
    END IF
END SUB
« Last Edit: November 27, 2018, 03:08:37 PM by Petr »

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D - ROTATION
« Reply #16 on: January 06, 2019, 11:08:18 AM »
Hi. Next demo show rotation in 3D using MAPTRIANGLE 3D, none direct OpenGL statements.

Code: [Select]
_TITLE "Next MAPTRIANGLE 3D demo"

k = _PI(2) / 4

TYPE b
    x AS INTEGER
    y AS INTEGER
END TYPE

'------------
DIM SHARED texture AS LONG, rot
DIM i AS LONG, i2 AS LONG

TYPE T
    x AS SINGLE
    y AS SINGLE
    z AS SINGLE
END TYPE

DIM SHARED T(18 * 110) AS T

init
'---------------------



SCREEN _NEWIMAGE(800, 600, 32)
CLS , _RGB32(127, 127, 188)


DIM B(3) AS b


B(0).x = -1: B(0).y = -1
B(1).x = 1: B(1).y = -1
B(2).x = -1: B(2).y = -1
B(3).x = 1: B(3).y = -1

w = _WIDTH(i)
h = _HEIGHT(i)

DO
    IF i THEN _FREEIMAGE i
    j = _NEWIMAGE(150, 100, 32)
    _DEST j
    CLS , _RGBA32(0, 50, 127, 100)
    clock 0, 0
    _DEST 0

    i = _COPYIMAGE(j, 33)
    _FREEIMAGE j

    clock 0, 0

    texture& = i
    '--------------------

    FOR Ys = 0 TO 17
        zz2 = zz2 + .01
        FOR Xs = 0 TO 50
            IF T(i4).x > 0 THEN
                X = T(i4).x + 70
                Y = T(i4).y
                z = T(i4).z - 70
                kostka X - zz2, Y, z - 15 + zz2
            END IF
            i4 = i4 + 1
    NEXT Xs, Ys
    i4 = 0
    IF zz2 > 140 THEN zz2 = -50
    '-----------------------------


    Sx = (200 + 600) / 2: Rx = (600 - 200) / 2
    Sy = (400 + 200) / 2: Ry = (400 - 200) / 2
    rot = rot + .01

    Sx = 0
    Sz = -2.5
    Sy = -1


    Rx = 1
    Ry = -1
    Rz = 1
    ' info for rotation. To rotate the bodies, you must have all the points that are rotating in the same center. For this demo, it is easy to specify the radius of rotation,
    ' because all the points are just as far from the center as the cube is a symmetrical body. But if you want to write a 3D game, then if you want to write with MAPTRIANGLE,
    ' you need to map the floor using 4 triangles and calculate the radius for the points on the edges using the Pythagoras theorem:
    '
    '       A--------------------------B     x is your position, as you see, all points use different radius
    '       I\\\                   Y / I     Y is your triangle side 1, next is floor height - Y
    '       I   \\\\\\             Y/  I     X is your triangle side 2, next is floor width - X
    '       I          \\\\\\\\/// xXXXI     third sides calculate using Pythagoras.
    '       I       ////////////    \  I
    '       I //////                 \ I
    '       C--------------------------D
    '
    x1 = Sx + SIN(rot) * Rx: z1 = Sz + COS(rot) * Rz: y1R = Sy + SIN(rot) * Ry
    x2 = Sx + SIN(rot + k) * Rx: z2 = Sz + COS(rot + k) * Rz: y2R = Sy + SIN(rot + k) * Ry

    x4 = Sx + SIN((2 * k) + rot) * Rx: z4 = Sz + COS((2 * k) + rot) * Rz: y3R = Sy + SIN((3 * k) + rot) * Ry
    x3 = Sx + SIN((3 * k) + rot) * Rx: z3 = Sz + COS((3 * k) + rot) * Rz: y4R = Sy + SIN((4 * k) + rot) * Ry

    y1 = B(0).y
    y2 = B(1).y
    y4 = B(2).y
    y3 = B(3).y




    y5 = y1 + 1.5
    y6 = y2 + 1.5
    y7 = y3 + 1.5
    y8 = y4 + 1.5


    _MAPTRIANGLE (0, h)-(w, h)-(0, 0), i TO(x1, y1, z1)-(x2, y2, z2)-(x3, y3, z3) 'podlaha                 floor
    _MAPTRIANGLE (w, h)-(0, 0)-(w, 0), i TO(x2, y2, z2)-(x3, y3, z3)-(x4, y4, z4) 'podlaha


    _MAPTRIANGLE (0, h)-(w, h)-(0, 0), i TO(x1, y5, z1)-(x2, y6, z2)-(x3, y7, z3) 'strop                   roof
    _MAPTRIANGLE (w, h)-(0, 0)-(w, 0), i TO(x2, y6, z2)-(x3, y7, z3)-(x4, y8, z4) 'strop

    _MAPTRIANGLE (0, h)-(w, h)-(0, 0), i TO(x1, y1, z1)-(x2, y2, z2)-(x1, y5, z1) 'prava stena             right wall
    _MAPTRIANGLE (w, h)-(0, 0)-(w, 0), i TO(x2, y2, z2)-(x1, y5, z1)-(x2, y6, z2) 'prava stena


    _MAPTRIANGLE (w, h)-(0, h)-(w, 0), i TO(x3, y3, z3)-(x4, y4, z4)-(x3, y7, z3) 'leva stena              left wall
    _MAPTRIANGLE (0, h)-(w, 0)-(0, 0), i TO(x4, y4, z4)-(x3, y7, z3)-(x4, y8, z4) 'leva stena


    _MAPTRIANGLE (w, h)-(0, h)-(w, 0), i TO(x1, y1, z1)-(x3, y3, z3)-(x1, y5, z1) 'zadni stena             back wall
    _MAPTRIANGLE (0, h)-(w, 0)-(0, 0), i TO(x3, y3, z3)-(x1, y5, z1)-(x3, y7, z3) 'zadni stena


    _MAPTRIANGLE (0, h)-(w, h)-(0, 0), i TO(x2, y2, z2)-(x4, y4, z4)-(x2, y6, z2) 'predni stena            front wall
    _MAPTRIANGLE (w, h)-(0, 0)-(w, 0), i TO(x4, y4, z4)-(x2, y6, z2)-(x4, y8, z4) 'zadni stena


    _DISPLAY
    _LIMIT 50
LOOP

SUB kostka (x, y, z) 'zadavas levy horni predni roh ,udela kostku v zadane x,y,z                         x y z are coordinates for left upper corner, do cube on this place


    W = _WIDTH(texture&)
    H = _HEIGHT(texture&)

    '                g                       h                                e                  f
    MAPQUAD x + -1.5, y + 1.5, z + -1.5, x + .5, y + 1.5, z + -1.5, x + -1.5, y + -.5, z + -1.5, x + .5, y + -.5, z - 1.5, texture&
    MAPQUAD x + -1, y + 1, z + -1, x + 1, y + 1, z + -1, x + -1.5, y + 1.5, z + -1.5, x + .5, y + 1.5, z + -1.5, texture&
    MAPQUAD x + -1.5, y + -.5, z + -1.5, x + .5, y + -.5, z - 1.5, x + -1, y + -1, z + -1, x + 1, y - 1, z - 1, texture& '
    MAPQUAD x + -1, y + 1, z + -1, x + -1.5, y + 1.5, z + -1.5, x + -1, y + -1, z + -1, x + -1.5, y + -.5, z + -1.5, texture&
    MAPQUAD x + .5, y + 1.5, z + -1.5, x + .5, y + -.5, z - 1.5, x + 1, y - 1, z - 1, x + 1, y + 1, z + -1, texture&
    '                a                     b                    c                       d
    MAPQUAD x + -1, y + 1, z + -1, x + 1, y + 1, z + -1, x + -1, y + -1, z + -1, x + 1, y - 1, z - 1, texture&

END SUB




SUB MAPQUAD (x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, texture AS LONG)
    W = _WIDTH(texture&)
    H = _HEIGHT(texture&)
    GOTO nerot 'comment it for show, how it hat not to see...

    po = _PI(2) / 4

    s1 = SIN(rot + (1 * po)) * x1
    c1 = COS(rot + (1 * po)) * y1

    s2 = SIN(rot + (2 * po)) * x2
    c2 = COS(rot + (2 * po)) * y2

    s3 = SIN(rot + (3 * po)) * x3
    c3 = COS(rot + (3 * po)) * y3

    s4 = SIN(rot + (4 * po)) * x4
    c4 = COS(rot + (4 * po)) * y4

    x1 = x1 + s1: y1 = y1 + c1
    x3 = x3 + s3: y3 = y3 + c3

    x2 = x2 + s2: y2 = y2 + c2
    x4 = x4 + s4: y4 = y4 + c4

    nerot:
    _MAPTRIANGLE (0, 0)-(W, 0)-(0, H), texture& TO(x1, y1, z1)-(x2, y2, z2)-(x3, y3, z3)
    _MAPTRIANGLE (W, 0)-(0, H)-(W, H), texture& TO(x2, y2, z2)-(x3, y3, z3)-(x4, y4, z4)
END SUB

SUB init
    text$ = " Petr" 'width = 32 pixels (records)

    virtual& = _NEWIMAGE(100, 100, 256)
    _DEST virtual&
    PRINT text$
    _SOURCE virtual&
    i = 0
    FOR Y = 17 TO 0 STEP -1
        FOR X = 0 TO 50
            IF POINT(X, Y) <> 0 THEN
                T(i).x = (-8.5 + X)
                T(i).y = -18 + (16 - Y) * 2
                T(i).z = -5 - X
            END IF
            i = i + 1
    NEXT X, Y
    _DEST 0: _SOURCE 0: _FREEIMAGE virtual&
    i = 0
END SUB


SUB clock (x, y)
    de = _DEST
    clocka& = _NEWIMAGE(100, 100, 32)
    _DEST clocka&
    vterina = VAL(RIGHT$(TIME$, 2))
    hodina = VAL(LEFT$(TIME$, 2))
    minuta = VAL(MID$(TIME$, 4, 2))

    IF hodina > 12 THEN hodina = hodina - 12
    hodina = hodina + (1 / 59) * minuta


    vt = vterina + 45
    ho = hodina + 45
    mi = minuta + 45

    pozicevterina = _PI(2) / 60 * vt
    poziceminuta = _PI(2) / 60 * ho * 5
    pozicehodina = _PI(2) / 60 * mi

    xs = 50 + COS(pozicevterina) * 30
    ys = 50 + SIN(pozicevterina) * 30

    xm = 50 + COS(poziceminuta) * 35
    ym = 50 + SIN(poziceminuta) * 35

    xh = 50 + COS(pozicehodina) * 40
    yh = 50 + SIN(pozicehodina) * 40

    FOR n = 1 TO 100
        LINE (n, 0)-(n, 99), _RGB32(127 - n, n, 27 + n), BF
    NEXT n
    LINE (0, 0)-(99, 99), _RGB32(255, 255, 255), B

    COLOR _RGBA32(127, 127, 127, 150)
    _PRINTMODE _KEEPBACKGROUND
    _PRINTSTRING (35, 45), "QB64"
    COLOR _RGB32(255, 255, 255)


    LINE (50, 50)-(xh, yh), _RGB32(255, 255, 0)
    LINE (50, 50)-(xm, ym), _RGB32(255, 255, 0)
    LINE (50, 50)-(xs, ys), _RGB32(0, 255, 255)
    m = 0
    FOR kruh = 0 TO _PI(2) STEP _PI(2) / 60
        PSET (50 + COS(kruh) * 47, 50 + SIN(kruh) * 47)
        IF m MOD 5 = 0 THEN LINE (50 + COS(kruh) * 47, 50 + SIN(kruh) * 47)-(50 + COS(kruh) * 44, 50 + SIN(kruh) * 44), , BF
        m = m + 1
    NEXT kruh
    _DEST de
    _SETALPHA 100, , clocka&
    _PUTIMAGE (x, y), clocka&, de
    _FREEIMAGE clocka&
END SUB


Offline Ashish

  • The joy of coding is endless.
Re: MAPTRIANGLE in 3D
« Reply #17 on: January 09, 2019, 05:37:38 AM »
Hi Petr! It is nicely done... 3D Text Effect is awesome! I like how the texture changes in real-time.
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D
« Reply #18 on: January 09, 2019, 10:51:04 AM »
Thank you, Ashish. I'm glad you like it.

Offline FellippeHeitor

  • QB64 Developer
  • LET IT = BE
    • QB64.org
Re: MAPTRIANGLE in 3D
« Reply #19 on: January 09, 2019, 11:11:00 AM »
Oh! No SUB _GL! That's impressive.

Offline johnno56

  • Live long and prosper.
Re: MAPTRIANGLE in 3D
« Reply #20 on: January 09, 2019, 03:23:49 PM »
Petr,

Most of 'how that works' is WAY over my head... I, for one, didn't think these types of effects could be done using only Basic. Well done! I'm impressed! Brilliant!

J
Logic is the beginning of wisdom.

Re: MAPTRIANGLE in 3D
« Reply #21 on: January 09, 2019, 08:54:35 PM »
Another awesome effort Petr, I like how you made block letters from a 2D print and used live clocks for a texture.
B = B + ...

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D
« Reply #22 on: January 10, 2019, 03:52:11 PM »
Thank you all very much for your feedback. :-D

Re: MAPTRIANGLE in 3D
« Reply #23 on: January 13, 2019, 12:22:46 PM »
very cool this 3d demo (more the last without gl)

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D: ROOM
« Reply #24 on: February 01, 2019, 04:32:56 PM »
So if you liked the previous program, I wonder what you will say about this. Exactly in this style like this program I will continue. The program will allow you a virtual tour of my kitchen where I write programs. Excuse the exaggerated size of the room, in fact it's half, I guessed it. Textures are only approximate. If anyone would like to explain some details of this program, ask, I will to answer later.
This whole program is written again without OpenGL commands, only with MAPTRIANGLE 3D. Use arrows to control, end with Esc.

Code: [Select]
DIM SHARED lX, lY, rXx, rY, mX, mY, ballX AS INTEGER, ballY AS INTEGER, m&, leftplr, rightplr
m& = _NEWIMAGE(320, 240, 32)
lX = 10: lY = 10: rxX = 310: rY = 10
ballX = 160: ballY = 10: mY = -1: IF RND * 10 > 5 THEN mX = 1 ELSE mX = -1
DIM SHARED dub AS LONG, aluminium as long



print "Loading textures..."
extractpmf ("textures.pmf")

aluminium& = hload("alum.jpg")
podl& = Hload("plovoucka.jpg")
str& = strop&
tokno& = okno&
dvere& = spajz_dvere&
lednice& = Hload("lednice2.jpg")
orech& = Hload("dekor orech.jpg")
orechsv& = Zesvetli("dekor orech.jpg")
polstr& = Hload("polstr.jpg")
dub& = Hload("dub.jpg")
tdub& = Ztmav("dub.jpg")

pc& = SHload("pccs.png")
kbd& = SHload("kbd.jpg")
mys& = SHload("mys.jpg")
woof& = SHload("repro.png")
speak& = Hload("speaker.jpg")
dlazba& = Hload("obklad.jpg")
dlazba2& = Hload("obklad 2.jpg")
sporakcelo = Hload("sporak-celo.jpg")
sporakvrch = Hload("sporak-vrch.jpg")
mikro& = SHload("mikro2.jpg")


DIM O AS _FLOAT
DIM SHARED N
SCREEN _NEWIMAGE(800, 600, 32)
_fullscreen

CX = 0: CY = 0: CZ = -1 '
N = 1116 'used quads (also this room contains 2232 triangles)


TYPE V
    X AS SINGLE '                                                                  source X points in standard view
    Y AS SINGLE '                                                                  source Y points in standard view
    Z AS SINGLE '                                                                  not use yet
    pi AS SINGLE '                                                                 start draw position on radius
    piH as single '
    Radius AS SINGLE '                                                             radius (every point use own, but if is CX and CY in middle, are all the same)
    RadiusH as single
    wX AS SINGLE '                                                                 working coordinates
    wY AS SINGLE
    wZ AS SINGLE

    T AS LONG '                                                                    texture number for current triangle
    Tm AS SINGLE '                                                                 texture multiplicier. 1 for one.
END TYPE


DIM SHARED v(1 TO N) AS V

'         A          B        C         D
DATA -10,-2,-5,-10,-2,10,10,-2,-5,10,-2,10: ' floor coordinates
DATA -10,2,-5,-10,2,10,10,2,-5,10,2,10: '     roof coordinates
DATA -10,-2,-5,-10,-2,10,-10,2,-5,-10,2,10: ' wall + window
DATA -5,-2,8,-10,-2,8,-5,2,8,-10,2,8
'refrigerator
DATA -5,-2,8,-5,-2.1,10,-5,2.1,8,-5,2,10
DATA -5,-3,10,10,-3,10,-5,3,10,10,3,10
DATA -4.8,-2,8,-3,-2,8,-4.8,1,8,-3,1,8
DATA -5,1,8,-3,1,8,-5,1,10,-3,1,10
DATA -3,1,8,-3,1,10,-3,-2,8,-3,-2,10
DATA -4.8,1,8,-4.8,1,10,-4.8,-2,8,-4.8,-2,10
'bench
DATA -2.8,-1.5,8,-2.8,-1.5,9,-2.8,-2,8,-2.8,-2,9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9.6,7.7,-.3,9.7,7.7,1,9.7
DATA 9.7,-.3,8.6,9.7,-.5,8.6,7.7,-.3,9.7,7.7,-.5,9.7
DATA 9.2,-.49,8.6,8.2,-.49,8.6,9.2,-.49,10,8.2,-.49,10
'keyboard
DATA 6.5,-.45,7.9,5.7,-.45,7.9,6.5,-.39,8.2,5.7,-.39,8.2: 'just shifted in space a 2D texture, not really 3D
DATA 5.3,-.45,7.9,5,-.45,7.9,5.3,-.39,8,5,-.39,8: 'mouse - as keyboard
'subwoofer
DATA 7.4,-2,9.8,7.4,-2,9,7.4,-1.5,9.8,7.4,-1.5,9
DATA 7,-2,9.8,7,-2,9,7,-1.5,9.8,7,-1.5,9
DATA 7.4,-2,9.8,7,-2,9.8,7.4,-1.5,9.8,7,-1.5,9.8
DATA 7.4,-1.5,9.8,7,-1.5,9.8,7.4,-1.5,9,7,-1.5,9
DATA 7.4,-2,9,7,-2,9,7.4,-1.5,9,7,-1.5,9
'speaker right
DATA 4.7,-.5,10,4.7,0,10,4.7,-.5,9.7,4.7,0,9.7
DATA 4.41,-.5,10,4.41,0,10,4.41,-.5,9.7,4.41,0,9.7
DATA 4.41,0,10,4.41,0,9.7,4.7,0,10,4.7,0,9.7
DATA 4.7,-.5,9.7,4.41,-.5,9.7,4.7,0,9.7,4.41,0,9.7
'speaker left
DATA 6.7,-.5,10,6.7,0,10,6.7,-.5,9.7,6.7,0,9.7
DATA 6.41,-.5,10,6.41,0,10,6.41,-.5,9.7,6.41,0,9.7
DATA 6.41,0,10,6.41,0,9.7,6.7,0,10,6.7,0,9.7
DATA 6.7,-.5,9.7,6.41,-.5,9.7,6.7,0,9.7,6.41,0,9.7

'wall with kitchen unit, again walls with doors first
DATA 10,-2,-5,5,-2,-5,10,2,-5,5,2,-5
DATA -10,-2,-4.99,7,-2,-4.99,-10,1,-4.99,7,1,-4.99
DATA -10,2,-4.99,7,2,-4.99,-10,1,-4.99,7,1,-4.99
DATA 5,-2,-3.5,7,-2,-3.5,5,-0.5,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.69,-3.5,-.1,-4.69,-3.2,-.2,-4.69,-3.5,-.2,-4.69
DATA -3.2,-.1,-4.69,-3.2,-.2,-4.69,-3.2,-.1,-4.89,-3.2,-.2,-4.89
DATA -3.5,-.1,-4.69,-3.5,-.2,-4.69,-3.5,-.1,-4.89,-3.5,-.2,-4.89

DATA -10.1,-2,-4.9,4.9,-2,-4.9,-10.1,-.49,-4.9,4.9,-.49,-4.9
DATA -10.1,-1.99,-5,4.9,-1.99,-5,-10.1,-1.99,-3.7,4.9,-1.99,-3.7
DATA -10.1,.8,-4.9,4.9,.8,-4.9,-10.1,1.6,-4.9,4.9,1.6,-4.9
'cabinet doors
DATA 1.85,1.55,-3.71,1.85,0.6,-3.71,2.8,1.55,-3.71,2.8,0.6,-3.71
DATA 1.85,-1.9,-3.71,1.85,-0.6,-3.71,2.8,-1.9,-3.71,2.8,-.6,-3.71
DATA 2.85,1.55,-3.71,2.85,0.6,-3.71,3.8,1.55,-3.71,3.8,0.6,-3.71
DATA 2.85,-1.9,-3.71,2.85,-0.6,-3.71,3.8,-1.9,-3.7,3.8,-.6,-3.71
DATA 3.85,1.55,-3.71,3.85,0.6,-3.71,4.8,1.55,-3.71,4.8,0.6,-3.71
DATA 3.85,-1.9,-3.71,3.85,-0.6,-3.71,4.8,-1.9,-3.71,4.8,-.6,-3.71
DATA .85,1.55,-3.71,.85,0.6,-3.71,1.8,1.55,-3.71,1.8,0.6,-3.71
DATA .85,-1.9,-3.71,.85,-0.6,-3.71,1.8,-1.9,-3.71,1.8,-.6,-3.71
DATA -1.85,1.55,-3.71,-1.85,0.6,-3.71,-2.8,1.55,-3.71,-2.8,0.6,-3.71
DATA -1.85,-1.9,-3.71,-1.85,-0.6,-3.71,-2.8,-1.9,-3.71,-2.8,-.6,-3.71
DATA -2.85,1.55,-3.71,-2.85,0.6,-3.71,-3.8,1.55,-3.71,-3.8,0.6,-3.71
DATA -2.85,-1.9,-3.71,-2.85,-0.6,-3.71,-3.8,-1.9,-3.7,-3.8,-.6,-3.71
DATA -3.85,1.55,-3.71,-3.85,0.6,-3.71,-4.8,1.55,-3.71,-4.8,0.6,-3.71
DATA -3.85,-1.9,-3.71,-3.85,-0.6,-3.71,-4.8,-1.9,-3.71,-4.8,-.6,-3.71
DATA -.85,1.55,-3.71,-.85,0.6,-3.71,-1.8,1.55,-3.71,-1.8,0.6,-3.71
DATA -.85,-1.9,-3.71,-.85,-0.6,-3.71,-1.8,-1.9,-3.71,-1.8,-.6,-3.71
DATA -4.85,1.55,-3.71,-4.85,0.6,-3.71,-5.8,1.55,-3.71,-5.8,0.6,-3.71
DATA -4.85,-1.9,-3.71,-4.85,-0.6,-3.71,-5.8,-1.9,-3.7,-5.8,-.6,-3.71
DATA -5.85,1.55,-3.71,-5.85,0.6,-3.71,-6.8,1.55,-3.71,-6.8,0.6,-3.71
DATA -5.85,-1.9,-3.71,-5.85,-0.6,-3.71,-6.8,-1.9,-3.71,-6.8,-.6,-3.71
DATA -6.85,1.55,-3.71,-6.85,0.6,-3.71,-7.8,1.55,-3.71,-7.8,0.6,-3.71
DATA -6.85,-1.9,-3.71,-6.85,-0.6,-3.71,-7.8,-1.9,-3.71,-7.8,-.6,-3.71
DATA -9.98,-2,-5,-9.98,1,-5,-9.98,-2,0,-9.98,1,0
DATA -9.97,-0.5,-3.4,-8.47,-.5,-3.4,-9.97,-0.5,0,-8.47,-.5,0
DATA -9.97,-0.6,-3.4,-8.47,-.6,-3.4,-9.97,-0.6,0,-8.47,-.6,0
DATA -9.97,.6,-3.7,-8.77,.6,-3.7,-9.97,.6,0,-8.77,.6,0
DATA -9.97,.7,-3.7,-8.77,.7,-3.7,-9.97,.7,0,-8.77,.7,0
DATA -9.97,1.6,-3.7,-8.77,1.6,-3.7,-9.97,1.6,0,-8.77,1.6,0
DATA -9.97,1.7,-3.7,-8.77,1.7,-3.7,-9.97,1.7,0,-8.77,1.7,0
DATA -9.97,-2,0,-8.77,-2,0,-9.97,-0.6,0,-8.77,-0.6,0
DATA -9.97,1.6,0,-8.77,1.6,0,-9.97,0.7,0,-8.77,0.7,0
DATA -9.97,-2,-.2,-8.77,-2,-.2,-9.97,-0.6,-.2,-8.77,-0.6,-.2
DATA -9.97,1.6,-.2,-8.77,1.6,-.2,-9.97,0.7,-.2,-8.77,0.7,-.2
DATA -9.97,1.7,0,-8.77,1.7,0,-9.97,1.6,0,-8.77,1.6,0
DATA -9.97,-.5,0,-8.47,-.5,0,-9.97,-.6,0,-8.47,-.6,0
DATA -9.97,.6,0,-8.77,.6,0,-9.97,.7,0,-8.77,.7,0
DATA -8.77,1.7,0,-8.77,1.6,0,-8.77,1.7,-3.7,-8.77,1.6,-3.7
DATA -8.47,-.5,0,-8.47,-.6,0,-8.47,-0.5,-3.7,-8.47,-0.6,-3.7
DATA -8.77,.7,0,-8.77,.6,0,-8.77,.7,-3.7,-8.77,.6,-3.7
DATA -8.77,-2,0,-8.77,-.6,0,-8.77,-2,-0.2,-8.77,-.6,-0.2
DATA -8.77,1.6,0,-8.77,.7,0,-8.77,1.6,-0.2,-8.77,.7,-0.2
DATA -8.77,-2,-1.9,-8.77,-.6,-1.9,-8.77,-2,-2,-8.77,-.6,-2
DATA -8.77,1.6,-1.9,-8.77,.7,-1.9,-8.77,1.6,-2,-8.77,.7,-2
DATA -8.77,-1.99,0,-9.97,-1.99,0,-8.77,-1.99,-3.7,-9.97,-1.99,-3.7
DATA -9.97,-2,0,-9.97,-2,-4.9,-9.97,-.5,0,-9.97,-.5,-4.9
dATA -9.97,1.6,0,-9.97,1.6,-4.9,-9.97,.6,0,-9.97,.6,-4.9
DATA -8.77,-2,-3.7,-8.77,-.6,-3.7,-8.77,-2,-3.6,-8.77,-.6,-3.6
DATA -8.77,1.6,-3.7,-8.77,.7,-3.7,-8.77,1.6,-3.6,-8.77,.7,-3.6

DATA -8.77,-1.9,-2,-8.77,-.6,-2,-8.77,-1.9,-3.6,-8.77,-.6,-3.6
DATA -8.77,1.6,-2,-8.77,.7,-2,-8.77,1.6,-3.6,-8.77,.7,-3.6

DATA -8.77,-1.9,-.2,-8.77,-.6,-.2,-8.77,-1.9,-1.9,-8.77,-.6,-1.9
DATA -8.77,1.6,-.2,-8.77,.7,-.2,-8.77,1.6,-1.9,-8.77,.7,-1.9: 'glased doors
dATA -7.85,1.55,-3.71,-7.85,0.6,-3.71,-8.8,1.55,-3.71,-8.8,0.6,-3.71
DATA -7.85,-1.9,-3.71,-7.85,-0.6,-3.71,-8.8,-1.9,-3.71,-8.8,-.6,-3.71
DATA .85,1.55,-3.71,.85,0.6,-3.71,-.85,1.55,-3.71,-.85,0.6,-3.71
DATA .85,-1.9,-3.71,.85,-0.6,-3.71,-.85,-1.9,-3.71,-.85,-.6,-3.71

'microwave

DATA -9,-.5,-4.1,-8,-.5,-4.1,-9,0,-4.1,-8,0,-4.1
DATA -9,-.5,-4.9,-8,-.5,-4.9,-9,0,-4.9,-8,0,-4.9
DATA -9,0,-4.1,-8,0,-4.1,-9,0,-4.9,-8,0,-4.9
DATA -9,0,-4.1,-9,-.5,-4.1,-9,0,-4.9,-9,-.5,-4.9
DATA -8,0,-4.1,-8,-.5,-4.1,-8,0,-4.9,-8,-.5,-4.9



FOR r = 1 TO N
   READ v(r).X, v(r).Y, v(r).Z 'all is placed on the same Y = the same floor
NEXT r

Set_texture podl&, 1, 4, 15 'set image img as texture for bottom  (triangles 1 to 4)
Set_texture str&, 5, 8, 3
Set_texture tokno&, 9, 12, 1
Set_texture dvere&, 13, 16, 1
Set_texture white&, 17, 20, 1
Set_texture white&, 21, 24, 1 'wall at pc
Set_texture lednice&, 25, 28, 1
Set_texture white&, 29, 32, 1
Set_texture Swhite&, 33, 36, 1
Set_texture Swhite&, 37, 40, 1
Set_texture orech&, 41, 44, 10
Set_texture orech&, 45, 48, 10

Set_texture orech&, 49, 52, 10
Set_texture orech&, 53, 56, 10
Set_texture orech&, 57, 60, 10
Set_texture orech&, 61, 64, 10
Set_texture polstr&, 65, 68, 3

Set_texture polstr&, 69, 72, 3
Set_texture polstr&, 73, 76, 3
Set_texture polstr&, 77, 80, 3
Set_texture orech&, 81, 84, 10
Set_texture orech&, 85, 88, 10
Set_texture orech&, 89, 92, 10
Set_texture orech&, 93, 96, 3
Set_texture orech&, 97, 100, 3
Set_texture orech&, 101, 104, 1
Set_texture orech&, 105, 108, 1
Set_texture orech&, 109, 112, 1
Set_texture orech&, 113, 116, 7

Set_texture orech&, 117, 120, 1
Set_texture orech&, 121, 204, 2
Set_texture orechsv&, 205, 220, 1
Set_texture orech&, 221, 292, 1

Set_texture orechsv&, 293, 308, 1
Set_texture orech&, 309, 316, 1
Set_texture orechsv&, 317, 328, 1
Set_texture orech&, 329, 400, 1
Set_texture orechsv&, 401, 416, 1
Set_texture orech&, 417, 424, 1
Set_texture orechsv&, 425, 432, 1
'po upgradu
Set_texture white&, 433, 437, 1 'wall
Set_texture dvere&, 437, 440, 1
Set_texture white&, 441, 444, 1
Set_texture dub&, 445, 453, 1 'pc desk
Set_texture tdub&, 454, 462, 1 'pc desk back
Set_texture dub&, 463, 480, 1
Set_texture tdub&, 481, 484, 1
Set_texture dub&, 485, 492, 1
Set_texture tdub&, 493, 512, 1
Set_texture dub&, 513, 520, 1
Set_texture Black&, 521, 524, 1
Set_texture SBlack&, 525, 528, 1
Set_texture Black&, 529, 532, 1
Set_texture pc&, 533, 536, 1
Set_texture SBlack&, 537, 540, 1 'MONITOR
Set_texture Black&, 541, 548, 1 'MONITOR
Set_texture Noha&, 549, 552, 1 'MONITOR
Set_texture Black&, 553, 556, 1
Set_texture kbd&, 557, 560, 1 'keyboard
Set_texture mys&, 561, 564, 1 'keyboard
Set_texture Black, 565, 576, 1 'woof
Set_texture SBlack, 577, 580, 1 'subwoofer
Set_texture woof&, 581, 584, 1 'subwoofer
Set_texture Black, 585, 596, 1 'speakers
Set_texture speak&, 597, 600, 1
Set_texture Black, 601, 612, 1
Set_texture speak&, 613, 616, 1
'strana s linkou
Set_texture dvere&, 617, 620, 1 'doors
Set_texture dlazba&, 621, 624, 10
Set_texture white&, 625, 628, 1
Set_texture sporakcelo, 629, 632, 1
Set_texture sporakvrch, 633, 636, 1
Set_texture white&, 637, 648, 1
Set_texture dub&, 649, 652, 1
Set_texture tdub&, 653, 656, 5
Set_texture dub&, 657, 676, 5
Set_texture tdub&, 677, 680, 5
Set_texture dub&, 681, 796, 5
Set_texture tdub&, 797, 800, 5
Set_texture dub&, 801, 809, 5
Set_texture dub&, 809, 812, 5
Set_texture tdub&, 813, 816, 5
Set_texture tdub&, 817, 820, 5
Set_texture Silver&, 821, 836, 1
Set_texture SilverC&, 837, 840, 1
Set_texture SilverB&, 841, 860, 1
Set_texture dub&, 861, 872, 1
Set_texture tdub&, 873, 960, 1
Set_texture dlazba2&, 961, 964, 10
Set_texture tdub&, 965, 1004, 1
Set_texture dub&, 1005, 1064, 1
Set_texture tdub&, 1065, 1076, 1
Set_texture Sklo&, 1077, 1080, 1
Set_texture tdub&, 1081, 1096, 1
Set_texture mikro&, 1097, 1100, 1
Set_texture SilverB&, 1101, 1116, 1


valec -1, -.8, 4.7, -.6, 10, SilverB& ' vase
valec 6, -.5, 9, -.35, 10, Silver&

valec -3.35, -.2, -4.8, -.3, 40, SilverB& 'water pipe
Zvalec -3.35, -.3, -4.8, -4.1, 40, SilverB& 'water pipe
valec -3.35, -.29, -4.1, -.4, 40, SilverB& 'water pipe


'this three vase are in cabinet with glased door
talir -9.1, .8, -1.45
talir -9.1, .8, -1.05
talir -9.1, .8, -.65

'cabinet handles
madlo -7.9,   .8,  -3.6
madlo -7.45,  .8,  -3.6
madlo -7.9, -.8,  -3.4
madlo -7.45,-.8,  -3.4

madlo -6,   -.8,  -3.4
madlo -5.45,-.8,  -3.4
madlo -6,     .8,  -3.6
madlo -5.45,  .8,  -3.6

madlo -4.1, -.8  ,-3.4
madlo -3.45,-.8,  -3.4
madlo -4.1,   .8,  -3.6
madlo -3.45,  .8,  -3.6

madlo -2.2, -.8  ,-3.4
madlo -1.45,-.8,  -3.4
madlo -2.2,   .8,  -3.6
madlo -1.45,  .8,  -3.6

madlo -.3, -.8  ,-3.4
madlo -.3,   .8,  -3.6
madlo 1,-.8,  -3.4
madlo 1,  .8,  -3.6
madlo 2,-.8,  -3.4
madlo 2,  .8,  -3.6
madlo 3,-.8,  -3.4
madlo 3,  .8,  -3.6
madlo 4,-.8,  -3.4
madlo 4,  .8,  -3.6
madlo 8.5, -1, 7.9
madlo 8.5, -1.3, 7.9
zmadlo -8.77,.8,-1
zmadlo -8.77,.8,-2.75
zmadlo -8.77,-.8,-1
zmadlo -8.77,-.8,-2.75

minRadius = 1000
    DO
        i$ = INKEY$
        start = 0
        FOR r = 1 TO N
            LenX = v(r).X - CX
            LenY = v(r).Y - CY
            LenZ = v(r).Z - CZ

            radius = SQR(LenX ^ 2 + LenZ ^ 2)
            if minradius < .4 then minradius = 1000
            if minradius > radius then minradius = radius
            radiusH =  sqr(lenY^2 + lenz^2)
            v(r).Radius = radius
            v(r).radiusH = radiusH
            v(r).pi = JK!(CX, CZ, v(r).X, v(r).Z, radius)
            v(r).pih = jk! (cy,cz,v(r).y, v(r).z, radiusH)
           NEXT r
      IF ABS(rot) > _PI(2) THEN rot = 0
    oldposZ = posZ
    oldposX = posX
    SELECT CASE i$
        CASE CHR$(0) + CHR$(72): posz = posz + COS(rot) / 2: posx = posx + -sin(rot) / 2: posy = posy  + -sin(roth)/2 'up
        CASE CHR$(0) + CHR$(80): posz = posz - COS(rot) / 2: posx = posx - -sin(rot) / 2 : posy = posy - -sin(roth)/2 'dn
        CASE CHR$(0) + CHR$(75): rot = rot - .05
        CASE CHR$(0) + CHR$(77): rot = rot + .05
        case chr$(27) : destructor ("textures.pmf") : system
        END SELECT

'------------------------------
iF posz > 3 THEN posz = 3
IF posz < -7 THEN posz = -7
IF posx < -7 THEN posx = -7
IF posx > 7 THEN posx = 7


select case posX
case -7 to -5: if posZ < -7 then posX = oldposx: posz = oldposz
case -5 to 3: if posZ < -2 then posX = oldposx: posz = oldposz
case 3 to 6: if posZ< -7 then posX = oldposx: posz = oldposz
end select
'-----------------------------
    CZ = -posz
    CX = -posx
    CY = -posY

    FOR r = 1 TO N
        x = CX + SIN(rot + v(r).pi) * v(r).Radius
        y = CY + sin (rotH + v(r).piH) * v(r).radiusH
        z =  CZ + cos(rot +v(r).pi) * v(r).Radius
        v(r).wX = x + posx
        v(r).wY = y + posY
        v(r).wZ = z + posz
    NEXT r
    minigame
    m33& = _COPYIMAGE(m&, 33)
    Set_texture m33&, 537, 540, 1

    FOR zz = 1 TO N STEP 4
         IF v(zz).T THEN
            img& = v(zz).T
            w = _WIDTH(img&)
            h = _HEIGHT(img&)
            num = v(zz).Tm
            IF num = 0 THEN num = 1
            _MAPTRIANGLE (0, h * num)-(w * num, h * num)-(0, 0), img& TO(v(zz).wX, v(zz).wY, v(zz).wZ)-(v(zz + 1).wX, v(zz + 1).wY, v(zz + 1).wZ)-(v(zz + 2).wX, v(zz + 2).wY, v(zz + 2).wZ), 0, _SMOOTH
            _MAPTRIANGLE (w * num, h * num)-(0, 0)-(w * num, 0), img& TO(v(zz + 1).wX, v(zz + 1).wY, v(zz + 1).wZ)-(v(zz + 2).wX, v(zz + 2).wY, v(zz + 2).wZ)-(v(zz + 3).wX, v(zz + 3).wY, v(zz + 3).wZ), 0, _SMOOTH
        END IF
    NEXT zz

REM    infobox posx, posy, posz, rot, minradius

    _DISPLAY
    _FREEIMAGE m33&
    _LIMIT 30
LOOP


sub INFOBOX (posx, posy, posz, rot, u)
nfo& = _newimage (640, 480, 32)
W = 639 : H = 479: X = -.5: Y = 0 : Z = -1
de = _dest
_dest nfo&
color _rgb32(22, 61, 78)
_printmode _keepbackground
print "INFOBOX:"
print "Position X: "; posx
print "Position Y: "; posy
print "Position Z: "; posz
print "Angle: "; abs(_r2d(rot))
print u

_clearcolor _rgb32 (0,0,0)
_dest de
hnfo& = _copyimage (nfo&, 33)
_freeimage nfo&
_maptriangle (0,0) - (w, 0) - (0, h), hnfo& to (-2+x, 2+Y, -2+z) - (2+x, 2+y, -2+z) - (-2+x, -2+y, -2+z)
_maptriangle (w, 0) - (0, h) - (w,h), hnfo& to (2+x, 2+y, -2+z) - (-2+x, -2+y, -2+z) - (2+x, -2+y, -2+z)

_freeimage hnfo&
end sub




sub madlo (x,y,z)
tt = UBOUND(v) + 1
REDIM _PRESERVE v(1 TO tt - 1 + 12) AS V
N = N + 12
if sgn(x)>= 0 then x2 = x + .2 else x2 = x -.2
if sgn(y) =>0 then y2 = y + .05 else y2 = y -.05
if sgn(z) < 0 then z2 = z -.1 else z2 = z + .1

 v(tt).x = x
 v(tt).y = y
 v(tt).z = z

 v(tt+1).x = x
 v(tt+1).y = y2
 v(tt+1).z = z

 v(tt+2).x = x2
 v(tt+2).y = y
 v(tt+2).z = z

 v(tt+3).x = x2
 v(tt+3).y = y2
 v(tt+3).z = z

'------------

 v(tt+4).x = x
 v(tt+4).y = y
 v(tt+4).z = z

 v(tt+5).x = x
 v(tt+5).y = y2
 v(tt+5).z = z

 v(tt+6).x = x
 v(tt+6).y = y
 v(tt+6).z = z2

 v(tt+7).x = x
 v(tt+7).y = y2
 v(tt+7).z = z2

'------------

 v(tt+8).x = x2
 v(tt+8).y = y
 v(tt+8).z = z

 v(tt+9).x = x2
 v(tt+9).y = y2
 v(tt+9).z = z

 v(tt+10).x = x2
 v(tt+10).y = y
 v(tt+10).z = z2

 v(tt+11).x = x2
 v(tt+11).y = y2
 v(tt+11).z = z2

 set_texture aluminium&, tt-1, tt+11,1

end sub


sub Zmadlo (x,y,z)
    tt = UBOUND(v) + 1
    REDIM _PRESERVE v(1 TO tt - 1 + 12) AS V
    N = N + 12

if sgn(z)<= 0 then z2 = z - .2 else z2 = z +.2
if sgn(y) =>0 then y2 = y + .05 else y2 = y -.05
if sgn(x) <= 0 then x2 = x+.1 else x2 = x - .1

'predni obdelnik
 v(tt).x = x2
 v(tt).y = y
 v(tt).z = z

 v(tt+1).x = x2
 v(tt+1).y = y2
 v(tt+1).z = z

 v(tt+2).x = x2
 v(tt+2).y = y
 v(tt+2).z = z2

 v(tt+3).x = x2
 v(tt+3).y = y2
 v(tt+3).z = z2

'------------

 v(tt+4).x = x
 v(tt+4).y = y2
 v(tt+4).z = z

 v(tt+5).x = x2
 v(tt+5).y = y2
 v(tt+5).z = z

 v(tt+6).x = x
 v(tt+6).y = y
 v(tt+6).z = z

 v(tt+7).x = x2
 v(tt+7).y = y
 v(tt+7).z = z

'------------

 v(tt+8).x = x
 v(tt+8).y = y2
 v(tt+8).z = z2

 v(tt+9).x = x2
 v(tt+9).y = y2
 v(tt+9).z = z2

 v(tt+10).x = x
 v(tt+10).y = y
 v(tt+10).z = z2

 v(tt+11).x = x2
 v(tt+11).y = y
 v(tt+11).z = z2

  set_texture aluminium&, tt-1, tt+11,1
end sub

SUB Set_texture (num, start, eend, much)
    FOR s = start TO eend
        v(s).T = num
        v(s).Tm = much
    NEXT s
END SUB


FUNCTION Hload& (fileName AS STRING)
    h& = _LOADIMAGE(fileName$, 32)
    Hload& = _COPYIMAGE(h&, 33)
    _FREEIMAGE h&
END FUNCTION


FUNCTION SHload& (fileName AS STRING)
    h& = _LOADIMAGE(fileName$, 32)
    _SETALPHA 0, _RGB32(255, 255, 255) TO _RGB32(200, 200, 200), h&
    SHload& = _COPYIMAGE(h&, 33)
    _FREEIMAGE h&
END FUNCTION

FUNCTION strop&
    lamp& = _LOADIMAGE("bodovka mala.jpg", 32)
    strop& = _NEWIMAGE(1024, 768, 32)
    de = _DEST
    _DEST strop&
    CLS , _RGB32(255, 255, 255)
    rX = 1024 / 4
    rY = 768 / 3
    FOR x = rX TO 1024 - rX STEP rX
        FOR y = rY TO 768 - rY STEP rY
            _PUTIMAGE (rX, rY), lamp&, strop&
    NEXT y, x
    _DEST de
    _FREEIMAGE lamp&
    strop& = _COPYIMAGE(strop&, 33)
END FUNCTION

FUNCTION okno&
    ok& = _LOADIMAGE("okn.jpg", 32)
    topco& = _LOADIMAGE("topco.jpg", 32)
    okno& = _NEWIMAGE(1024, 512, 32)
    de = _DEST
    _DEST okno&
    CLS , _RGB32(250, 245, 255)
    _PUTIMAGE (512 - 150, 206 - 132), ok&, okno&

    _PUTIMAGE (380, 370), topco&, okno&
    _DEST de
    _FREEIMAGE ok&
    _FREEIMAGE topco&
    okno& = _COPYIMAGE(okno&, 33)
END FUNCTION

FUNCTION white&
    IF white& = 0 THEN
        whit& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST whit&
        CLS , _RGB32(250, 240, 250)
        _DEST de
        white& = _COPYIMAGE(whit&, 33)
        _FREEIMAGE whit&
    END IF
END FUNCTION

FUNCTION Swhite&
    IF Swhite& = 0 THEN
        whit& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST whit&
        CLS , _RGB32(255, 255, 255)
        _DEST de
        Swhite& = _COPYIMAGE(whit&, 33)
        _FREEIMAGE whit&
    END IF
END FUNCTION


FUNCTION Braun&
    IF Braun& = 0 THEN
        brau& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST brau&
        CLS , _RGB32(111, 17, 39)
        _DEST de
        Braun& = _COPYIMAGE(brau&, 33)
        _FREEIMAGE brau&
    END IF
END FUNCTION


FUNCTION Black&
    IF Black& = 0 THEN
        blk& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST blk&
        CLS , _RGB32(6, 17, 28)
        _DEST de
        Black& = _COPYIMAGE(blk&, 33)
        _FREEIMAGE blk&
    END IF
END FUNCTION

FUNCTION SBlack&
    IF SBlack& = 0 THEN
        blk& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST blk&
        CLS , _RGB32(33, 28, 28)
        _DEST de
        SBlack& = _COPYIMAGE(blk&, 33)
        _FREEIMAGE blk&
    END IF
END FUNCTION

FUNCTION Silver&
    IF Silver& = 0 THEN
        blk& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST blk&
        e = 127 / 100
        FOR l = 0 TO 99
            LINE (0, l)-(99, l), _RGB32(255 - f, 255 - f, 255 - f)
            f = f + e
        NEXT l
        _DEST de
        Silver& = _COPYIMAGE(blk&, 33)
        _FREEIMAGE blk&
    END IF
END FUNCTION

FUNCTION SilverB&
    IF SilverB& = 0 THEN
        blk& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST blk&
        e = 127 / 50
        FOR l = 0 TO 50
            LINE (l, l)-(100 - l, 100 - l), _RGB32(127 + f, 127 + f, 127 + f), B
            f = f + e
        NEXT l
        _DEST de
        SilverB& = _COPYIMAGE(blk&, 33)
        _FREEIMAGE blk&
    END IF
END FUNCTION


FUNCTION SilverC&
    IF SilverC& = 0 THEN
        blk& = _NEWIMAGE(100, 100, 32)
        de = _DEST
        _DEST blk&
        e = 127 / 50
        FOR l = 0 TO 50
            LINE (l, l)-(100 - l, 100 - l), _RGB32(255 - f, 255 - f, 255 - f), B
            f = f + e
        NEXT l
        _DEST de
        SilverC& = _COPYIMAGE(blk&, 33)
        _FREEIMAGE blk&
    END IF
END FUNCTION


FUNCTION spajz_dvere&
    dv& = _LOADIMAGE("dvere.jpg", 32) '192 x 426
    de = _DEST
    spajz_dvere32& = _NEWIMAGE(640, 480, 32)
    _DEST spajz_dvere32&
    CLS , _RGB32(241, 244, 251)
    _PUTIMAGE (140, 54), dv&
    _DEST de
    spajz_dvere& = _COPYIMAGE(spajz_dvere32&, 33)
    _FREEIMAGE spajz_dvere32&
END FUNCTION

FUNCTION Zesvetli& (file AS STRING)
    t& = _LOADIMAGE(file$, 32)
    IF Zesvetli& < -1 THEN _FREEIMAGE Zesvetli&
    w = _WIDTH(t&)
    h = _HEIGHT(t&)
    zesvetli32& = _NEWIMAGE(w, h, 32)
    de = _DEST
    _DEST zesvetli32&
    _PUTIMAGE , t&, zesvetli32&
    LINE (0, 0)-(w - 1, h - 1), _RGBA32(255, 255, 255, 30), BF
    _DEST de

    Zesvetli& = _COPYIMAGE(zesvetli32&, 33)
    _FREEIMAGE t&
    _FREEIMAGE zesvetli32&
END FUNCTION

FUNCTION Ztmav& (file AS STRING)
    t& = _LOADIMAGE(file$, 32)
    IF Ztmav& < -1 THEN _FREEIMAGE Ztmav&
    w = _WIDTH(t&)
    h = _HEIGHT(t&)
    ztmav32& = _NEWIMAGE(w, h, 32)
    de = _DEST
    _DEST ztmav32&
    _PUTIMAGE , t&, ztmav32&
    LINE (0, 0)-(w - 1, h - 1), _RGBA32(0, 0, 0, 30), BF
    _DEST de

    Ztmav& = _COPYIMAGE(ztmav32&, 33)
    _FREEIMAGE t&
    _FREEIMAGE ztmav32&
END FUNCTION

FUNCTION Noha&
    IF Noha& = 0 THEN
        de = _DEST
        noh& = _NEWIMAGE(100, 100, 32)
        _DEST noh&
        LINE (0, 40)-(100, 60), _RGB32(0, 22, 32), BF
        _CLEARCOLOR _RGB32(0, 0, 0), noh&
        _DEST de
        Noha& = _COPYIMAGE(noh&, 33)
        _FREEIMAGE noh&
    END IF
END FUNCTION

FUNCTION Noha2&
    IF Noha2& = 0 THEN
        de = _DEST
        noh& = _NEWIMAGE(100, 100, 32)
        _DEST noh&
        LINE (30, 30)-(70, 70), _RGB32(0, 2, 12), BF
        _CLEARCOLOR _RGB32(0, 0, 0), noh&
        _DEST de
        Noha2& = _COPYIMAGE(noh&, 33)
        _FREEIMAGE noh&
    END IF
END FUNCTION


FUNCTION JK! (cx, cy, px, py, R)' based on binary circle definition
    LenX = cx - px
    LenY = cy - py
    jR = 1 / R

    jX = LenX * jR
    jY = LenY * jR

    sinusAlfa = jX
    Alfa = ABS(_ASIN(sinusAlfa))

    Q = 1
    IF px >= cx AND py =< cy THEN Q = 1 ' select angle to quadrant
    IF px >= cx AND py =< cy THEN Q = 2
    IF px =< cx AND py <= cy THEN Q = 3
    IF px =< cx AND py >= cy THEN Q = 4
    SELECT CASE Q
        CASE 1: alfaB = Alfa
        CASE 2: alfaB = _PI / 2 + (_PI / 2 - Alfa)
        CASE 3: alfaB = _PI + Alfa
        CASE 4: alfaB = _PI(1.5) + (_PI / 2 - Alfa)
    END SELECT
    JK! = alfaB
END FUNCTION

SUB valec (xs, ys, zs, ye, R, t&)
    tt = UBOUND(v) + 1
    polomer = R
    REDIM _PRESERVE v(1 TO tt - 1 + 64) AS V
    polo = _PI(2) / 16
    N = N + 64

    FOR s = 0 TO _PI(2) STEP polo
        ott = tt
        v(tt).X = xs + SIN(s) / polomer
        v(tt).Y = ys
        v(tt).Z = zs + COS(s) / polomer
        tt = tt + 1
        v(tt).X = xs + SIN(s) / polomer
        v(tt).Y = ye
        v(tt).Z = zs + COS(s) / polomer
        tt = tt + 1
        v(tt).X = xs + SIN(s + polo) / polomer
        v(tt).Y = ys
        v(tt).Z = zs + COS(s + polo) / polomer
        tt = tt + 1
        v(tt).X = xs + SIN(s + polo) / polomer
        v(tt).Y = ye
        v(tt).Z = zs + COS(s + polo) / polomer
        Set_texture t&, ott, tt, 1
        tt = tt + 1
    NEXT
END SUB

SUB Zvalec (xs, ys, zs, ze, R, t&)
    tt = UBOUND(v) + 1
    polomer = R

    REDIM _PRESERVE v(1 TO tt - 1 + 64) AS V

    polo = _PI(2) / 16
    N = N + 64

    FOR s = 0 TO _PI(2) STEP polo
        ott = tt
        v(tt).X = xs + SIN(s) / polomer
        v(tt).Y = ys + COS(s) / polomer
        v(tt).Z = zs
        tt = tt + 1
        v(tt).X = xs + SIN(s) / polomer
        v(tt).Y = ys + COS(s) / polomer
        v(tt).Z = ze
        tt = tt + 1
        v(tt).X = xs + SIN(s + polo) / polomer
        v(tt).Y = ys + COS(s + polo) / polomer
        v(tt).Z = zs
        tt = tt + 1
        v(tt).X = xs + SIN(s + polo) / polomer
        v(tt).Y = ys + COS(s + polo) / polomer
        v(tt).Z = ze
        Set_texture t&, ott, tt, 1
        tt = tt + 1
    NEXT
END SUB

SUB talir (x, y, z)
    radius0 = 0
    radius1 = .05
    radius2 = .1
    radius3 = .2
    ys = -ABS(y)
    ye = y - .1
    ys2 = ye
    ye2 = y + .2

    tt = UBOUND(v) + 1
    REDIM _PRESERVE v(1 TO tt - 1 + 64) AS V '16 a 16
        polo = _PI(2) / 16
    N = N + 64

    FOR s = 0 TO _PI(2) STEP polo
        ott = tt
        IF SGN(x) >= 0 THEN v(tt).X = x + (SIN(s) * radius2 + SIN(s) * radius0) ELSE v(tt).X = x - (SIN(s) * radius2 - SIN(s) * radius0)
        v(tt).Y = ys2
        IF SGN(z) >= 0 THEN v(tt).Z = z + (COS(s) * radius2 + COS(s) * radius0) ELSE v(tt).Z = z - (COS(s) * radius2 - COS(s) * radius0)
        tt = tt + 1
        IF SGN(x) >= 0 THEN v(tt).X = x + (SIN(s) * radius3 + SIN(s) * radius1) ELSE v(tt).X = x - (SIN(s) * radius3 - SIN(s) * radius1)
        v(tt).Y = ye2
        IF SGN(z) >= 0 THEN v(tt).Z = z + (COS(s) * radius3 + COS(s) * radius1) ELSE v(tt).Z = z - (COS(s) * radius3 - COS(s) * radius1)
        tt = tt + 1
        IF SGN(x) >= 0 THEN v(tt).X = x + (SIN(s + polo) * radius2 + SIN(s + polo) * radius0) ELSE v(tt).X = x - (SIN(s + polo) * radius2 - SIN(s + polo) * radius0)
        v(tt).Y = ys2
        IF SGN(z) >= 0 THEN v(tt).Z = z + (COS(s + polo) * radius2 + COS(s + polo) * radius0) ELSE v(tt).Z = z - (COS(s + polo) * radius2 - COS(s + polo) * radius0)
        tt = tt + 1
        IF SGN(x) >= 0 THEN v(tt).X = x + (SIN(s + polo) * radius3 + SIN(s + polo) * radius1) ELSE v(tt).X = x - (SIN(s + polo) * radius3 - SIN(s + polo) * radius1)
        v(tt).Y = ye2
        IF SGN(z) >= 0 THEN v(tt).Z = z + (COS(s + polo) * radius3 + COS(s + polo) * radius1) ELSE v(tt).Z = z - (COS(s + polo) * radius3 - COS(s + polo) * radius1)
        tt = tt + 1
        Set_texture SilverC&, ott, tt - 1, 1
    NEXT
END SUB

FUNCTION Sklo&
    IF Sklo& = 0 THEN
        de = _DEST
        skl = _NEWIMAGE(150, 100, 32)
        _DEST skl
        alfa = 127 / 25
        a = 120
        FOR x = 1 TO 50
            a = a - alfa
            LINE (0, x)-(150, x), _RGBA32(127, 127, 127, a)
        NEXT x

        FOR x = 50 TO 100
            a = a + alfa
            LINE (0, x)-(150, x), _RGBA32(127, 127, 127, a)
        NEXT x
        _DEST de
        Sklo& = _COPYIMAGE(skl, 33)
        _FREEIMAGE skl
    END IF
END FUNCTION

SUB minigame
    de = _DEST
    _DEST m&
    CLS , _RGB32(127, 120, 120)
            IF ballX > 160 THEN
        IF rY + 25 < ballY THEN rY = rY + 1 ELSE rY = rY - 1
        IF ballX > (rxX - 10) THEN
            IF ballY > rY AND ballY < rY + 50 THEN mX = mX * -1
        END IF
    END IF

    IF ballX < 160 THEN
        IF lY + 25 < ballY THEN lY = lY + 1 ELSE lY = lY - 1
        IF ballX < 20 THEN

            IF ballY > lY AND ballY < lY + 50 THEN mX = mX * -1

        END IF
    END IF

    ballX = ballX + mX
    ballY = ballY + mY

    IF ballX > 315 THEN mX = mX * -1: rightplr = rightplr + 1: ballX = ballX + mX + SIN(_ATAN2(ballY, ballX))
    IF ballX < 5 THEN mX = mX * -1: leftplr = leftplr + 1: ballY = ballY + mY + COS(_ATAN2(ballY, ballX))

    IF ballY > 235 THEN mY = mY * -1 - _ATAN2(ballY, ballX) / 2: ballY = ballY + mY
    IF ballY < 5 THEN mY = mY * -1 + _ATAN2(ballY, ballX) / 2: ballY = ballY + mY


    IF ballY >= lY AND ballY <= lY + 60 AND ballX <= 10 THEN mY = mY * -1: ballY = ballY + mY - _ATAN2(ballY, ballX)
    IF ballY >= rY AND ballY <= rY + 60 AND ballX >= 300 THEN mY = mY * -1: ballY = ballY + mY + _ACOS(_ATAN2(ballY, ballX))

    IF lY > 180 THEN lY = 180
    IF lY < 10 THEN lY = 10
    IF rY > 180 THEN rY = 180
    IF rY < 10 THEN rY = 10

    IF ballX - 2 > lX AND ballX + 2 < lX + 10 AND ballY - 2 >= lY AND ballY + 2 <= lY + 50 THEN COLOR _RGB32(255, 0, 0): _PRINTSTRING (130, 112), "ERROR!!!!": COLOR _RGB32(255, 255, 255)
    IF ballX - 2 > rX - 10 AND ballX + 2 < rX AND ballY - 2 >= rY AND ballY + 2 <= rY + 50 THEN COLOR _RGB32(255, 0, 0): _PRINTSTRING (130, 112), "ERROR!!!!": COLOR _RGB32(255, 255, 255)

    IF ABS(mX) > 2 THEN mX = mX / 2
    IF ABS(mY) > 2 THEN mY = mY / 2


    IF ballX > 157 AND ballX < 163 THEN
        IF ballY > 60 AND ballY < 180 THEN mX = mX * -1
        IF ballY = 64 OR ballY = 180 THEN mY = mY * -1
    END IF
    LINE (ballX - 2, ballY - 2)-(ballX + 2, ballY + 2), , B
    LINE (3, 3)-(317, 237), , B
    LINE (lX, lY)-(lX + 10, lY + 50), , B
    LINE (rXx, rY)-(rxX - 10, rY + 50), , B
    LINE (160, 60)-(160, 180)
    _PRINTMODE _KEEPBACKGROUND
    popis = _PRINTWIDTH(STR$(leftplr) + " - " + STR$(rightplr))

    _PRINTSTRING (160 - popis / 2, 5), STR$(leftplr) + " - " + STR$(rightplr)
    _DEST de
END SUB

SUB ExtractPMF (Vystup AS STRING) ' here insert PMF file name for extracting files
    if _fileexists (vystup) then
    PRINT "Extracting files from "; Vystup$
    TYPE head
        identity AS STRING * 16
        much AS LONG
    END TYPE
    DIM head AS head
    e = FREEFILE
    OPEN Vystup$ FOR BINARY AS #e
    GET #e, , head
    IF head.identity = "Petr's MultiFile" THEN PRINT "Head PASS" ELSE PRINT "Head Failure": SLEEP 3: END
    PRINT "Total records in file:"; head.much
    DIM starts(head.much) AS LONG

    FOR celek = 1 TO head.much
        GET #e, , starts(celek)
    NEXT

    SEEK #e, 21 + head.much * 4 ' start DATA area
    FOR total = 1 TO head.much
        IF total = 1 THEN velikost& = starts(1) - (21 + head.much * 4) ELSE velikost& = starts(total) - starts(total - 1)
        record$ = SPACE$(velikost&)
        GET #e, , record$
        i = FREEFILE
        jmeno$ = "$Ext" + LTRIM$(STR$(total))
        OPEN jmeno$ FOR OUTPUT AS #i: CLOSE #i: OPEN jmeno$ FOR BINARY AS #i
        PUT #i, , record$
        CLOSE #i
    NEXT total

    DIM NamesLenght(head.much) AS INTEGER
    FOR NameIt = 1 TO head.much
        GET #e, , NamesLenght(NameIt)
    NEXT NameIt

    CLOSE #i
    FOR Name2 = 1 TO head.much
        s$ = SPACE$(NamesLenght(Name2))
        GET #e, , s$
        jm$ = "$Ext" + LTRIM$(STR$(Name2))
        erh:
        IF _FILEEXISTS(s$) THEN
            BEEP: INPUT "Warnig! Extracted file the same name already exists!!!! (O)verwrite, (R)ename or (E)xit? "; er$
            SELECT CASE LCASE$(er$)
                CASE "o": KILL s$: NAME jm$ AS s$
                CASE "r": INPUT "Input new name"; s$: GOTO erh
                CASE "e": SYSTEM
            END SELECT
        ELSE
            NAME jm$ AS s$
        END IF
    NEXT Name2
    CLOSE #e
    PRINT "All ok."
   else
   print "File "; vystup$; " not found.": end
end if
END SUB

SUB Destructor (vystup AS STRING) 'delete files created by ExtractPMF
    TYPE head2
        identity AS STRING * 16
        much AS LONG
    END TYPE
    IF INSTR(1, LCASE$(vystup$), ".pmf") THEN ELSE vystup$ = vystup$ + ".PMF"
    IF _FILEEXISTS(vystup$) THEN
        CLOSE
        DIM head AS head2
        e = FREEFILE
        OPEN vystup$ FOR BINARY AS #e
        GET #e, , head
        DIM starts(head.much) AS LONG

        FOR celek = 1 TO head.much
            GET #e, , starts(celek)
        NEXT

        SEEK #e, starts(head.much) ' start DATA area
        DIM NamesLenght(head.much) AS INTEGER
        FOR NameIt = 1 TO head.much
            GET #e, , NamesLenght(NameIt)
        NEXT NameIt
        FOR Name2 = 1 TO head.much
            s$ = SPACE$(NamesLenght(Name2))
            GET #e, , s$
            IF _FILEEXISTS(s$) THEN KILL s$
        NEXT Name2
        CLOSE #e
    ELSE
        PRINT "Specified file not found": SLEEP 3
    END IF
END SUB

Re: MAPTRIANGLE in 3D
« Reply #25 on: February 01, 2019, 04:42:33 PM »
That is an amazing effort! and no shortage of cabinets I see. ;)
B = B + ...

Offline STxAxTIC

  • Library Staff
  • Your mom would love me.
Re: MAPTRIANGLE in 3D
« Reply #26 on: February 01, 2019, 08:19:44 PM »
Hat tip to you Petr. My mind was blown when I realized you could use arrow keys to look around.

Looks like we have more than one person who can crack the 3D problem on this site. Believe me, I know the struggle and the satisfaction of getting MAPTRIANGLE to do your bidding in 3D.

... And I could answer this by studying the code, but for the sake of having this information on public display, I figured I would ask a few questions...

* How do you deal with graphics that have coordinates outside the viewing window? Does MAPTRIANGLE let you just ignore that issue, or did you have to clip at each view plane?

* How does this thing scale? That is, if we were to make a whole house or even a whole town, is the mini-game on the computer still going on? Does the whole world crank through the main loop?

* What's the end-game for this graphics demo?

* Can you swivel the view up and down along with left-right?

* Same question for movement - can we strafe instead of just swivel?

Respond however you'd like. I'm just thrilled that someone knows whats up in all three dimensions.
« Last Edit: February 02, 2019, 11:34:43 AM by STxAxTIC »

Offline Pete

  • Cuz I sez so, varmint!
Re: MAPTRIANGLE in 3D
« Reply #27 on: February 01, 2019, 10:22:57 PM »
Settle down Bill. It's just a simulation. Everybody knows, or will know in the next decade, the universe is flat.

Hey graphic guys. Where are the image files needed to run this demo?

Pete :D

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D
« Reply #28 on: February 02, 2019, 08:04:38 AM »
Hi STxAxTIC, I will prepare a detailed answer, which I will publish as soon as possible. Pete, all the necessary files are contained in the enclosed PMF file.

Online Petr

  • I am instructed.
Re: MAPTRIANGLE in 3D
« Reply #29 on: February 03, 2019, 06:06:01 AM »
So I'm back, yesterday we had a family celebration so I could not answer.

So, from the beginning.
How do you deal graphic coordinates, which are out of the monitor?

Not solved. This is not needed for this small program, but it can be solved for the size of the large space according to the size of the radius (I will explain below).

How is this thing measured?

According to Pythagoras' theorem. Take your paper to your hand. Paste a pencil into one of its places (preferably out of center). The point where the pencil penetrates the paper is where the camera is in the program. What happens when you turn the paper around this point where the pencil is stuck? The individual corners of the paper describe a circle with a common center that is not in the middle, that is, each circle has its own radius. How do we calculate this radius?
That's what I drew on the enclosed picture.

These calculations allow us to assemble off-center rotation, as shown in the ollowing program (in 2D). Use A, S and mouse:


Code: [Select]

'program for  points EXCENTRIC rotation. Please NOT USE this PI solution, its my first and very BAD method!
SCREEN _NEWIMAGE(800, 600, 256)


CX = 330: CY = 350 '                                                                rotation center point
N = 6




TYPE V
    X AS SINGLE '                                                                  source X points in standard view
    Y AS SINGLE '                                                                  source Y points in standard view
    Z AS SINGLE '                                                                  not use yet
    pi AS SINGLE '                                                                 start draw position on radius
    Radius AS SINGLE '                                                             radius (every point use own, but if is CX and CY in middle, are all the same)
END TYPE


DIM v(1 TO N) AS V


'       D      C        A       B     extra point
DATA 450,450,450,200,200,200,200,450,500,500,5000,5000: '                                            Quad data: X4, Y4, X3, Y3, X1, Y1, X2, Y2, extrapoint5x, y
FOR r = 1 TO N
    READ v(r).X, v(r).Y


    LenX = v(r).X - CX '                                                           calculate line lenght between CX and X - point (X1, X2...)
    LenY = v(r).Y - CY '                                                           calculate line lenght between CY (center Y) and Y - point


    Radius = SQR(LenX ^ 2 + LenY ^ 2) '                                            calculate radius using Pythagoras




    'urceni pi
    '----------------------
    ok = 0 '                                                                       THIS IS OLD FIRST METHOD! USE JK! FUNCTION FOR THIS!, its from developing time! JK! function is in previous program.
    FOR O = 0 TO _PI(2) STEP .0001 '
        X = CX + SIN(O) * Radius '                                                 Points in V array are the same as original draw contained in DATA.
        Y = CY + COS(O) * Radius
        IF CINT(X) = CINT(v(r).X) AND CINT(Y) = CINT(v(r).Y) THEN
            v(r).pi = O: ok = 1: EXIT FOR
        END IF
    NEXT O
    '----------------------
    IF ok = 0 THEN PRINT "ERROR": SLEEP
    v(r).Radius = Radius
NEXT
oldrot = 1
DO
    WHILE _MOUSEINPUT: WEND
    IF _MOUSEBUTTON(1) THEN
        CX = _MOUSEX: CY = _MOUSEY
        FOR r = 1 TO N
            LenX = v(r).X - CX '                                                           calculate line lenght between CX and X - point (X1, X2...)
            LenY = v(r).Y - CY '                                                           calculate line lenght between CY (center Y) and Y - point
            '
            Radius = SQR(LenX ^ 2 + LenY ^ 2) '                                            calculate radius using Pythagoras
            v(r).Radius = Radius




            ok = 0 '
            FOR O = 0 TO _PI(4) STEP .0001 '
                X = CX + SIN(O) * Radius '
                Y = CY + COS(O) * Radius
                IF CINT(X) = CINT(v(r).X) AND CINT(Y) = CINT(v(r).Y) THEN v(r).pi = O: ok = 1: EXIT FOR
            NEXT O
            '----------------------
            IF ok = 0 THEN PRINT "ERROR": SLEEP
        NEXT r
    END IF








    CLS
    i$ = INKEY$
    SELECT CASE i$
        CASE "a", "A": rot = rot - .1 '                                            rotate with N points using "A" or "a"  and "S" or "s"
        CASE "s", "S": rot = rot + .1
    END SELECT


    IF oldrot <> rot THEN
        FOR r = 1 TO N
            LOCATE 1, 1: PRINT rot
            X = CX + SIN(rot + v(r).pi) * v(r).Radius
            Y = CY + COS(rot + v(r).pi) * v(r).Radius


            PSET (v(r).X, v(r).Y)


            '        _PRINTSTRING (x, y), STR$(r)
            PSET (X, Y)
            CIRCLE (CX, CY), 3, 14
        NEXT r
    ELSE
        oldrot = rot
    END IF
    _DISPLAY
LOOP

So we already know how to work. Now a mathematical problem follows. We know by which circle and with which center a particular point should be moved, but we do not know which of the points on the circle is our right one. That's what the JK! function do in program. So, to understand how it works, I've written another sample program (2D). An important point is to know how to rotate the picture. The absolute base is to rotate the image of the SIN and COS functions by center.
The mathematical result of JK!  must be absolutely accurate, otherwise the space will deform. This whole function is based on the definition of the Sinus and Cosinus functions using a circle unit. I think the picture will tell you more:
https://www.e-matematika.cz/stredni-skoly/karta-goniometricke-funkce-na-jednotkove-kruznici.php


In this source code you program show angle in radians between center and point on circle. Use mouse, move to circle radius,
Code: [Select]
SCREEN _NEWIMAGE(800, 600, 256)
radius = 200



DO
    WHILE _MOUSEINPUT: WEND
    mx = _MOUSEX
    my = _MOUSEY
    cx = 400
    cy = 300


    CLS
    FOR old = 0 TO _PI(2) STEP .001
        oldX = cx + SIN(old) * radius
        oldY = cy + COS(old) * radius
        IF CINT(oldX) = mx AND CINT(oldY) = my THEN
            PRINT "Old method - PI:"; old
            PRINT "New - JK method - PI:"; JK(cx, cy, mx, my, radius)
            EXIT FOR
        END IF
        PSET (oldX, oldY)
    NEXT
    _DISPLAY
LOOP

'pokus s jednotkovou kruznici! it is named english correctly as "binary circle"?


FUNCTION JK! (cx, cy, px, py, R)
    '  podle definice jednotkove kruznice musim nejprve hodnoty prevest na rozsah od -1 do 1 pro x i pro y.
    '  R urcuje velikost kruznice, cili jR bude 1/R
    LenX = cx - px
    LenY = cy - py
    jR = 1 / R

    jX = LenX * jR
    jY = LenY * jR

    sinusAlfa = jX
    Alfa = ABS(_ASIN(sinusAlfa))

    Q = 1
    IF px >= cx AND py <= cy THEN Q = 1 'ok
    IF px >= cx AND py <= cy THEN Q = 2 'ok

    IF px < cx AND py <= cy THEN Q = 3
    IF px < cx AND py > cy THEN Q = 4
    SELECT CASE Q
        CASE 1: alfaB = Alfa
        CASE 2: alfaB = _PI / 2 + (_PI / 2 - Alfa)
        CASE 3: alfaB = _PI + Alfa
        CASE 4: alfaB = _PI(1.5) + (_PI / 2 - Alfa)
    END SELECT
    JK! = alfaB
END FUNCTION

In order to get the correct ratio (it has transferred the space to the space of the circle) it is sufficient to divide the number 1 by a radius.

What is the end of the game for this graphical demo?
 None. The minigame on the monitor is used only as animation, it goes to infinity. But in a next 3D program, I'll really be able to play minigame when switching from 3D to 2D, because the QB64 has tremendous power and performance, and it's totally in the possibilities of that language. It only depends on the programmer.

Can you rotate the view up / down?
That's what I'm working on. The principle will be the same as for rotation in XZ, only the radius is counted against the Z and Y, not the distance to the depth Z and the distance left - right X.
I assume that first rotation is done in X / Z and then another, in Y / Z. I want to solve this in the next program, so I'm going to solve this now.

I do not understand the last question, you probably ask for the moving aside.
 Yes, you can do it very easily. Only add or subtract POSx or POSz according to the angle of the current rotation.
Easy. It all looks easy when it's done ...