DRAWING CLARIFICATION:
Drawing classification is tied to right-click. When you press and hold right-click, everything that you draw before you release right-click will be classified. Other overlapping drawings may interfere with classification, but won't interfere with corner detection.
Corner detection relies on the door being drawn in exactly 2 strokes (1 stroke = hold left-click, draw, release left-click) with the first line being the door frame and the second being the door knob. I already have a fix in mind for this, but for the sake of time, I implemented it with these more restrictive mechanics. If you draw a door and the drawing disappears entirely, it should be because you didn't use exactly 2 strokes to draw it. Otherwise, if it doesn't activate, it's because the classifier didn't recognize it.
For anyone curious on how it works:
Drawing classification is done using a Convolutional Neural Network that I trained using drawings of the door rune that I manually drew and saved out in-game. I drew the rune 100 times and then programmatically altered the images slightly (e.g., random rotation, coloration, etc.) to generate 1000s of images of the door rune. I aslo drew hundreds of examples of things that aren't the door rune (e.g., scribbles, squares without knobs, circles). I then trained the classifier to recognize these two classes. It's definitely not perfect. Ideally I'd have hundreds of thousands of examples from lots of different people to train on.
The corner detection basically just looks at the dot product between three points (i.e., Dot((P1-P0, P2-P1)). This dot product is proportional to the angle between the vectors. If both vectors are normalized, then the result will be between -1 and +1. A positive dot product means the two vectors are generally pointing in the same direction and a negative means opposite directions. 0 means that they are perpendicular. Using this I assume that the smallest 4 dot products should correspond with the 4 corners, but this is only true for relatively smooth surfaces.
Sorry for any furstration this may cause. This stuff is very experimental!