Right, i have a load of points in a 2d array, in a certain order:
I want to draw lines beween them of a certain (variable) thickness (think locii of connected lines) so that any point within a certain distance from the dots and the imaginary lines connecting them has some operation performed to them (in this picture they are made black). Like this:
Surely i could work out every point on the lines and then draw a circle around it and then set a flag so that the points around it arent processed again, but that would be much too slow! How could i speed that up?
neither now shut up or help
yeah weaver's way is faster, but i think there must be a way to make it faster still, probably with matrix algebra or something
If we knew what it was for we could answer you better.
My thoughts would be to use more points inbetween the points, sorta like a dotted line, spaced apart by x*0.6, where x would be the breadth/thickness of the lines you describe.
When you get a new point you need to check, split the problem space into 4 quadrants, and search for the nearest existing point to the new point in the new points quadrant. Then measure the distance and if distance <= the x of that point, then it is inside the line, else it is outside.
Or you could list each point in turn, and find the gradient of the lines joining them up. Then all you have todo is check the gradient of the new point against existing points, and if the gradient of the new line is equal to the gradient of any of the existing lines then it is on the line, and if it is inside but nto on then you'd ahve to vary it to how big the difference is in proportion to what x is.
Or you could use a grid approach, flagging grid squares that have a point in them, or have a lines passing through or nearby. That would mean generating the grid data would eb costly, but after that the checks are much faster. Find which grid square the new point is and check if it's flagged.
Where else have we seen these diagrams from krogothe?!?!?! his mex class! And what was it that somebody recently told me about how NTAI handled mex spots (maybe it was in a pm with an NTAI test build log), how they didnt follow a path to make visiting each mex in turn more efficient... I think that might be what krogothes doing, if not it's given me enough to try and implement it once my exams are done.
hmm that and I now know how I'm gonna do DT walls.....
neither now shut up or help
yeah weaver's way is faster, but i think there must be a way to make it faster still, probably with matrix algebra or something
Whatever way you do it, the thing that actually takes up most of the CPU time will be rasterizing it onto a grid, and accessing whatever 2D array you want to access.
I would also represent everything by quads, then you don't have to make a seperate rasterization for the circles. Now just make a fast quad rasterization. There are plenty of tutorials about software rendering anyway so that should be no problem.
LOL
you guys suck at guessing!
all i want is the quickest way to do just what youre seeing, filling in pixels from a certain distance from points and lines, nothing else!
AF, The first way you mentioned could work, but thats basically drawing less circles, which are slow to draw(then again i could use some faster methods ive learnt )... ill try either way and see which is fastest...
EDIT Ill stay on the safe side and take advice from zaphod first (eg find out what rasterizing means) :)
I dont think theres an optimal solution for things (except my metal class )
You didnt guess, but the 3 guys before you did, guessing if it was for mexes or dragon teeth, which i pointed out, its for neither, please dont all go hostile on me because i made a little joke, if weve managed a couple of weeks without krogothe barbecues, we can manage a few more!
hmmm a good guess (considering you read the old posts about it) but no biscuit
okay im getting acquainted to rasterizing, it could be good since the corners need not be rounded