I want to create a function that can quickly 'paint' a volume in a 3D binary array.
The first approach I tried was extending a standard flood-fill algorithm into 3D, which was easy to do but I was interested in making it faster. I read into how to optimize the flood-fill algorithm and found the 'scanline' flood-fill algorithm. Implementing this into 2D gave me great results. I wanted to extend this into 3D but it was not clear to me how to do this while maintaining the spirit of scanline by minimising the number of voxel checks.
I have searched for an existing implementation or explanation of scanline in 3D, but found nothing on it. I managed to extend the algorithm by essentially splitting the 3D grid into 2D planes and performing the scanline 2D function on each slice. This is an improvement but I feel like there's a better way.
Can scanline be extended into 3D, or is there a better approach entirely to all of this?
Related
Example of Implementation
I'm trying to research algorithms that would eliminate certain contrasted areas on a 2D map, but I'm confused on where to really start.
I've landed on using Quadtrees and RRT* to accomplish this.
Using Quadtrees from what I know would specify the contrast in a gradual sense through quadrants and RRT* would be used for the order of each contrasted area that needs to be eliminated.
In my example, I would want to see a gradual change as the red circles are diminished until the quadrants are rectified into the main four nodes/quadrants again, but before that I would like to choose routes towards which red circle to start from in each quadrant to the next one in terms of proximity in MATLAB.
Is there any easier implementations I should research or know about?
I'm looking for an algorithm that takes the unstructured 2D point set as illustrated above and gives me a decomposition into bounding boxes as shown below. The bounding boxes may overlap, but the algorithm should nevertheless try to find a tight fit (it does not need to be the best one possible, but a good one).
I already tried to work with K-Means but that doesn't give me useful results as I'd need to know already how many clusters I need.
There are several approaches to achieve this. The one I'd use is to apply the RANSAC algorithm in order to sequentially fit Oriented Bounding Boxes (OBB) to the data. By adopting this approach you can even improve the sample selection by computing a constrained Delaunay triangulation on your data, thus discarding bigger edges when fitting the OBB.
Alternatively, you can apply the Alpha-shape algorithm on the entire set of points and start decomposing in smaller shapes, but this requires the definition of an optimal alpha value which is not trivial.
I'm looking for an algorithm solving a problem with detecting collisions between non-aligned objects in 2d (e.g. rectangles), as below:
How do I go about it? All of the articles I found online handle axis-aligned objects, which is not what I need.
As for know, I handled only collisions between circles by measuring distance between their centers, but this case is way more difficult.
I have spent time looking for information on the best algorithm to create a nesting of irregular polygons in 2D using manual and automatic positioning. I need to use such an algorithm in the context of CAD/CAM software. Here are the real possibilities I've found so far:
Separating Axis Theorem: is a fairly quick and simple algorithm to implement, but the drawback I find with it is that it only works with convex polygons. To work with concave polygons, a convex decomposition would need to be done first. This implies an increase in the run-time and the implementation of a new algorithm that decomposes the concave polygon into convex polygons.
Nesting by a power function: calculating the partial derivatives in the X and Y axes, you could get the escape direction you should take a polygon so that there is a collision between the two polygons. This function of energy and I tested and the three major problems that I have encountered are: first obtaining local minima , second nesting when the collision occurs over a piece and finally the execution time is very high.
Using no-fit polygon: use the no-fit polygon to the nesting can be somewhat interesting. I have read several papers on the subject although there are very few online documentation on it. Not sure if it can really be a useful choice. I still have several doubts on the details of this approach.
Any idea which of these algorithms to choose? Or if you know any other options that can be used? I'm a little confused :-) .
Thank you very much.
I want to programm a tool that can place objects on a rectangle with the minumum of waste, this problem is also known as the cutting problem.
So i looked around to find some algorithms and i found out there are a few for rectangles but not that much for n-edged polygones.
my first approach was to get a bounding box for the polygone, then run the normal rectangle algorithm. After that you cound slowly try to increase the number of edges but still have only isometric lines (only vertical and horizontal), to approximate the polygone.
I wonder if there is any good algorithm that implement such thing, but is more common than create my own stuff.
the other way ive come up with could be something with two dimensional knapsack and some sorting heuristics that sort the best fitting polygones and try to put them on the rectangle.
But all i come up with has some good detection of special polygones (such as a square or normal rectangle) but does not work on common polygones.