The Tektosyne Library for the .NET Framework offers a variety of types and methods to supplement the .NET Base Class Library. Tektosyne is © 2002–2012 by Christoph Nahr but available for free download under the MIT license.
The Tektosyne Library ships as two separate assemblies, Tektosyne.Core and Tektosyne.Windows. A brief overview follows; please refer to the Class Reference for details. The library and all examples in the documentation are written in C#.
Tektosyne.Core requires only the four BCL “core” assemblies, enabling compatibility with a wide range of target environments – see System Requirements for details. Tektosyne.Core provides the bulk of the library’s functionality, including the following:
- Collections: generic “braided” tree, generic quadtree, extensions of BCL collections with read-only wrappers
- Sorting: standard sorting algorithms and binary search for IList<T> collections
- Natural string sorting, i.e. numerical sorting of digit-only substrings
- Geometric primitives: Point/Vector, Size, Line, Rect with various coordinate types
- Geometric algorithms: convex hull, multi-line intersection, point in polygon, Voronoi diagram and Delaunay triangulation
- Graph algorithms: A* pathfinding, path coverage, flood fill, line of sight
- Planar subdivision represented as doubly-connected edge list, with support for dynamic modification, fast point location, and pathfinding
- Rectangular grid of regular polygons (squares or hexagons), with pathfinding support
- An implementation of the Mersenne Twister pseudo-random number generator
- Mathematical helper methods, including a library of Fortran 90 functions
- Specialized exception types and ThrowHelper methods for common error scenarios
Tektosyne.Windows requires a multitude of BCL assemblies that are exclusive to the .NET Framework 4 on Windows, such as the Windows Presentation Foundation (WPF) and interoperation with the unmanaged Win32 API. Its additional features include the following:
- Concurrent drawing on multiple Dispatcher threads within the same WPF window
- Hosting a NumericUpDown control with error provider and tooltip in a WPF window
- Manipulating a WriteableBitmap’s pixel data with or without a secondary buffer
- Searching visual and logical WPF trees for children or parents of a specific type
- Wrappers for the Simple MAPI protocol to send e-mail messages with attachments
- Many other utility types & methods that I needed at one time or another
Tektosyne.Core and Tektosyne.Windows both produce IL code that not verifiable. The library is compiled in “unsafe” mode to facilitate efficient hash code generation in Tektosyne.Core, and various other tasks (Win32 interoperation, bitmap manipulation) in Tektosyne.Windows. If you require verifiable IL code for security reasons, you must pull out the stuff you need and recompile without the “unsafe” flag. Several classes in both assemblies are also not CLS compliant due to the use of unsigned integers.
Moreover, Tektosyne.Windows targets desktop applications running with “Full Trust”. If you are targeting a more limited permission set, such as Silverlight deployment, you will need to test the desired classes and methods for compatibility with that permission set.
Orthodox .NET programmers will also disagree with my coding style. While I’m using FxCop to check my code, I take the liberty to ignore any warnings I consider irrelevant. In particular, many types contain public or protected instance fields where a property wrapper makes no sense (and possibly impedes performance if the JIT compiler fails to inline the property accessor – which can actually happen).
To deploy a program that uses the full Tektosyne Library, or the precompiled assemblies in the Code Package, you need a Microsoft Windows system capable of running the Microsoft .NET Framework 4.0 Client Profile. This includes Windows XP SP3, Windows Vista SP1 or later, Windows 7, Windows Server 2003 SP2, and Windows Server 2008 & R2 with Internet Explorer 5.01 or later.
To create a program that uses the full Tektosyne Library, you also need either Microsoft Visual Studio 2010 or the free Microsoft Windows SDK 7.1 for Windows 7 and .NET 4.0. Both have the same system requirements as the .NET Framework 4.0 itself, but the Windows SDK also requires that you first install the full .NET Framework 4.0 – not just the Client Profile.
The code package also includes a suite of unit tests. You will need the free NUnit unit testing framework if you wish to run them.
Tektosyne.Core requires only four BCL assemblies:
System.Xml.dll. These four “core” assemblies are the minimum requirement for a Portable Class Library, and they are also supported by Mono. All Tektosyne.Core types should therefore work on any platform with any degree of .NET 4 compatibility, including Silverlight 4, Windows Phone 7, and XNA Framework 4.
Note: The Tektosyne.Core project and precompiled assembly in the code package is not actually a Portable Class Library, as this feature was never quite finalized for VS2010. Therefore, unless you’re targeting the .NET Framework 4 on Windows, you will have to create a new project for Tektosyne.Core with the desired target environment, and copy the individual source code files to the new project.
- The ReadMe file contains the copyright notice and technical details on the project.
- The WhatsNew file contains the annotated version history of the project.
Copies are included with the download package. We also have some executables that show the Tektosyne Library in action.
- Tektosyne itself comes with a small test program for various features, called
- Hexkit is a larger application that exercises most Tektosyne classes, although largely excluding computational geometry. The Hexkit User’s Guide describes the
PolygonGridclass which is the basis for Hexkit’s game maps.
- Myriarch is another larger application, with a focus on computational geometry.
Tektosyne.GuiTest contains a useful feature that helps with the creation of tiled maps based on real-world terrain. Choose Geometry: Save & Print Grid to show a dialog that allows you to save or print grids of arbitrary size that are composed of squares or hexagons of any side length and orientation.
You can print a grid on transparent film and overlay it on an atlas page to determine your map layout, or you can save a grid to a PNG file and use your favorite paint program to superimpose it on an image file with your real-world map. This is how I created the “Roman Empire” and “Battle of Crécy” demo scenarios that ship with Hexkit.
- Code Package & Class Reference: version 5.6.5, released on 10 September 2012
- Tektosyne User’s Guide: version 1.2.0, released on 09 June 2012
This archive includes all source code files, the XML documentation file generated by the C# compiler, and the library and test projects precompiled in release mode.
Class Reference — TektosyneClasses.chm (6.51 MB)
Created from XML source code comments using the free Sandcastle Help File Builder. To view the class reference, you need Microsoft’s HTML Help Viewer which should be present on most systems.
User’s Guide — TektosyneGuide.pdf (584 KB, PDF)
This guide presents an overview of the library’s contents, organized into thematically related groups. Unusual features such as the graph algorithms are covered in greater detail.
What’s up with the silly name?
Hey, do you have any idea how hard it is to come up with a pretentious Greek name that isn’t already taken?
The project was originally called the “Toolbox Libary” for the .NET Framework. Unfortunately, this was not a very distinctive name. You couldn’t use the library with any project that defined its own Toolbox namespace (not inconceivable by any means), and some people even thought the library was related to the Toolbox window of the Visual Studio IDE.
Tektosyne is sufficiently unique to avoid such confusion. Moreover, ή τεκτοσυνη (hē tektosynē) means “the art of building” which seems not entirely inappropriate for a toolbox library.