> Seriously, brute force is synonym of dumb. If you cannot solve the problem by anything else than using brute force, then first thing you do, you leave an extensive comment "sorry guys, this piece stinks, but i was <...> unable to do any better".
That is enough, Igor. Calling other developers or their decisions "dumb" is unacceptable! It is far way beyond a red line and only shows impoliteness. You are not trying to constructively criticize but just trolling us. Here are some basic rules if you want to continue discussion: 1) Before "pushing" other people to spend time on you, try to spend your own. Read previous posts at least in the same thread before writing an email. Link to bloc build was in the second email but you asked for it 2 or 3 messages later. 2) Don't use "pfff...", "yadda yadda", " pony" or whatever other jargon in any thread related to bloc. It distracts and shows your disregard to the reader. 3) Don't judge others that they don't know or understand something. There are no stupid people around here. 4) Write short but informative emails. We have a lot of other stuff to do. Everything that you wrote can be expressed using much less amount of characters. 5) First ask why decision was made and only then describe cons and pros. There is obsolete code in multiple places left because it maybe forgotten or we realized that it was a mistake but accidentally committed. That shadow problem was a mistake and big thanks to Glenn who explained and fixed it in bloc a lot of month ago by using ShadowFilter which is in another repo for a moment. 6) When criticizing try to find and mention also positive desicions. It is called politeness. Thanks Alex On 5 April 2016 at 01:12, Igor Stasenko <siguc...@gmail.com> wrote: > > > On 5 April 2016 at 00:51, Andrei Chis <chisvasileand...@gmail.com> wrote: > > btw, Andrei , if you looking how you can test if point contains shape or > not, take a look at AthensCurveFlattener. > It converts curved path, that containing Bezier curves (or not) into > simple polygonal shape that consists only from a simple lines. > Then there AthensPolygonTester, that has the piece you missing: > - a small algorithm that can test if given point inside or outside that > polygon. > > Please note that it is simpler even-odd rule algorithm. It not works > correctly for all possible cases. > > There's another algorithm- winding number algorithm, that is much better, > but i had to switch to other stuff before were able to get my hands to it. > It is more reliable, since it can work for self-intersecting shapes. > > https://en.wikipedia.org/wiki/Point_in_polygon > > So, what you need is to wire these things down to Bloc.Then whenever you > need to test whether point within shape or not, you can convert any path > into polygon and perform the test. And of course, you can cache the results > of conversion in order to avoid expensive computations every time you need > to perform such tests. Once path is converted, the test is relatively cheap > and costs something like O(n), where n is number of line segments. > > Or maybe, to simplify things, you could extend the shape protocol and > introduce #containsPoint: > or as variant #containsPoint:ifNotAvailable: > so that if shape implements such feature - it can answer true or false, > and if not - evaluating a block. So, you don't have to implement all tests > for all kinds of shapes that invented or not yet invented in universe. > > Oh, forgot to add, you can look for example how i converting path in AthensBezier3Scene class. > -- > Best regards, > Igor Stasenko. > -- Best regards, Igor Stasenko.