Since this is a library that works with images, naturally there's a ton of 2D point math going on in the code. I feel like putting in effort here will have a big return on investment, since it's such an integral part of the program logic.
Some points that can be improved in particular:
- The struct seems to be mostly passed around by reference. This means we end up with dereferences everywhere and the code is harder to follow. The struct itself only holds two floats, so passing it by value would be better I think.
- Point logic can be refactored in some places to make the intent clearer.
- Some functions expect rectangles, which are typed as
&[RXingResultPoint]. A dedicated rectangle type would be better here for type safety.
I'm opening a PR that addresses the first point, and I'd like to tackle points 2 and 3, though that's a more long-term goal.
Goals
Since this is a library that works with images, naturally there's a ton of 2D point math going on in the code. I feel like putting in effort here will have a big return on investment, since it's such an integral part of the program logic.
Some points that can be improved in particular:
&[RXingResultPoint]. A dedicated rectangle type would be better here for type safety.I'm opening a PR that addresses the first point, and I'd like to tackle points 2 and 3, though that's a more long-term goal.
Goals
RXingResultPointto justPointRXingResultPointand similarly named methods in therxing-one-d-proc-derivecrateMathUtilsmodule, since it holds duplicated logicResultPointtrait (all uses in repo removed, but the type still remains because of proc macro)Pointtype in theaztecmodulef32parameter pairs and(f32, f32)tuples withPointa + binstead oflet x = a.x + b.x; let y = a.y + b.y)