Author Topic: Pi-in-the-Sky Graphics Demonstration Program (with 3D)  (Read 16584 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #30 on: April 19, 2020, 11:45:59 am »
It looks to me that all the CONSTs that are focked involve subtractions, good ole - sign a botch to evaluate because of double use as sign for numbers.

MillBombY1% is wrong because it is bossed by WindY% previously focked by missed-subtraction.

Didn't Steve do a correction for multiple - signs? Is this the version of Eval being used in v1.4 for CONSTs?


So @Qwerkey, another test, do all the CONSTs that involve subtraction manually and see how that works with v1.4.

Well I did myself and looks OK?

Reworked CONSTs section
Code: QB64: [Select]
  1. 'Pi-in-the-Sky Graphics Program by Qwerkey 13/12/19
  2. 'Acknowledgements: findsounds.com, freesound.org, freepik.com, pinclipart.com, imgbin.com, kissclipart.com, pngimg.com, vectorstock.com, sciencealert.com, startrek.com
  3.  
  4. CONST False = 0, True = NOT False, XScreen% = 1100, YScreen% = 800, ZOffset% = -620, PiConst! = 4 * ATN(1)
  5. CONST PiSizeLess1% = 499, PiDisp% = 100, SunSize%% = 500, AmblinHalf%% = 50
  6. CONST Zeta! = 0.07 * PiConst!, RBee% = 120, CBee% = 80, ABee! = -4 * CBee% / (RBee% * RBee%)
  7. CONST BeeEntX% = -350, BeeEntY% = -250, HiveWidth% = 1009, HiveHeight% = 589, BWidth% = 350
  8.  
  9. '  , HX1% = 0 - 50 - (XScreen% / 2)
  10. CONST HX1% = -600
  11.  
  12. 'CONST HY1% = 300 - (YScreen% / 2)
  13. CONST HY1% = -100
  14.  
  15. CONST HX2% = HX1% + BWidth%
  16.  
  17. 'HY3% = HY1% - (BWidth% * HiveHeight% / HiveWidth%)   = -100 - 204
  18. CONST HY3% = -304
  19.  
  20. CONST FountX% = -128, FountY% = -230, G! = 0.01, ZBow% = ZOffset% + 100
  21. CONST ZodHeight% = 70, ZodWidth% = ZodHeight% * 300 / 240, ZRad! = 12 * ZodWidth% / (2 * PiConst!) 'Can't use CINT() here
  22. CONST SpotRad% = 80, SpotInc! = 2 * PiConst! / 100
  23.  
  24. ', LampX% = XScreen% - 50
  25. CONST LampX% = 1050
  26.  
  27. ', LampY% = YScreen% - 220
  28. CONST LampY% = 580
  29.  
  30. CONST QB64X% = 300, QB64Y% = 50, UFOHalfX% = 150, UFOHalfY% = 60, UFORad% = 700
  31. CONST Iota! = -0.23 * PiConst!, Wind% = 150, WindX% = 550
  32. ', WindY% = YScreen% - 294,
  33. CONST WindY% = 506
  34.  
  35. CONST WindHeight% = 280
  36. CONST MillBombX1% = WindX% + 17, MillBombY1% = WindY% + 8, SailX% = 44, SailY% = -154
  37.  
  38. 'PRINT MillBombY1%    'OK!
  39. 'END
  40.  
  41.  
  42.  

 
whats in the sky.PNG
« Last Edit: April 19, 2020, 01:06:39 pm by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #31 on: April 19, 2020, 01:15:28 pm »
Hey is that Fellippe looking out the Windmill?

What? Fell? That's all ya got out ah that thar screen shot? Lookie agin...

 
Sams_Town.jpg
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #32 on: April 19, 2020, 01:41:37 pm »
@bplus Like you I did notice the -ve signs causing problems.  But I now have my own rule that a CONST may not have any maths in it.  Only simple CONST x = 1, and I have altered my pi-in-the-sky code accordingly.  When I have finished adding explanatory comments throughout, it will be ready to update the whole thing for 1.4 compatibility.


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #33 on: April 19, 2020, 01:56:07 pm »
@bplus Like you I did notice the -ve signs causing problems.  But I now have my own rule that a CONST may not have any maths in it.  Only simple CONST x = 1, and I have altered my pi-in-the-sky code accordingly.  When I have finished adding explanatory comments throughout, it will be ready to update the whole thing for 1.4 compatibility.

Well that's a safe rule but having CONST's calculated is convenient if you want to change the size of the screen for instance...

Here is the ScreenY% change and lampY% change so it fits my screen on laptop:
 
Whats in the Sky2.PNG


Now I can see the dirt at the grave sites.

Rats some Y's are based on ScreenY and some are not, so I fix sails and windmill and then the images in graves are off... oh well.

« Last Edit: April 19, 2020, 02:11:57 pm by bplus »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #34 on: April 19, 2020, 02:32:42 pm »
Something tells me we wont learn a lesson from this...
You're not done when it works, you're done when it's right.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #35 on: April 20, 2020, 06:34:14 am »
Here is the ScreenY% change and lampY% change so it fits my screen on laptop:

Rats some Y's are based on ScreenY and some are not, so I fix sails and windmill and then the images in graves are off... oh well.

@bplus  As I (in a cack-handed way without proper project planning) defined variables arbitrarily from top/bottom, left/right, would not RESIZE be something better for you to get the display to fit your screen size without having to manually change certain variable values?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #36 on: April 20, 2020, 11:59:33 am »
@bplus  As I (in a cack-handed way without proper project planning) defined variables arbitrarily from top/bottom, left/right, would not RESIZE be something better for you to get the display to fit your screen size without having to manually change certain variable values?

@Qwerkey,

I've never used _RESIZE before but this gave me idea to try _FULLSCREEN which seems allot easier except some of the Y values are not working correctly while some are.

Man the _RESIZE instructions are complicated, from WIKI example it looks like _RESIZE has to go in main loop and done every loop? How will this mix with all the memory values you are using? There is also _RESIZEWIDH and _RESIZEHEIGHT but what size does it know to resize to?

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #37 on: April 20, 2020, 01:05:13 pm »
Oh Drat @bplus !  I thought that you'd take the opportunity to examine RESIZE and then instruct me!  Like you, I found the Wiki so complicated that I've never used it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #38 on: April 20, 2020, 01:49:01 pm »
LOL!

Update: Just ran then $RESIZE:ON  example.

Oh! _RESIZE is working with the Windows Max/Min button! Now I see where the _RESIZEWIDTH and _RESIZEHEIGHT numbers are coming from.
« Last Edit: April 20, 2020, 02:08:51 pm by bplus »

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #39 on: April 22, 2020, 05:49:13 am »
CONST (that CONSTANT headache):

Quotes:
STxAxTIC
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #20 on: April 19, 2020, 11:07:25 AM »
CONST may as well be a DATA statement. We have variables, we know how to use them. That system is constantly checked for error and has been proven to be quite stable.
Here on the other hand we have CONST, with a completely different math subsystem, and has been nothing but trouble for years.
I say we lock CONST at the QB45 standard and never look back.

luke
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #23 on: April 19, 2020, 12:45:00 PM »
It basically has its own parser in the compiler that evaluates expressions entirely independently of regular maths, and has caused no end of annoyances.


I'd thought 1.4 had corrected the CONST issues --

Something tells me we wont learn a lesson from this...

From herein, I will only use CONST without any mathematical manipulations: CONST x = 1.  For anything else I will use standard variables, and if it needs to be constant it'll get DIM SHARED.

To satisfy STxAxTIC and to simply developers' lives why not make this the CONST attribution in future?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #40 on: April 22, 2020, 12:36:22 pm »
CONST (that CONSTANT headache):

Quotes:
STxAxTIC
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #20 on: April 19, 2020, 11:07:25 AM »
CONST may as well be a DATA statement. We have variables, we know how to use them. That system is constantly checked for error and has been proven to be quite stable.
Here on the other hand we have CONST, with a completely different math subsystem, and has been nothing but trouble for years.
I say we lock CONST at the QB45 standard and never look back.

luke
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #23 on: April 19, 2020, 12:45:00 PM »
It basically has its own parser in the compiler that evaluates expressions entirely independently of regular maths, and has caused no end of annoyances.


From herein, I will only use CONST without any mathematical manipulations: CONST x = 1.  For anything else I will use standard variables, and if it needs to be constant it'll get DIM SHARED.

To satisfy STxAxTIC and to simply developers' lives why not make this the CONST attribution in future?



Yeah, it is a wonder why two separate Eval systems are being used? No wonder v1.4 is taking noticeably longer to compile and run, it's bloated!

But to me it is more sensible to fix the subtraction problem than to stop using CONST calculations based on other CONST values, that is very handy! IMHO CONSTs are made to be unchanged and variables are made to be changeable. Opinion? isn't it implied in their names?

Since QB64 v1.4 has 2 Eval systems you'd think we could use one of them for a very useful Eval Function as well.

Ah well, just Pi-in-the sky ideas. :)
« Last Edit: April 22, 2020, 12:42:42 pm by bplus »

