Tag Archives: geometry

Make an intuitive extension method to draw an elliptical arc in WPF and C#

In my previous post Draw an elliptical arc in WPF and XAML, I explained how WPF makes you define an elliptical arc. Their method almost makes sense if you want draw an arc as part of a path. however, if … Continue reading

Posted in drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , | Leave a comment

Draw an elliptical arc in WPF and XAML

This example shows how to use XAML code to draw an elliptical arc in a WPF. The following sections explain how to specify an elliptical arc and how to draw one in XAML. Specifying an Elliptical Arc WPF provides several … Continue reading

Posted in drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , | Leave a comment

Solve Geometric Problems with C#

[This is a promo piece by Packt, the publisher of my book The Modern C# Challenge. It includes two of the 100 example problems and solutions in the book.] Solve Geometric Problems with C# Learn how to solve C# geometric … Continue reading

Posted in books, geometry, mathematics | Tagged , , , , , , , , , , | Leave a comment

New Book: The Modern C# Challenge

My latest book, The Modern C# Challenge, is now available. It’s a collection of 100 programming challenges that let you test your ability in a wide variety of programming topics, many of which are not usually covered in traditional programming … Continue reading

Posted in algorithms, books, files, mathematics, puzzles | Tagged , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Graph points in WPF and C#

This example extends the previous example Draw a graph in WPF and C# to draw ellipses marking the data sets’ points. See that example for an explanation of how most of the program works. The following code shows how the … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments

Use a custom dash pattern with WPF and XAML in C#

My post Render dashed lines in a WPF program using C# explains how a WPF program can use C# code to render lines with a custom dash pattern onto a bitmap. This post shows how to use a custom dash … Continue reading

Posted in drawing, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

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

Posted in algorithms, fonts, geometry, graphics, strings | Tagged , , , , , , , , , , , , , , , , , , , | 1 Comment

Calculate where a line segment and an ellipse intersect in C#

Finding the intersection between a line segment and an ellipse requires a lot of mathematics. It’s not particularly hard mathematics, but if you’d rather skip it, you can use the following links to jump to the other parts of this … Continue reading

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

Generate random polygons in C#

I needed a method for generating random polygons for a graphics program and the following code shows the result. // Make random polygons inside the bounding rectangle. private static Random rand = new Random(); public static PointF[] MakeRandomPolygon( int num_vertices, … Continue reading

Posted in algorithms, geometry, graphics | Tagged , , , , , , , , , | Leave a comment

Make silly eyes that track the mouse without flicker in C#

The example Make silly eyes that track the mouse in C# shows how to make eyes track the mouse position, but if you look closely as that program runs you will see a noticeable flicker. The solution is quite simple: … Continue reading

Posted in games, geometry, graphics | Tagged , , , , , , , , , , , , | 1 Comment