From day to day it is very frustrating to develop projects, stuff for my study and things like that and then… yes then… just let the source code rot in my code repositories. Or delete them right away because I know that I do not need those projects anymore. That’s very frustrating. And as Scott Hanselman wrote – dozen of others wrote that too – it’s time to publish those countless open source projects. That’s my new mindset and goal for all those hundreds thousands of lines of code. In whatever language I wrote them. Whatever technology and IDE I was using at that time. I try to publish all of those projects, separated into single blog post with some screenshots, code examples, explanations or whatever it take to show what I’ve done or tried to achieve :).
The Application
As already mentioned, the application was build just for demo purposes. As far as I remember as a side project to learn the calculation of bézier curves within the module „Mathematics III“ in my Bachelor of Computer Science. That was in the end of 2010. The demo is implemented as an Windows forms application with a single split window and some controls in a toolbar. The two figures 1 and 2 shows some example curves created with the demo.
- Fig. 1: Example bézier curve with four control points.
- Fig. 2: Example bézier curve with nine control points.
Through the buttons and the text field in the toolbar you can control some characteristics of the application itself or the calculated bézier curve. You can clear all visible control points on the drawing area, activate the real time calculation, connect the calculated points and change the control variable called t. The real time calculation means, that, if you drag a control point, the bézier curve gets instantly recalculated. The control variable t is the amount of points, that is calculated or in other words: how many points will create that curve, because every pixel of those bézier curves are calculated separately within a loop.
On the left side you can see all control points in the same order as they were created. Select them and hit delete to remove a control point. Or right click on a control point to delete this point.
That’s all. There’s nothing more in this demo application.
The Project
The project is divided into three Visual Studio projects. One as a startup project, another one for the GUI and last but not least a project for the business logic layer. Latter contains the calculation for the bézier curves.
There’s not NuGet package or other external dependencies. All is self implemented.
You can use Visual Studio to build the solution or the integrated build script called build.cmd. This script calls the fake.exe that is responsible for the complete build procedure. So this projects using the awesome FAKE build tool. And Paket is on board too, because the FAKE dependency is resolved with the Paket dependency manager that can handle NuGet packages.
The source code is available at GitHub.
Known Bugs
At this stage I’m not really aware of many bugs. Not because I’ve searched or tested a lot :). Just because I did not look very closely. The main reason is, that I tried to release this project as soon as possible. It’s waiting for four years within a dark and cold Git repository.
But I found a bug with a simple test. The following two figures 3 and 4 are showing this very obvious bug.
- Fig. 3: Malformed bézier curve after the 14th control point.
- Fig. 4: Wrong bézier curve after the 15th control point.
Maybe someone wants to dig into my code to find this bug :). To be honest: I haven’t looked yet what could be the reason for this.
And just to be clear: the code is not really good, four years old and not documented at all. Just to be fair. I’ve warned you ;).
Conclusion
That’s all. As far as I can remember, this project was really fun. Not that much effort nor time consuming, but just fun. And I hope this is just the first blog post in a beginning series of post where I can show some small and old side projects of mine. Maybe they are helpful for someone.
Schreibe einen Kommentar