bot.dart icon indicating copy to clipboard operation
bot.dart copied to clipboard

What geometric class to we need

Open eskimoblood opened this issue 13 years ago • 5 comments

I think about to implement line, ellipse, triangle, rect, polygon classes. Also the Size class needs to be rewritten as it only works for rects. Btw. why is the rect class called PRect?

eskimoblood avatar Jun 03 '12 13:06 eskimoblood

RE: Rect: there's already a Rect type defined in a core library that was causing naming conflicts.

Most of my inspiration has come from the Closure library. Here's the github mirror, pointed to the math libraries: https://github.com/jarib/google-closure-library/tree/master/closure/goog/math

kevmoo avatar Jun 03 '12 18:06 kevmoo

Coming from Processing I prefer Karsten Schmitds toxiclibs which has some more geometric stuff. https://bitbucket.org/postspectacular/toxiclibs/src/35d289f02791/src.core/toxi/geom/

Is there a need to make a the constructor of PRect constant?

eskimoblood avatar Jun 03 '12 20:06 eskimoblood

Ooo. Love the toxic libs. A great place to start.

PRect being const: For these smaller types, I love the idea that they are immutable. Having a const ctor means it can (although doesn't have to be) a compile-time constant.

kevmoo avatar Jun 03 '12 21:06 kevmoo

But you cant change scale, translate the rect after creating, or miss I something here?

eskimoblood avatar Jun 03 '12 21:06 eskimoblood

But you cant change scale, translate the rect after creating, or miss I something here?

Correct. Operations that scale/traslate the rect should return new Rects.

kevmoo avatar Jun 03 '12 21:06 kevmoo