

In 1837, Pierre Wantzel proved that the problem, as stated, is impossible to solve for arbitrary angles. It concerns construction of an angle equal to one third of a given arbitrary angle, using only two tools: an unmarked straightedge and a compass. The example shows trisection of any angle θ> 3π / 4 by a ruler with length equal to the radius of the circle, giving trisected angle φ= θ / 3.Īngle trisection is a classical problem of straightedge and compass construction of ancient Greek mathematics. Process the "end cap" sections of the geometry using the same procedure.Īlso note in step 1 that any GlyphRunDrawings are handled using FormattedText.BuildGeometry to create an equivalent GeometryDrawing.Construction of an angle equal to one third a given angle Angles may be trisected via a neusis construction using tools beyond an unmarked straightedge and a compass.Iterate along the path, duplicating the GeometryDrawing objects repeatedly with appropriate coordinate transformations applied to all coordinates in the geometry.Remove portions of geometry in the "end cap" areas of the original drawing and set them aside.This is done by recursing through DrawingGroup objects, keeping track of transforms as you go, and constructing GeometryDrawings with appropriate transform. Convert the source drawing into a set of GeometryDrawing objects (I also supported ImageDrawing but that is more complicated since you need to use the 3D system to stretch the images).To actually implement the conversion method:

Then it is easy to draw a stroked path: Create a Drawing to describe the custom stroke, then display the stroke using a DrawingVisual that contains a Binding with a converter that calls your conversion method. Here are the basic steps:įirst create a method that takes a Geometry an existing Drawing, and some parameters for end caps, etc and creates a new Drawing that repeats the given Drawing along the path given by the Geometry. There is nothing built into WPF to do this for you, however, so you'll need to create it yourself, and I can tell you from experience that it is a lot of work. For an example, see custom brushes in the Expression Design tool. The basic technique I describe above can also be extended to allow an arbitrary pattern to be applied along a path.
#Triple line geometry how to#
If not, plan on spending several hours learning how to code attached properties to simulate value coercion before implementing the attached property approach. If you know how to implement attached properties and register handlers in them, this is a piece of cake. With such an attached property, all you need to write is: The above takes about 8 lines of code if you don't strike off the ends, or 15 if you do.Ī trick to make this convenient is to create an attached property which effectively coerces the Data property of the Path control it is attached to. If your situation would look better without it, remove it by iterating the side line geometry and removing all line segments that pass through the endpoints of the original path. This causes a line to be drawn across the end of your line, which actually looks aesthetically pleasing in many situations. More explanation on step 3: The widened geometry has line segments at the end of the original line.

Stroke the combined geometry to get a triple line.Combine the side line geomerty with original geometry using a CombinedGeometry.(optional) Remove segments at the end of the widened geometry, if desired.Use GetWidenedPathGeometry(), passing in the desired spacing, to get a new geometry whose edges correspond to the side lines.Start with PathGeometry.CreateFromGeometry() to get a PathGeometry for the input path.When I need to do custom lines I usually construct a Drawing based on the Geometry, but in your case you can simply build a Geometry that has three lines in parallel and stroke that. WPF's Geometry classes have all the primitives you need to accomplish this easily, but you will need to do it in code.
