Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing Tools Subs or Functions with Demo
#29
(09-05-2024, 12:32 AM)bplus Wrote: You must mean: what are tu and tv? _Asin is going to return an angle. The t of tu and tv my guess is: t is for translate because we are getting a point off the rectangular image and projecting it onto the sphere/circle in 2d. (Line 57 for me is x = x + 1 and I know you don't mean that!)

Translations are done like converting x, y coordinates to polar you need and angle and a distance from an origin.
I suspect tu and tv are getting the angles for the translation. Looking at pc using tv and tu we might be doing the reverse, translating polar to x, y coordinates?

Take the above as possible clues not gospel. Tongue

I believe this is first time I've ever seen _Asin practically used but I don't live the life of Pete Big Grin

Update: Oh we are getting (x, y) points off the sphere/circle/disk and looking at the Point color on the Image for the color. Notice how the code is like our circle fill routines with x,y about cx, cy.

BTW we could use this for really fancy gradients unfortunately it would be pretty slow.
Yep, tu and tv were the variables I was referring to. I kinda figured they were mapping the points from the rectangle to the circle. I didn't even know _ASIN existed. I've read up on it in the Wiki and I get what it's doing. Hard to believe it's been around since version 1.00 and I'm just now learning about it. (that goes for _ACOS too)

I'm going to plot a few points by hand on paper so I can get a handle on exactly how tu and tv are calculated.

The magic numbers 1.5, 3, and 6 in those code lines has me wondering what they control as well.

As far as speed goes I wonder if there is way the _MEM commands could help with that? I'm going to play some more. I want to add this function to my list of library image goodies.

You wouldn't happen to have a link to the forum where you found the original code would you?
There are two ways to write error-free programs; only the third one works.
QB64 Tutorial
Reply


Messages In This Thread
RE: Drawing Tools Subs or Functions with Demo - by TerryRitchie - 09-05-2024, 02:34 AM



Users browsing this thread: 7 Guest(s)