Bastian Molkenthin - Sunshine2k

arrow Java


(Projected) Point on Line (2D) Algorithm

(Projected) Point on Line (2D) Algorithm Date : December 2013
Source available : YES

Description :
This article explains different algorithms about the relation of a given point to a given line in the two-dimension case:

Read the article now!
Download source package (70 kb)



Applying Hough Transform for detecting lines in images

Applying Hough Transform for detecting lines in images Date : December 2012
Source available : YES

Description :
This article explains how the hough transformation for detecting lines in images works. The associated applet implements following steps:
Converting an image to grayscale, apply sobel filter for edge detection, creating a threshold-based edge image, perform the calculation of the hough transformation and converting the detected lines back to overlay on the source image. Have fun!

Read the article now!
View the applet online now!
Download package (170 kb)



Software Rasterization Algorithms for Filling Triangles

Software Rasterization Algorithms for Filling Triangles Date : May 2012
Source available : YES

Description :
This article explains three different algorithms how to rasterize a triangle:

Read the article now!
Download source package (153 kb)



PointInTriangle Algorithm

PointInTriangle Algorithm Date : December 2011
Source available : YES

Description :
This article explains two algorithms about how to detect if a point is inside a traingle. One algorithm uses the so-called perpDotProduct to check the point againt the three edges of the triangle. The second one uses barycentric coordinates for triangle representation and evaluates the final equations using Cramer's Rule.

Read the article now!
Download source package (39 kb)



StoneBreak

StoneBreak Date : June 2011
Source available : YES
The source code of the leveleditor is also available and coded in C.

Description :
This is my own Breakout clone written in Java. Main Features are:
- Written in Java - no images used, all graphics done by code using Graphics2D!
- Comes with ten levels, but...
- a leveleditor (with free source) is included!
- 5 special effects that drop randomly

Go to the StoneBreak site now!
Download source package (47 kb, incldues game and leveleditor)



Parsing Algorithms

Parsing Algorithms Date : October 2010
Source available : YES

Description :
Here I present an article including full source code about parsing simple mathematical expressions. The theory behind each approach is highlighed without going too much into detail, but enough for understanding and useful as a starting point for diving into this topic. More emphasis is taken on the practical side. Three approaches are handled:

* Recursive parsing of infix expressions
* Creating & evaluation of postfix notations using stacks
* Syntax trees directly from infix expressions

View parsing algorithms article
Download source package (60KB)



14-15 Puzzle

14-15 Puzzle Date : February 2010
Source available : YES

Description :
This applet is the implementation of the famous 14-15 puzzle game. Not only you can play it online here, it also contains an automatic solver that solves each solvable puzzle in front of your eyes. Moreover, random puzzles can be generated using two different algorithms. Finally, the site contains also some theory of the puzzlee.g. when is a puzzle sovalbe or not, how does the automatic solver works, how to generate random (solvable) puzzles... Interested? Go and check it out now :)

14-15 Puzzle Applet Online + Theory & Implementation Details

Or for offline use and source code investigation... download whole package

Download source package (116KB)



Resistor/Electronic Color Code Applet

Resistor/Electronic Color Code Applet Date : October 2009
Source available : YES

Description :
My first coding attempt in JavaFX - a little applet that calculates the resistance of an electronic resistor given the colors of the bands and also the other way round (enter a resistance value and it calculates the color code).

Resistor Calculation Applet Online (Notes & Applet)

Or for offline use and source code investigation... download whole package

Download source package (122KB)



Online Calculator

Online Calculator Date : July 2008
Source available : YES

Description :
My Online Calculator can evaluate mathematical expressions in various numerical systems. Quite handy when you have no hand calculator at your fingertips. Has even a autocomplete feature.

Online Calculator

Or for offline use and source code investigation... download whole package (applet, source, manual)
Download source package (120KB)



Welzl's 'Smallest enclosing disk' Algorithm

Welzl's 'Smallest enclosing disk' Algorithm Date : May 2008
Source available : YES

Description :
My own notes about Welzl's algorithm for calculating a smallest enclosing disk (minimal enclosing circle) of a set of points in the plane. It's a interesting & surprisingly quite simple algorithm with linear execution time.
As always with a nice applet and its source...

View Welzl's Algorithm (Article & Applet)
Download source package (26KB)



Sutherland-Hodgman-Algorithm

Sutherland-Hodgman-Algorithm Date : December 2007
Source available : YES

Description :
My own notes about the Sutherland-Hodgman-Algorithm for clipping a polygon against a rectangle. As always with a nice applet and its source...

