OneLoneCoder / olcUTIL_Geometry2D

A Single-Header 2D Geometry Analysis Library
Other
284 stars 50 forks source link

[Feature Request] Transformation support in R2 #75

Open msaucedo opened 4 months ago

msaucedo commented 4 months ago

Hello, nice little project here. Wondering if there are plans to introduce maths support for 2D transformations?

This would be invaluable for all sorts of things.

I have such a maths lib buried somewhere. It involves a Matrix2x2 class a Transform2D class (which is really a Matrix 2x3), etc.

OneLoneCoder commented 4 months ago

I have one for PGE3, I could pull that into this utility. Need to think about it as I've kept that separate presumably for a reason lol 😆 I think it's because transforms needs matrices, matrices need matrix operations etc. it could become a large file of mostly matrix and transform stuff, and that's not strictly speaking, geometry Vs geometry interactions.

msaucedo commented 4 months ago

Thanks for the reply. I mean, I agree about your 'one header to rule them all' paradigm can get unweildy rather quickly. Yet I'd argue transformations in R2 will be a core thing your library here will miss, and is very relevant for geom expression. I'd hate to think anyone basing their library arcitecture on the need/desire to keep everything in one header. Perhaps use .inls? Anyway,to each their own. :) I mean, I suppose I can appreciate the experiment you have going on here.

For example. Your RECT object. Is it always axis aligned? I'm just thinking of all sorts of things I'd like to do in such a lib [as yours] yet without transformations...just ouch; a tad more difficult. Like create a world of arbitrary units, and allow panning, scrolling, zooming, rotating. Such a transformation toolset will also allow for nice Camera2D class. Alas. As you say, just use an adjacent library I suppose.

Cheers

OneLoneCoder commented 4 months ago

Thanks, I'm guessing by your response you're not too familiar with OLC output in general and I don't blame you 😄. This is a weird esoteric little corner of the web. I agree entirely, transformations et al are vital, and are covered by many other things within the OLC ecosystem, we have Transform2D, Camera2D, Animate2D, Matrix2D. This repo is isolated because it needed/needs community involvement.