Hi again Andreas,

* I've figured out the problem with the recognizer. Line 479 of 
ShapeRecognizer.cpp, the call to findPolygonal() at the beginning of 
recognizePatterns() should have the third parameter
stroke->getPointCount()-1  instead of stroke->getPointCount().
Namely, change line 479 to

int n = findPolygonal(stroke->getPoints(), 0, stroke->getPointCount()-1, 
MAX_POLYGON_SIDES, brk, ss);

(just add the "-1").

This gets line segment recognition working properly, and also 
recognition of triangles and rectangles drawn in a single stroke.

* This can wait, but it's an easy thing: you might want to make 
recognizePatterns() abort (return NULL) if stroke->getPointCount() is <= 
2. If I just make a single dot, there's no point in trying to recognize 
it, and I have the impression that something slightly strange is 
happening in that case (the dot disappears?), so it's perhaps safer to 
not pass such tiny strokes to the recognizer.

* One feature that doesn't work but isn't urgent to fix is recognition 
of a rectangle whose sides are drawn as separate strokes (i.e. if I draw 
the sides one or two at a time, in the "correct" order, then xournal 
combines the strokes into a rectangle). The issue is that you always 
call resetRecognizer() at the beginning of 
ShapeRecognizer::recognizePatterns(), which resets the queue of recent 
patterns that might still be combined into a bigger polygon. By 
contrast, xournal only resets the queue at the beginning of a 
recognition if something strange has happened since the last pattern 
recognition (namely, either the last item in the undo queue is not what 
it was last time we ran through this code, or we're no longer drawing on 
the same layer). This is a tricky test to make reliably; it is also the 
main reason why xournal resets the recognizer in a lot of places in the 
code (because e.g. if I start drawing an edge, then change the color of 
the pen, then continue drawing the rest of the edges, then clearly I'm 
not trying to draw a single rectangle). There should be a clean way of 
allowing the recognizer to keep its queue only if "nothing has happened" 
since the last time we ran recognizePatterns(), and reset it otherwise; 
but I haven't figured out a good way to do this.

Anyway: this last point is not too important and I'm sure it can wait.

Best,
Denis

-- 
Denis Auroux
MIT Department of Mathematics           aur...@math.mit.edu
    (on leave) and
University of California, Berkeley      aur...@math.berkeley.edu
Department of Mathematics               Tel: 510-642-4367
817 Evans Hall # 3840                   Fax: 510-642-8204
Berkeley, CA 94720-3840

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Xournal-devel mailing list
Xournal-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xournal-devel

Reply via email to