Tag Archives: line segment

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 , , , , , , , , , , , , , , , , , | 5 Comments

Draw cones using WPF and C#

This example shows how to draw cones in WPF and C#. The program uses a method very similar to the one used by the example Draw cylinders using WPF and C#. The picture on the right shows the approach used … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Draw text on a line segment in C#

This example shows how you can draw text on a line segment. The key is the DrawTextOnSegment method shown in the following code. This method can draw text on a line segment or below a line segment. // Draw some … Continue reading

Posted in algorithms, drawing, fonts, graphics, transformations | Tagged , , , , , , , , , , , , , , , | Leave a comment

Clip a line segment to a polygon in C#

This example finds the pieces of a line segment that lie inside and outside of a polygon. It draws the parts of the segment that lie outside of the polygon with a pink background and it draws parts of the … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , | Leave a comment

Draw spheres using WPF and C#

This example shows how you can draw spheres in a 3D WPF program. The following code shows the AddSphere method, which adds a sphere to a MeshGeometry3D. It’s kind of long, but the ideas (which I’ll explain shortly) aren’t too … Continue reading

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

Draw smooth cylinders using WPF and C#

This example shows how to draw smooth cylinders in a WPF application. The example Draw cylinders using WPF and C# shows how to draw cylinders. See that example to learn the basic techniques. To make WPF produce smooth cylinders, all … Continue reading

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

Draw cylinders using WPF and C#

This example shows how to draw cylinders in a WPF application. Other examples such as Draw a 3D surface from a set of data points with an altitude map using WPF and C# show how to draw 3D graphics. This … Continue reading

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

Use segments to draw 3D axes with tic marks using WPF and C#

This example uses the techniques described in the post Draw improved 3D line segments using WPF and C# to draw 3D axes with tic marks. You could make the tic marks in several ways. You could use small spheres, cubes, … Continue reading

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

Use segments to draw 3D arrows using WPF and C#

This example uses the techniques described in the post Draw improved 3D line segments using WPF and C# to draw 3D arrows. The following code shows the AddArrow extension method that adds an arrow to a MeshGeometry3D object. // Make … Continue reading

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

Draw triangle vertex normals on a 3D model using WPF and C#

This example is somewhat similar to Draw surface normals on a 3D model using WPF and XAML except it draws vertex normals in addition to surface normals, a wireframe, and the surface itself. It uses the following code to create … Continue reading

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