Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wanted: Very Simple 3D system
#21
(02-22-2024, 02:21 PM)bplus Wrote:
(02-22-2024, 03:53 AM)PhilOfPerth Wrote: ...
All a bit above me, but just curious: is the .7 (in line 15) sqrt(2)/2, by any chance?

.7 came from vince
Quote:hello B+,

there are two options, the easiest is parallel projection and the trickier but more realistic one is perspective projection

say you have 3D coord variables x, y, z and you wish to convert them to 2D coords, lets call them p, q

for parallel:

p = x + 0.7*z
q = y + 0.7*z

where 0.7 is a kind of arbitrary number which you can mod until it looks right

But Phil if you were thinking a parallelogram to represent the square base of a pyramid with one angle at 45 degrees such that the sin 45 = cos 45 = SQR(2)/2 = .7???,  I see where you are coming from ie, "isomorphic projections" for isometric drawings.

Erm, yeah, that's what I was thinking!  Rolleyes
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#22
(02-20-2024, 05:02 PM)bplus Wrote: Oh hey @bert22306

Let me show you my 3D Printer!
Code: (Select All)
_Title "Fake 3D demo" 'b+ 2020- 01-30

Const xmax = 700, ymax = 300, xc = 300, yc = 300
Screen _NewImage(xmax, ymax, 32)
_Delay .25 'need time for screen to load before attempting to move it.
_ScreenMove _Middle
ReDim colr As _Unsigned Long
For i = 1 To 50
    colr = _RGB32(0 + 5 * i, 0, 0)
    Text 60 + i, 20 + i, 256, colr, "Bert"
Next
Sleep

Sub Text (x, y, textHeight, K As _Unsigned Long, txt$)
    Dim fg As _Unsigned Long, cur&, I&, multi, xlen
    fg = _DefaultColor
    'screen snapshot
    cur& = _Dest
    I& = _NewImage(8 * Len(txt$), 16, 32)
    _Dest I&
    Color K, _RGBA32(0, 0, 0, 0)
    _PrintString (0, 0), txt$
    multi = textHeight / 16
    xlen = Len(txt$) * 8 * multi
    _PutImage (x, y)-Step(xlen, textHeight), I&, cur&
    Color fg
    _FreeImage I&
End Sub
Nice! Makes me feel so important, for my name to be enhanced that way. So you're saying, you too indulge in "fake 3D"?
Reply
#23
(02-23-2024, 01:37 AM)bert22306 Wrote: ...
Nice! Makes me feel so important, for my name to be enhanced that way. So you're saying, you too indulge in "fake 3D"?

Sure! I indulge. ;-))
b = b + ...
Reply
#24
oh yeah, 0.707 = sin 45 = cos 45 is indeed not an accident, it seemed a natural choice for the z offset
Reply




Users browsing this thread: 4 Guest(s)