Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wanted: Very Simple 3D system
#14
OK Bert convinced me to try Parallelism first, KISS. Here is my first test with a Pryramid the 3D model's height is the same as the side of a square base. You can press <, or >. for increasing and decreasing the PC = Parallel Constant

Code: (Select All)
_Title "3D per Parallelism test 1 Pyramid" 'b+ 2024-02-20
'  "parallelism suggests a connection of meaning through an echo of form"

Dim Shared As Long SW, SH: SW = 800: SH = 600
Screen _NewImage(SW, SH, 32)
_Delay .25 'need time for screen to load before attempting to move it.
_ScreenMove _Middle

Type XYZ
    As Double x, y, z
End Type
Type XY
    As Double x, y
End Type
Dim Shared As Double PC ': PC = .7 ' or something  PC = Parallel Constant

Window (-2, -1)-(2, 3)

' pyramid with square base and 4 iso-tri's to apex
Dim p3(1 To 5) As XYZ
Dim p2(1 To 5) As XY

p3(1).x = 0: p3(1).y = 2: p3(1).z = 0 ' apex

p3(2).x = -1: p3(2).y = 0: p3(2).z = -1 ' base
p3(3).x = 1: p3(3).y = 0: p3(3).z = -1
p3(4).x = 1: p3(4).y = 0: p3(4).z = 1
p3(5).x = -1: p3(5).y = 0: p3(5).z = 1


' now draw the thing! and find ideal PC = Parallel Constant
PC = .2
While _KeyDown(27) = 0
    kh& = _KeyHit
    If kh& = 44 Then PC = PC - .01
    If kh& = 46 Then PC = PC + .01
    ' recalc new array
    For i = 1 To 5
        M2SPP p3(i), p2(i) ' that was easy now draw the thing!
    Next

    Cls
    Locate 2, 20: Print "Here, the 3D Model height at apex is same as a side at the base."
    Locate 4, 18: Print "Press  <, = less, >. = more    When does the base look square?  PC ="; PC
    Locate 6, 21: Print "Oh! PC is the Parallel Constant for this very simple 3D system."
    ' base
    Line (p2(2).x, p2(2).y)-(p2(3).x, p2(3).y), &HFFFFFFFF ' front line base
    Line (p2(3).x, p2(3).y)-(p2(4).x, p2(4).y), &HFFFFFFFF ' right side
    Line (p2(4).x, p2(4).y)-(p2(5).x, p2(5).y), &HFFFF0000 ' back front
    Line (p2(5).x, p2(5).y)-(p2(2).x, p2(2).y), &HFFFF0000 ' left side


    Line (p2(1).x, p2(1).y)-(p2(2).x, p2(2).y), &HFFFFFFFF ' Front L
    Line (p2(1).x, p2(1).y)-(p2(3).x, p2(3).y), &HFFFFFFFF ' Front R
    Line (p2(1).x, p2(1).y)-(p2(4).x, p2(4).y), &HFFFFFFFF ' Back R
    Line (p2(1).x, p2(1).y)-(p2(5).x, p2(5).y), &HFFFF0000 ' Back L

    _PrintString (PMap(p2(1).x, 0) - 4, PMap(p2(1).y, 1) - 17), "1" ' apex
    _PrintString (PMap(p2(2).x, 0) - 10, PMap(p2(2).y, 1) + 4), "2" ' Front L
    _PrintString (PMap(p2(3).x, 0) + 4, PMap(p2(3).y, 1) + 4), "3" ' Front R
    _PrintString (PMap(p2(4).x, 0) - 4, PMap(p2(4).y, 1) + 8), "4" ' Back R
    _PrintString (PMap(p2(5).x, 0) - 4, PMap(p2(5).y, 1) + 8), "5" ' Back L

    Locate 35, 10
    Print "I thought -z would be the back part and +z the front but it seems to work visa versa."
    Locate 36, 25
    Print "Mainly because the white face is bigger, I think.";
    _Display

Wend

' thankyou vince '2024-02
Sub M2SPP (pIN As XYZ, pOut As XY) 'M2SPP = Model (3D) 2 Screen Per Parallelism
    pOut.x = pIN.x + PC * pIN.z
    pOut.y = pIN.y + PC * pIN.z
End Sub

Update: thanks to my new spellchecker, "somple" is now simpleSmile Oh nutz now I see I have my numbered label points commented as ' apex nope! only the first is... BRB, OK fixed.
b = b + ...
Reply


Messages In This Thread
Wanted: Very Simple 3D system - by bplus - 02-15-2024, 03:56 PM
RE: Wanted: Very Simple 3D system - by dbox - 02-15-2024, 04:13 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-15-2024, 04:57 PM
RE: Wanted: Very Simple 3D system - by vince - 02-15-2024, 09:10 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-15-2024, 11:54 PM
RE: Wanted: Very Simple 3D system - by Abazek - 02-16-2024, 07:27 AM
RE: Wanted: Very Simple 3D system - by bplus - 02-19-2024, 11:17 AM
RE: Wanted: Very Simple 3D system - by bplus - 02-19-2024, 11:34 AM
RE: Wanted: Very Simple 3D system - by bert22306 - 02-19-2024, 11:22 PM
RE: Wanted: Very Simple 3D system - by vince - 02-20-2024, 03:36 AM
RE: Wanted: Very Simple 3D system - by bplus - 02-20-2024, 03:28 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-20-2024, 04:01 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-20-2024, 05:02 PM
RE: Wanted: Very Simple 3D system - by bert22306 - 02-23-2024, 01:37 AM
RE: Wanted: Very Simple 3D system - by bplus - 02-23-2024, 01:58 AM
RE: Wanted: Very Simple 3D system - by bplus - 02-20-2024, 10:22 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-22-2024, 02:21 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-21-2024, 02:58 PM
RE: Wanted: Very Simple 3D system - by bplus - 02-21-2024, 09:51 PM
RE: Wanted: Very Simple 3D system - by madscijr - 02-22-2024, 03:39 PM
RE: Wanted: Very Simple 3D system - by vince - 02-23-2024, 07:15 PM



Users browsing this thread: 11 Guest(s)