FellippeHeitor

  • Guest
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #41 on: April 22, 2020, 03:10:08 pm »
We've had Steve's internal evaluator for CONSTs since v1.0.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #42 on: April 30, 2020, 07:31:43 pm »
Question for the CONST glitch, which I just thought of: Does it still occur if the CONST name is all uppercase or lowercase?  It may be an issue of the internal routines trying to compare UCASE$ names verses CaMeLcAsE stored names. 

I finally got my PC in the shop for repairs today, so if I get it back next week, I'll dig into the issue better, but it may just be a simple case of cases not matching, which is causing the issue.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #43 on: April 30, 2020, 08:07:41 pm »
Hey Steve,

All caps did not work but quess what? NO %'s did the trick!

Before fix:
Code: QB64: [Select]
  1. CONST False = 0, True = NOT False, XScreen% = 1100, YScreen% = 800, ZOffset% = -620, PiConst! = 4 * ATN(1)
  2. CONST PiSizeLess1% = 499, PiDisp% = 100, SunSize%% = 500, AmblinHalf%% = 50
  3. CONST Zeta! = 0.07 * PiConst!, RBee% = 120, CBee% = 80, ABee! = -4 * CBee% / (RBee% * RBee%)
  4. CONST BeeEntX% = -350, BeeEntY% = -250, HiveWidth% = 1009, HiveHeight% = 589, BWidth% = 350, HX1% = 0 - 50 - (XScreen% / 2)
  5. CONST HY1% = 300 - (YScreen% / 2), HX2% = HX1% + BWidth%, HY3% = HY1% - (BWidth% * HiveHeight% / HiveWidth%)
  6. CONST FountX% = -128, FountY% = -230, G! = 0.01, ZBow% = ZOffset% + 100
  7. CONST ZodHeight% = 70, ZodWidth% = ZodHeight% * 300 / 240, ZRad! = 12 * ZodWidth% / (2 * PiConst!) 'Can't use CINT() here
  8. CONST SpotRad% = 80, SpotInc! = 2 * PiConst! / 100, LampX% = XScreen% - 50, LampY% = YScreen% - 220
  9. CONST QB64X% = 300, QB64Y% = 50, UFOHalfX% = 150, UFOHalfY% = 60, UFORad% = 700
  10. CONST Iota! = -0.23 * PiConst!, Wind% = 150, WindX% = 550, WindY% = YScreen% - 294, WindHeight% = 280
  11. CONST MillBombX1% = WindX% + 17, MillBombY1% = WindY% + 8, SailX% = 44, SailY% = -154
  12.  

