Hi guys (and girls?), I dont rly know where to post this but I guess this is the right choice.
I had an idea today: I want to make motions with my mouse and the computer to recognize what ive drawn there. Easy enough: I create a path object and say path.lineTo(current mouse position). Then I have some predesigned figures that I can compare the path with and say which it fits. Thats the whole concept.
Nows my question: how do I organize this?
Heres what I have so far:
It works but im not entirely satisfied with the class design. As you can see(if you opened my project) I have a class "Line"(I rly need a better name for this), which is the base for all "Figures". Every Figure consists of multiple Lines that are arranged in some way. Each Figure has a method matches(ArrayList<Path> paths) that checks if the given paths form that figure and then returns true or false.
Now ive made these Factory-classes which contain methods like createCross(), that obviously create the figure that the method says. This whole factory thing works, but I dont really like it oO maybe someone has a better idea to design this?
I also want to make a class like "BiggerFigures" which consists of figures instead of lines to make even "Bigger Figures" recognizable.
So im looking for design suggestions. I want to keep the systems flexibility to a max but I currently have no good ideas :/
A short introduction to the program i created:
The figures that can be drawn are at the bottom of the window: a vertical line, a horizontal line, a cross and a "日"(hi, jap. for sun or day). Booleans at the left for you to see what youve drawn there. A timer above them(You have 10s to draw something, if thats too short just change it lol) and at the top right the mouse position.
To start drawing press the "e"-key. To draw press the left mousebutton and move the mouse. When you release it and press it again a new path will be started. Press e again to stop drawing or wait for the time to run out.
The cross as no strokeorder, so you can start drawing wherever you want. When you want to draw 日 you have to make the strokes in the right order and direction. Its not yet 100% accurate tho. The correct order would be this:
So there are 4 strokes total. But you have to seperate the 2nd stroke into 2 (means: release the left mousebutton when you hit the upper right corner and press again, then move down). So there are 5 strokes, simply because i havent implemented edges or curves yet.
If you guys have any ideas how to organize this better or how to improve a algorithm or simply have a better name for something, let me here it
