Jump to content
Sign in to follow this  
andyf2022

creating circles and ovals programmatically Sin Cosin

Recommended Posts

Greetings coders,

 

Using Delphi 7, old I know but it is all I have.

 

I am wondering how to go about plotting a circle or an oval onto a canvas using code sin and cos, basically programmatically plotting points on the canvas around in a circle or oval of scroll bar selected sizes.

 

ideally with two scroll bars setting the the dimensions, then click a plot button, maybe using a timer to show that it is creating the shape a point at a time.

 

like to plot a

128x128

255x128

 

I am thinking in a 255x255 pixel area.

 

As I do this I want to save the plot points into an array with horizontal and Vertical values

 

Most of this I can figure but the sin cos functions and other math are beyond my experience.

 

 

 

 

 

 

 

 

 

 

 

 

Share this post


Link to post
20 minutes ago, Vandrovnik said:

Sin and Cos in Delphi take argument in radians (not in degrees).

Important to know. as is the unit circle!  

 

But let's not use theta or alpha Greek for angle today.

 

The first argument is x offset set it to Width div 2

Second argument is y offset set it to Height div 2

third and fourth arguments if the same draw a circle otherwise draws ellipse 

 Canvas.Ellipse(100,100,50,75);

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×