After fix:
Code: QB64: [Select]
  1. CONST FALSE = 0, TRUE = NOT FALSE, XSCREEN = 1100, YSCREEN = 800, ZOFFSET = -620, PICONST! = 4 * ATN(1)
  2. CONST PISIZELESS1 = 499, PIDISP = 100, SUNSIZE = 500, AMBLINHALF = 50
  3. CONST ZETA! = 0.07 * PICONST!, RBEE = 120, CBEE = 80, ABEE! = -4 * CBEE / (RBEE * RBEE)
  4. CONST BEEENTX = -350, BEEENTY = -250, HIVEWIDTH = 1009, HIVEHEIGHT = 589, BWIDTH = 350, HX1 = 0 - 50 - (XSCREEN / 2)
  5. CONST HY1 = 300 - (YSCREEN / 2), HX2 = HX1 + BWIDTH, HY3 = HY1 - (BWIDTH * HIVEHEIGHT / HIVEWIDTH)
  6. CONST FOUNTX = -128, FOUNTY = -230, G! = 0.01, ZBOW = ZOFFSET + 100
  7. CONST ZODHEIGHT = 70, ZODWIDTH = ZODHEIGHT * 300 / 240, ZRAD! = 12 * ZODWIDTH / (2 * PICONST!) 'CAN'T USE CINT() HERE
  8. CONST SPOTRAD = 80, SPOTINC! = 2 * PICONST! / 100, LAMPX = XSCREEN - 50, LAMPY = YSCREEN - 220
  9. CONST QB64X = 300, QB64Y = 50, UFOHALFX = 150, UFOHALFY = 60, UFORAD = 700
  10. CONST IOTA! = -0.23 * PICONST!, WIND = 150, WINDX = 550, WINDY = YSCREEN - 294, WINDHEIGHT = 280
  11. CONST MILLBOMBX1 = WINDX + 17, MILLBOMBY1 = WINDY + 8, SAILX = 44, SAILY = -154
  12.  
  13.  

