07-31-2022, 05:05 PM
@OLdMoses
Sin puts a nice edge on those balls, thumbs up!
Sin puts a nice edge on those balls, thumbs up!
b = b + ...
DNA Animation
|
07-31-2022, 05:24 PM
(07-31-2022, 05:05 PM)bplus Wrote: @OLdMoses If my balls cause me to sin....
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
07-31-2022, 06:07 PM
(This post was last modified: 07-31-2022, 06:08 PM by Kernelpanic.)
07-31-2022, 07:49 PM
Yeah I see what you mean about loose artifacts OldMoses. But I'm just going to keep it as it is. I'll just say that the bands are tilted and not lined up. It looks good enough for me.
07-31-2022, 07:52 PM
Awesome colors KernalPanic!
07-31-2022, 08:42 PM
(07-31-2022, 07:49 PM)SierraKen Wrote: Yeah I see what you mean about loose artifacts OldMoses. But I'm just going to keep it as it is. I'll just say that the bands are tilted and not lined up. It looks good enough for me. Ah, but you're so close! It's a great algorithm, and just needed a couple tweaks. Allow me to have a go at it... The main issue is the many different variables for each ball, which make it difficult to compare them with simple tests and/or iterate through them with looping structures that can reduce code dramatically. The solution would be to either do multiple arrays indexed to each ball, or a single UDT array containing all the ball's data. I'll do a UDT array for the balls and also a small one for sorting purposes. Then add a sorting SUB to rearrange the balls after their position and radius data are updated in the loop. Arranging in ascending order of radius means they will be drawn from furthest away to closest, and thus will naturally overlap properly. Code: (Select All) 'DNA Animation by SierraKen
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
07-31-2022, 09:51 PM
Incredible OldMoses! I knew there had to be a way like that somehow, but the thing is, in my entire life I have only done multiple arrays on a single variable a couple times. And I have never used the Type command on my own code. So it's kinda like looking at a different language but someday I'll figure it out I hope. Thanks for figuring it out! Hopefully I'll look back at it sometime and try to decipher it all. But like I said, I had a feeling a lot less code was actually needed.
07-31-2022, 10:38 PM
TYPE...END TYPE UDT arrays can be a bit daunting at first, I know I found them so when I first got into QBasic. I was quite a while figuring out the whole "procedural" programming thing, having come from Applesoft Basic with it's line numbers, GOTOs, GOSUBs and two character variable names. It had arrays, but only very simple ones. Moving to Qbasic I had to learn SUBs, FUNCTIONS and UDTs, nearly giving up several times, but the effort paid off.
When ever you are doing some sort of data object multiple times (such as 12 helix balls), that contain multiple different data points ( x,y positions, radii, y offsets, start positions, etc), they are a great way to handle it. Particularly when you're doing the same things to those objects over and over. They really made that sorting SUB easy, since I only needed to sort by the radius element and all the rest of the data just moves with it. If you figured out that helical trig stuff, it shouldn't be too hard. Play with it some when you can and it'll come.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
I wondered if someone would resort to sorting.
b = b + ...
08-01-2022, 01:03 AM
Thanks OldMoses. I also started in AppleSoft BASIC in the 80's. Remember HOME instead of CLS? And there was GR and HGR and HGR2 for graphic screens. GR had the regular text at the bottom for a few lines. lol Actually the very first programming I did was in the 7th grade in the brand new computer lab the school got and we did a graphics language called LOGO. With LOGO we did PU PD (pen up, pen down) and the turtle walked in steps drawing your lines.
|
« Next Oldest | Next Newest »
|