# Tag Archives: circle

## Use sines and cosines to draw circles and ellipses in C#

This example shows how you can use trigonometric functions to draw circles. It’s such a basic technique that I often forget that it’s not completely obvious to everyone. Given a radius R and an angle θ, the equations x = … Continue reading

## Draw text on a circle in C#

This example uses some of the techniques described in the post Measure character positions when drawing long strings in C# to draw text on a circle. The previous post explains how to determine where the characters in a string will … Continue reading

## Draw a circle through three points in C#

The perpendicular bisector of any chord on a circle passes through the circle’s center. To find the center given three points, simply find the perpendicular bisectors of the first two and last two pairs of points, and see where the … Continue reading

## Find the tangent lines between two circles in C#

This example shows how you can find the tangent lines between two circles. Depending on how the circles are arranged, they can have 0, 2, or 4 tangent lines. If the circles don’t intersect, as on the left in Figure … Continue reading

## Find the tangent lines between a point and a circle in C#

Finding the tangent lines between a point and a circle isn’t too hard if you’re familiar with the example Determine where two circles intersect in C#. Consider the figure on the right. R is the radius of the circle. You … Continue reading

Posted in algorithms, geometry, graphics, mathematics | | 1 Comment

## Calculate the formula for a circle selected by the user in C#

This example shows how to calculate the formula for a circle that the user has selected by clicking and dragging. The program uses the usual MouseDown, MouseMove, and MouseUp event handlers to let the user draw the circle. The only … Continue reading

Posted in algorithms, geometry, graphics, mathematics | | 3 Comments

## Determine where two circles intersect in C#

This example shows one method for finding where two circles intersect in C#. If you don’t like math, skip to the code below. Consider the figure on the right showing two circles with radii r0 and r1. The points p0, … Continue reading

## Determine where a line intersects a circle in C#

The FindLineCircleIntersections method shown shortly finds the points where line intersects a circle. It takes as parameters a circle’s center point and radius, and two points on the line. It uses out parameters to return the coordinates of the points … Continue reading

## Find a minimal bounding circle of a set of points in C#

The example Find the convex hull of a set of points in C# finds the convex hull of a set of points. A convex hull is the smallest convex polygon that encloses the points. This example extends that result to … Continue reading

Posted in algorithms, geometry, graphics, mathematics | | 7 Comments