To confirm it's the suffixes I tried this:
Code: QB64: [Select]
  1. CONST False = 0, True = NOT False, XScreen = 1100, YScreen = 800, ZOffset = -620, PiConst = 4 * ATN(1)
  2. CONST PiSizeLess1 = 499, PiDisp = 100, SunSize = 500, AmblinHalf = 50
  3. CONST Zeta = 0.07 * PiConst, RBee = 120, CBee = 80, ABee = -4 * CBee / (RBee * RBee)
  4. CONST BeeEntX = -350, BeeEntY = -250, HiveWidth = 1009, HiveHeight = 589, BWidth = 350, HX1 = 0 - 50 - (XScreen / 2)
  5. CONST HY1 = 300 - (YScreen / 2), HX2 = HX1 + BWidth, HY3 = HY1 - (BWidth * HiveHeight / HiveWidth)
  6. CONST FountX = -128, FountY = -230, G = 0.01, ZBow = ZOffset + 100
  7. CONST ZodHeight = 70, ZodWidth = ZodHeight * 300 / 240, ZRad = 12 * ZodWidth / (2 * PiConst) 'Can't use CINT() here
  8. CONST SpotRad = 80, SpotInc = 2 * PiConst / 100, LampX = XScreen - 50, LampY = YScreen - 220
  9. CONST QB64X = 300, QB64Y = 50, UFOHalfX = 150, UFOHalfY = 60, UFORad = 700
  10. CONST Iota = -0.23 * PiConst, Wind = 150, WindX = 550, WindY = YScreen - 294, WindHeight = 280
  11. CONST MillBombX1 = WindX + 17, MillBombY1 = WindY + 8, SailX = 44, SailY = -154
  12.  
  13.  

And it's running fine as well as far as I can tell.
« Last Edit: April 30, 2020, 08:17:26 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Pi-in-the-Sky Graphics Demonstration Program (with 3D)
« Reply #44 on: April 30, 2020, 09:14:53 pm »
That's what I was kinda thinking: a simple case of names not matching the lookup values.  All we probably need is a simple routine to strip symbols off before looking up the names from our internal list.

Does the following work?

CONST X! = 3.14
CONST Y! = 2 * X
PRINT X, Y

If you notice, the second line is using X without the specific symbol attached.  At the moment, I'm thinking the glitch is probably only on the right side of the = sign. 

(IF it works, try it with X! and see if that breaks it.  If so, I think it'll be a trivial fix once I get my PC back and can address the issue.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!