02-22-2024, 03:53 AM
(02-20-2024, 10:22 PM)bplus Wrote: 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 ConstantAll a bit above me, but just curious: is the .7 (in line 15) sqrt(2)/2, by any chance?
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 simple Oh nutz now I see I have my numbered label points commented as ' apex nope! only the first is... BRB, OK fixed.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Please visit my Website at: http://oldendayskids.blogspot.com/
Please visit my Website at: http://oldendayskids.blogspot.com/