kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #41219
Re: VECTOR2I and VECTOR2D
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
Wayne Stambaugh <stambaughw@xxxxxxxxx>
-
Date:
Tue, 25 Jun 2019 12:36:36 -0400
-
Autocrypt:
addr=stambaughw@xxxxxxxxx; prefer-encrypt=mutual; keydata= mQGiBEM0hxQRBAC2fNh3YOVLu1d5GZ0SbrTNldGiGnCJPLqzEnqFX9v6jmf33TMt6EmSLkl6 Wtfkoj0nVwKxcYmJkA8DX0QAokBkwNIzhSsBzQvthBLIk/5LnPVVKrEXOcL4mUyH1doKlkaE slgJozNa6Av+oavcvD02o1zJOloBbaHlNlyRt7fKswCgtIFlVjWggVH/15KfWk+Qo5JVPbME AIUBAQyL2OAx0n60AWec2WHnO9buHuG0ibtICgUMkE+2MRmYyKwYRdyVwGoIUemFuOyHp0AJ InX4T+vy2E7vkwODqjtMLfIoRkokW74Fi4nrvjlhOAw/vdq/twLbAmR9MOfPTpR4y7kQy1O2 /n+RkkRvh26vTzfbQmrH7cBJhk6aA/9Uwvu3E4zNJgHVZeS0HyWtmR1eOPPRbnkPgJTToX5O KMKzTJI/FX6kT7cFoCamitHrW3BJP4Dx+cMMsa47EGxqVTdbVJ4LjogsXTXxb+0Fn1u4zBdx x3Cer6O7+hqWy7zvpzeC6nSREjqDKa5CgHtv/GLm5uFPOmsjAsnHj2tlBrQmV2F5bmUgU3Rh bWJhdWdoIDxzdGFtYmF1Z2h3QGdtYWlsLmNvbT6IeAQTEQIAOBYhBOffs6CbblRzBkv33BtR cWlZ+CReBQJbFBS2AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEBtRcWlZ+CReMI8A nRbrLkzp7+c2f0vX7sfg4ICX8LAKAJ9uClo4uJajmZa5zZrL2nKdZlUwIrkCDQRDNIcxEAgA gCru+3/aOC6RCjpvYC72wY+d5SmHphC6yeiV2/mOumyt5MLo/Ps2GznZr11JspqFk5K/Zpvp MMLqqjDZ39+50a2iKRQFJ6NlK+hJWMmj6eJygQrCwYo3Gjc6CqfrqUv+8VSnf/i5sIZmtOVA 4ZjML18MuBvMSsNdVLFJd5HNnYb1iOECpvqdPVh/21LLCEw7MUUGGnHBhCrmk2aJe5hFmcSN g4ldBcXrgMQBwf7aMVoobXBMFDb/IENByXn0llB7Gr2IFMRmNS9/p8s/II1Yl2bTqyX4FSz8 cfn7C9KEz7faZ7wzAcpwHFC/zs3JoAjJ0IEKdNUpIwAlKMzT3CzctwADBQf/cxpG28MKyrqk nNmq/8LQLy+x6FSYXBLjxQz9BiBNYeesDZQ6J5UbL1mjpJzMa5tLZypPYo4bbGyR22hrbyDF K7m6AcVaMIJKl98g4ukMutFfAJyRDaREH5Zl/X1P4u1Z/yaAIy9mKaNbaK1/5djNJ5wCTFen TUgAp9xdc30kGkFDdLJFp5uxDY4P0vaZiZdjUCvDM3Zjv5IzpNOfxVqTUBQNUP/BnnKhkk0p DTD6s3X8S+D0rOtEBQ8K0cwERI/E8EFa8nj0TNw4e2MYGR8wg+SxqJ7z5f0zPY0bO6G9DDFB wYCqzzPWGqdAh9vA5971TAbPERtdFybhkurozp2SfYhJBBgRAgAJBQJDNIcxAhsMAAoJEBtR cWlZ+CResHUAniULLCWiT26ieRTl7N2vS6vBo/DuAJ4m7Ss/gyiW6ybTn1ctDXAUgm2QVQ==
-
In-reply-to:
<20190623150311.GA1782@psi5.com>
-
Openpgp:
preference=signencrypt
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1
I guess I should comment on this seeing that I am the project leader. I
am fine with refactoring as long as it's an improvement over existing
code. In this case, I would say that some refactoring is in order
although I would proceed cautiously with the code in question. OOP does
not necessary translate to more maintainable and/or understandable code.
Please don't confuse programming paradigms for religion. I have been
at this for 30 years and have heard the promises (sales pitches?) of how
every new programming paradigm was going to save us from ourselves. I'm
still waiting ;)
On 6/23/19 11:03 AM, Simon Richter wrote:
> Hi,
>
> On Fri, Jun 21, 2019 at 10:54:04PM -0400, Reece R. Pollack wrote:
>
>> Just for discussion, let's assume the replacement for wxPoint is
>> named KiPoint. The result of subtracting two KiPoint objects would
>> be another object called KiDelta. Adding two KiPoint objects should
>> be undefined, and result in a compile-time error, as this is a
>> nonsense operation.
>
> I have something like that cooking in my "units" branch, but I'm cleaning
> up angles first.
Simon,
What changes are you planning for units and when do you expect to have
this done? I just branched myself to port the schematic internal units
to 100nm in preparation for the new file formats so I'm sure there is
going to be conflicts. If you are almost ready to merge, I can wait but
I'm ready to get started on this so I would rather not wait too long.
Cheers,
Wayne
>
> Plan:
>
> - create strong types for angles and orientations [done]
> - literal handling with unit suffix [done]
> - replace all instances of angles in the codebase [under way]
> - drop code to support angles expressed as doubles, ints, ...
>
> Replacing points will be too big to do in a single commit, so:
>
> - create strong types for lengths and points [needs rework]
> - literal handling with unit suffix [mostly done]
> - compatibility code for automatic conversion to existing formats [mostly
> done]
> - piecewise replacement of existing coordinate code
> - remove compatibility code
> - remove old code
> - remove -DEESCHEMA, -DPCBNEW etc.
> - merge pcbcommon into common
>
> The way I went with my approach was that there is a length class that
> expresses a 1D length in either nanometers. A separate class does the same
> for pixels.
>
> 2D coordinates have a template parameter for the underlying 1D type, and
> for the origin point they are relative to:
>
> - no origin
> - (0, 0)
> - current reference (set with the space bar)
> - auxiliary axis (set with the aux axis tool)
>
> Adding and subtracting then makes sure origin points are consistent, and
> multiplying with the current zoom level converts between world and screen
> coordinates.
>
> The initial implementation went a bit wrong because the angle handling
> needs to be done first -- the transition requires adding a new coordinate
> type parallel to the existing ones, which also requires a full set of
> Rotate* functions (degrees as double, tenth-degrees as double,
> tenth-degrees as signed int, radians as double), so reducing all of these
> to one makes this manageable.
>
> Simon
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References