Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Statsman1

Pages: 1 2 [3]
31
QB64 Discussion / Plotting / erasing points on a circle
« on: September 28, 2021, 09:38:12 pm »
Hey everyone!

I hope you are all doing well. 

Here's the scenario...

Starting at the top of a circle and going counter-clockwise, I would like to...

Plot a filled dot at the top of the circle (using a radius of 1, then on an X-Y plane, center of circle at (0,0) that dot would be centered at (0,1)).

Determine at random how far along the circle the new dot will go, counter-clockwise.

Erase the previously drawn dot.

Plot the new dot.

Continue until the dot has passed through (-1,-1) and reached (0,-1).

Sort of like drawing a ball on a roulette wheel, but only one-half of a complete rotation, starting at the 12-o'clock position and going backwards to the 6-o'clock position.

I realize that the CIRCLE and PSET commands are in order here, and while I can determine the start and stop coordinates, I am having a heck of a time wrapping my head around the rest of it.  SIN and COS are long-forgotten trig functions, and I suspect I am using them to solve this...

Anybody have an idea here?

Thank you in advance!

Edited -

Using this...

Screen 12

Const Pi = 3.1415926

Circle (325, 225), 180, 6
Line (325, 225)-(x, y), 0

For j = 1 To 360
    Input "Enter value for point:"; s
    x = Int(Sin(s / 180 * Pi) * 180) + 325
    y = Int(Cos(s / 180 * Pi) * 180) + 225
    Line (325, 225)-(x, y), 15
Next j

- I bulldozed my way to learn that if s = 90, that code will draw a line from (0,0) to (1,0)

So, when s = 180, the result is a line from (0,0) to (0,1).  Yay.
And, when s = 0 or 360, the result is a line from (0,0) to (0,-1). Yay.

Accordingly, tomorrow, I have something to work on.  Any suggestions are welcome, but I think I figured out one route.

All the best, everyone!

32
@Statsman1

You can measure time intervals down to 100 nanoseconds (refer @SMcNeill high precision timer)

Thanks for the tip!  That might be TOO precise for what I am measuring, I think 10ths will be enough for the purpose.  If I needed to get down to that level of accuracy, I might be heading for a recreational drug habit…

33
Thanks for the tip!  I am, however, basically measuring the interval between, say, the start of a race and the crossing of the finish line.  So reading TIMER at the start and then at the end, and calculating the difference, is basically what I was looking for.  Just didn’t glean it from reading how TIMER worked.

In other news, you guys sure are helpful and responsive!  Much appreciated!


34
Regardless of the "route" taken, as long as it produces the results you seek, can hardly be classified as "useless"... Well that's my philosophy lesson for today... I'm obviously functioning on lower levels of caffeine again... Babbling once again... lol... Oh. By the way... Welcome to the forum...

You are advised to give priority to the colour 'blue'.... Moo Ha Ha....

My route, tragically, was not producing anything close to what I needed, but I guess I need to follow Occam’s Razor in the future.  I read the TIMER page on the Wiki, and just never extrapolated the difference between two “number of seconds since the most recent midnight.” would be what I was looking for.  I am such a noob here.

Thanks for the welcome, and blue is one of my favorite colours….hope you find all the coffee you can drink!

35
Thanks!  Happy to be here!

Oooh, now I feel like an idiot.  That example makes it so obviously simple.  Thank you very much, I was obviously taking a far more complicated and useless route.


36
QB64 Discussion / Use TIME$ to calculate elapsed time to tenth of a second?
« on: September 23, 2021, 08:02:44 pm »
Hey guys...

I am trying to capture the elapsed time of on-screen event, using Time$, and I can definitely get the seconds, but is there a way to calculate elapsed tenths of a second?

I am using val(right$(time$,2)) to get the seconds, but I am finding that capturing the tenths of a second is not evident.

Thank you!

Pages: 1 2 [3]