/** * Perform segmentation * * @return segmentation interpretation */ private Segmentation doSegmentation() { Segmentation seg = new Segmentation(); ArrayList<Stroke> substrokes = new ArrayList<Stroke>(); Stroke s1 = new Stroke(); Stroke s2 = new Stroke(); for (int i = 0; i < m_features.getNumOrigPoints(); i++) { if ((double) i / m_features.getNumOrigPoints() >= 0.5) s2.addPoint(m_features.getOrigPoints().get(i)); else s1.addPoint(m_features.getOrigPoints().get(i)); } substrokes.add(s1); substrokes.add(s2); // Set the parent for (Stroke substroke : substrokes) { substroke.setParent(m_features.getOrigStroke()); } seg.setSegmentedStrokes(substrokes); seg.setSegmenterName(S_SEGMENTER_NAME); return seg; }
/** * Constructor for segmenter * * @param features features of the stroke to segment */ public VSegmenter(StrokeFeatures features) { m_features = features; m_useSmoothing = features.isSmoothingOn(); }