Giter VIP home page Giter VIP logo

Comments (4)

lnicola avatar lnicola commented on September 28, 2024 2

Of course you can access the coefficients, you can apply the transform to (0, 0), (1, 0) and (0, 1) and compute them šŸ˜„.

TBH they could even be public, but it's fine either way.

from geo.

kylebarron avatar kylebarron commented on September 28, 2024

I'm +1 on this. It doesn't look like there's any way to currently access those fields, even with a From impl. I don't think Rust has a concept of a getter so those attributes would have to become methods. I'm ok with using a-f letters for naming, since that seems pretty standard and we can additionally link to perrygeo's blog (I also go back to that blog post often!)

from geo.

urschrei avatar urschrei commented on September 28, 2024

I'm happy to have the fields be public, but I'm pretty sure the current field names are correct and meaningful in terms of affine transforms generally (see e.g. Shapely's affinity module); xoff and yoff are calculated offsets and I'd rather not rename them just to conform to Matt's terminology (it is a great blog post, btw).

from geo.

weiji14 avatar weiji14 commented on September 28, 2024

It doesn't look like there's any way to currently access those fields, even with a From impl. I don't think Rust has a concept of a getter so those attributes would have to become methods.

Found out at https://users.rust-lang.org/t/access-tuple-struct-with-one-element-more-ergonomically/27236 that there's an Index trait in std (see https://doc.rust-lang.org/std/ops/trait.Index.html) which seems to allow indexing into the array/matrix. Have started a draft PR at #1159 as a proof of concept. This enables indexing using transform["a"] or transform.index("a"). I could also rewrite things so that accessing the elements happens via transform.a() if that's more ergonomic. Edit: refactored implementation to use getter methods like transform.a().

Next point is to decide on the naming. To be clear, the current AffineTransform tuple struct doesn't set any names like c or xoff, it is only in the documentation. So we can go with either a,b,c,d,e,f naming or a,b,xoff,d,e,yoff.

from geo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.