Skip to content

Refactoring RXingResultPoint usage #12

@Asha20

Description

@Asha20

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:

  1. 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.
  2. Point logic can be refactored in some places to make the intent clearer.
  3. 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

  • Rename RXingResultPoint to just Point
    • Rename in this repo
    • Remove references to RXingResultPoint and similarly named methods in the rxing-one-d-proc-derive crate
  • Remove the MathUtils module, since it holds duplicated logic
  • Remove the ResultPoint trait (all uses in repo removed, but the type still remains because of proc macro)
  • Remove the Point type in the aztec module
  • Replace all f32 parameter pairs and (f32, f32) tuples with Point
  • Refactor point math code (use a + b instead of let x = a.x + b.x; let y = a.y + b.y)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions