DNA Animation - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7) +---- Thread: DNA Animation (/showthread.php?tid=703) |
RE: DNA Animation - bplus - 07-31-2022 @OLdMoses Sin puts a nice edge on those balls, thumbs up! RE: DNA Animation - OldMoses - 07-31-2022 (07-31-2022, 05:05 PM)bplus Wrote: @OLdMoses If my balls cause me to sin.... RE: DNA Animation - Kernelpanic - 07-31-2022 (07-31-2022, 05:05 PM)bplus Wrote: @OLdMosesGreat, with t and tt one can change the DNA strand: t=140, tt=45 -- t=140, tt=25 . . . and so on. Thanks! RE: DNA Animation - SierraKen - 07-31-2022 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. RE: DNA Animation - SierraKen - 07-31-2022 Awesome colors KernalPanic! RE: DNA Animation - OldMoses - 07-31-2022 (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 RE: DNA Animation - SierraKen - 07-31-2022 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. RE: DNA Animation - OldMoses - 07-31-2022 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. RE: DNA Animation - bplus - 07-31-2022 I wondered if someone would resort to sorting. RE: DNA Animation - SierraKen - 08-01-2022 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. |