October 09, 2024, 04:42:04 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Ellipse Rotation

Started by GWS, November 22, 2020, 11:27:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

November 22, 2020, 11:27:03 AM Last Edit: November 22, 2020, 11:31:36 AM by GWS
Hi folks,

Here's a small program to demonstrate how to rotate an ellipse.

The in-built command ..
ELLIPSE window, left, top, width, height {, border {, fill}}

draws the ellipse along the x - axis.

To provide a simple command to draw a special ellipse at any angle from 0 to 360 degrees, I've written the subroutine SEllipse.

SEllipse(cx,cy,wid,hgt)

Parameters to specify things like line width, rotation angle, border and fill colors, are specified as required in the main program prior to the subroutine call..

The main demo ellipse is drawn at a 20 degree angle, in the centre of the window, along with a few other ellipses to make it interesting and colorful  :)

It is fascinating that simply altering a 'Shape factor' to smaller or greater than the normal 2.0 (for an ellipse), you can get star shapes and rounded rectangles - all from the same subroutine. Amazing ..  :P

All the best, :)

Graham





Tomorrow may be too late ..

GWS

Hi,

I don't know if anyone has got round to trying the program yet, but try changing the Shape Factor from 2 to 0.2, and then to 20. It makes a huge difference to the shapes which are created. :)

And all using the same subroutine - I find that fascinating.

If you have Creative Basic set up, it also shows the beauty of an interpreter.
Just make a change to the code, click the Run button and off it goes - no compiling necessary.

This is great for me as I'm running the Norton virus checker.  With a compiler, (EBasic or IWB), it barfs on any newly compiled .exe (no matter how small) and promptly deletes it. Damn nuisance. ::)  I could turn off it's checking of course, but that's defeating the safety object.

Best wishes, :)

Graham

Tomorrow may be too late ..

srvaldez

Hi Graham
I would like to try your creation but I don't have CB, and unfortunately Windows Defender won't let me run the included exe and IWB is not happy with the source code.
today was Thanks giving day in the USA, does the UK have similar holiday?

GWS

Hello,

There's a free version of creative available on the site - see
http://www.ionicwind.com/forums/index.php?topic=5560.msg41049#msg41049

This does not require any activation.

I'm surprised Windows Defender rejects the .exe - I've never used it myself.  Norton AV never objects to CB .exes.

The source code is different in a number of ways from IWB - much simpler, but not easy to convert.

We usually have Harvest festival in the UK, but this year all gatherings have been called off because of the virus, which thanks to government poor decisions, is running rampant.  Maybe next year ..  ::)

Tomorrow I reach my 84th birthday  :o  - I just hope I might be around to see my 85th. :)
 

Best wishes, :)

Graham
Tomorrow may be too late ..

srvaldez

thanks Graham and happy birthday  :)

Egil

Hi Graham,

I just love code snippets like this, and have been playing with it for several hours now, just to see what happens when the shape factor is changed. And for these kinds of experiments Creative Basic really excells.
I know many professional coders frowns when they hear the word interpreter, but the truth is that they never used one, especially not Creative Basic.

The main difference between CB and IWB is the way windows and controls are defined, but if you need to test an idea for a new algorithm or make a new function, and do it fast, nothing beats doidng it with CB!
And most of the time the finished code can be used directly in IWB, if you want to. But is that really necessary? Not in my opinion!
It is true that interpreted code is executed slower, and that the exes produced by CB are all at least five times larger than those produced by IWB. But modern computers are so fast and have so much memory that the users can bearly not notice the difference in all but the most time critical operations.

So srvaldez, if you haven't tried CB yet, download the free community version and enjoy yourself!


Thanks for sharing the code Graham!

Egil


PS:   Happy Birthday!   ;D  ;D
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Hi Egil,

Lovely to hear from you  :)

I'm very happy with the way Creative performs.

I've just been trying out a number of other languages - but I always come back to the cosy CB. ;D

Hope next year will be a good one for you ..

Best wishes, :)

Graham

Tomorrow may be too late ..

aurelCB

Happy birthday sir Graham  :) 
And all best ...

Yes Creative Basic is one of the best ever made programming language for Windows.