View Sutherland-Hodgman-Algorithm article
View Sutherland-Hodgman-Algorithm applet
Download source package (23KB)



Cohen-Sutherland-Algorithm

Cohen-Sutherland-Algorithm Date : December 2007
Source available : YES

Description :
My own notes about the Cohen-Sutherland-Algorithm for clipping 2D lines against a rectangle. As always with a nice applet and its source...

View Cohen-Sutherland-Algorithm article
View Cohen-Sutherland-Algorithm applet
Download source package (25KB)



Bresenham-Algorithm

Bresenham-Algorithm Date : November 2010
Source available : YES

Description :
This applet demonstrates various plotting ("rasterising") algorithms to draw lines, circles and ellipses. Following algorithms are included:
* Line Raster Algorithms
   - Digital Differential Analyzer Algorithm
   - Bresenham Algorithm using floating point numbers
   - Bresenham Algorithm using integer numbers
* Circle Raster Algorithms:
   - Simple approach 1
   - Simple approach 2
   - Bresenham Algorithm using floating point numbers
   - Bresenham Algorithm using integer numbers
* Ellipse Raster Algorithms:
   - Bresenham Algorithm using integer number


Article about rasterizing lines and circles (PDF, 572KB)
View Bresenham Applet online
Download source package (42KB)



Skyscrapers Quest

Skyscrapers Quest Date : October 2007
Source available : YES

Description :
This is a little game you find in a few magazines. It's a logic-based number placement puzzle similar to sudoku. I coded a nice little applet with 30 quests waiting for you to be solved!
Also my own solver is now waiting to be downloaded, a straighforward backtracking approach. But read more about it..

View Skyscrapers Quest article and applet
Download Applet (for offline play, 33KB)
Download source package (130KB)

Download the Solver (12KB)



Polygon Algorithms

Polygon Algorithms Polygon Algorithms Date : September 2007
Update : July 2010 (bug in polygon filling)

Source available : YES

Description :
In some spare time, I delved into some polygon problems I have always been interested in and of course into the corresponding algorithms to solve them. So here are some small articles with my own notes about them :-)

Part I : Polygon Convexity
Part II : Polygon Filling with Scanline Algorithm
Part III : Polygon Triangulation with Kong's Algorithm



Curves Applets

Curves Applets Curves Applets Date : July 2007

Source available : YES

Description :
Here you find some applets (with sources) and comments about Bezier Curves to understand them better. I coded them for myself but decided to publish them, perhaps they help also someone else. Note that this page will be slowly updated with new stuff.

Existing topics till now:
* Linear Interpolation of two points
* Quadratic & Cubic Bezier Curves
* The Bernstein Form of a Bézier Curve
* The de Casteljau Algorithm
* Degree Elevation

View articles and applets online



Card Game "Hexen hexen"

Card Game 'Hexen hexen' Date : June 2007

Source available : YES

Description :
A card game I played as little child. Now YOU can play it as applet..

View article and play game online (loading may take some time because applet size ois 200KB)
Download source package (includes applet, backtracking tool and of course all sources; 790KB)



Sudoku Solver

Sudoku Solver Date : November 2006

Source available : YES

Description :
Solves sudoku puzzles with Algorithm X and Dancing Links.

Download source package (11KB)
References to articles concerning AlgoX and DlX:
- Knuth's original paper about Dancing Links
- Exact Cover @ Wikipedia
- Algorithm X @ Wikipedia

Here is the solver I started first. This approach uses a backtracking algorithm which tests all possiblities. It's a bit slower than the above one.
Download source package (Backtracking Approach) (6KB)



Blood-Alcohol-Concentration Calculator

Blood-Alcohol-Concentration Calculator Date : June 2006

Source available : YES

Description :
This applet calculates your blood alcohol concentration based on the drinks you had. You can choose which approximation formula should be used.

View applet in English
View applet in German
Download source package (27KB)



Simple Collision of Two Balls

Simple Collision of Two Balls Date : May 2006

Source available : YES

Description :
Some time ago I dealt with 2D collisions of balls. So why not share what I have thought of :-) Here are some notes concerning simple 1D/2D collision of balls and two applets showing this stuff in action. Source included in the zip file.

View applet & instructions online
Download source package (55KB)



Eight Queens

Eight Queens Date : October 2005

Source available : YES

Description :
The eight queens puzzle is the problem of putting eight chess queens on an 8?8 chessboard such that none of them is able to capture any other using the standard chess queen's moves. This applet gives you the possibility to find a solution yourself, or it calculates all solutions, for the general case of putting n queens on a nxn chessboard.

View applet & instructions online
Download source package (60KB)





This site is part of Sunshine's Homepage