Adds a new point to the end of the line.
Source
void addPoint(Point point) { // Skip duplicate points if (points.length > 0 && point.x == points[points.length - 1].x && point.y == points[points.length - 1].y) return; if (simplify && points.length >= 2 && GameMath.distanceBetweenPoints(point, points[points.length - 2]) < 10.0) { // Check if we should remove last point before adding the new one // Calculate the square distance from the middle point to the line of the // new point and the second to last point double dist2 = _distToSeqment2( points[points.length - 1], point, points[points.length - 2] ); // If the point is on the line, remove it if (dist2 < 1.0) { _points.removeAt(_points.length - 1); } } // Add point and point's age _points.add(point); _pointAges.add(0.0); }