dcv
dcv copied to clipboard
~= concatenation should be removed
From RHT module:
/// Run RHT using non-zero points in image as edge points.
auto opCall(T)(Slice!(2, T*) image)
{
Point[] points;
foreach (y; 0 .. image.length!0)
foreach (x; 0 .. image.length!1)
{
if (image[y, x] > 0)
{
points ~= Point(cast(int)x, cast(int)y);
}
}
return this.opCall(image, points);
}
This example has 2 issue. The first is slow indexing. The second is ~= concatenation, which changes complexity from O(n) to O(n^2).
Will refactor it in #58. Thank you.
Please see aead0ada816b9b6c025f0df7cdf9a1fd96e732eb.