CONTENTS DELETED
The author has deleted this message.
|
On 11 April 2014 17:41, Juraj Kubelka <[hidden email]> wrote:
Which will mean 6 extra #asFloat message sends, even if they're already floats or ints but not Fractions (and in 99% of cases they are, so you will slow down everything for the sake of 1%). I prefer that user supplies already prepared data, so it don't have to be implicitly converted since it takes extra CPU cycles, which can be spent somewhere else.
But yes, it needs to be ensured, but at different place: where you building that AthensAffineTransform AthensAffineTransform>>sx: number sx := number =>>> AthensAffineTransform>>sx: number sx := number asFloat .. (and for the rest of accessors) like that it will ensure that AthensAffineTransform always stores floats, which i'm not really like because integers is perfectly fine too.. its all about Fractions.
On your place i'd better forget about it. That's impossible when you dealing with floating point values.. and multiple matrix operations. Unless you explicitly control it by yourself, but that certainly should be outside of AthensAffineTransform/Athens.
Again, that would mean dozens of extra message sends at every single place, whether it needed or not.. Like: AthensCairoMatrix>>translateX: px Y: py needs to be replaced with: ^ self primTranslateX: px asFloat Y: py asFloat instead of direct call, plus adding #primTranslateX:Y: method, of course.
Do you really want to pay a price of 50% less performance (or more) in exchange of "i don't wanna think what i passing to it"? Because apparently, you always need to think what you passing - one cannot just pass a random object to some method and expect it to work, isn't? Because i don't. All you need is to avoid using Fractions.. because integers or floats is perfectly fine. Fraction created only if you use division on integer.. so all you need to do is to ensure the result of division is float: (x/y) asFloat.
I am biased towards having better performance, even at cost of inconvenience, where at some places i have to ensure i need to pass correct value(s).
-- Best regards, Igor Stasenko. |
CONTENTS DELETED
The author has deleted this message.
|
On 11 April 2014 20:24, Juraj Kubelka <[hidden email]> wrote:
it doesn't really matters.. and up to your convenience. sometimes it's convenient to use decomposed form (e.g. translation, scale, rotation) instead of full matrix,
sometimes not.. depends how/who/where you using it.
Because there's only one method which draws any kind of shapes (including rectangle). All you need to do is to draw it: canvas drawShape: (0@0 corner: 100@100). or canvas setShape: (0@0 corner: 100@100). ... canvas draw. else there would be need to add dozens of drawRect: drawOval: drawZigZag: drawAnotherWeirdThing: instead of simple method which covers all. Thank you, Juraj
El 11-04-2014, a las 13:29, Igor Stasenko <[hidden email]> escribió:
-- Best regards, Igor Stasenko. |
Free forum by Nabble | Edit this page |