I am trying to implement a real time ray tracer, and I was reading this interesting paper on a fast, stackless kd-tree traversal method, but it is unclear regarding certain concepts. At page 4, where it presents the rope construction algorithm, it doesn't explain what the 'split-plane' and 'split-axis' are exactly, and how the 'split-axis' could be parallel to the left side but not the right side.
Would anyone with more experience in writing ray tracers and/or who understood the two concepts found in the paper please explain them to me?
Thanks in advance.
Paper [PDF]: http://www.johannes-guenther.net/StacklessGPURT/StacklessGPURT.pdf
I don't think the authors meant to imply that the split-axis is parallel to only the right or left side. They are optimizing the ropes for each side. In order to do this, they need to know if the split plane is parallel to that side. So they test split-axis(R) || S. Here, R is the ropes of the current node. R_L and R_R are the ropes for the left and right sub-trees of that node. The test is trying to see if the current node is splitting on the side for which the ropes are being optimized.
For example: if we're trying to optimize the left and right ropes, we first check whether the current node has a split plane that splits the world into a left and right side (in other words, the split plane is parallel to the YZ plane). If it isn't, then we give up on optimizing the left and right ropes.
Related
This question was already posted in robotics stackexchange but i did not get any reply.
Moreover, this question is about solving a maze with some constraints, so its not limited to making a particular robot with uC and all.
First let me explain the problem.
This is a maze made only out of black lines on a white surface. The robot has only a few IR sensors which can sense the position of the line. No other sensory input is available.
This is a maze with many self-loops and so a simple LSRB or equivalent algorithm wont work. The robot is supposed to learn the maze and then solve it as optimally as possible .
The above figure represent the possible intersections as all the paths are at 90deg to each other.
As far as my understanding goes, the robot will first scan how many nodes there are, and what their connections to each other is, thus effectively constructing the graph. Next, implement any shortest path algorithm and make your robot follow it.
However, the main problem that i cant get my head around is this:
How will this blind robot know it isnt viewing the same node multiple times if it keeps coming back to the same point after getting caught in a loop?
Also, please suggest good approaches to solving this problems along with any experience anybody has. How does one shot searching methods like DFS , Iterative deepeing DFS , hill climbing work in such scenarios ?
When it meets a crossing, the robot must keep a trace of the lanes it didn't take and backtrack later. In addition, it must be able to model the paths with enough accuracy to check that it is back in a place it has seen before.
Then I am not sure that there is a better strategy than
traverse the lanes until you find the exit;
every time you have a crossing, note the lane that you skip;
when you are back at a known place, return to a skipped lane by the shortest route.
If the map is not known beforehand, you obviously cannot find the optimal path, unless by chance.
If there is no way to estimate the geometry, all you can do is random moves.
There are four plain English algorithms for the Towers of Hanoi Puzzle available on Wikipedia, but when I was first solving the puzzle, I came up with an algorithm that is different from any of the solutions I have seen.
Wikipedia algorithms:
Iterative solution
Simpler statement of iterative solution
Equivalent iterative solution
Recursive solution
Of course the results of the algorithms are the same, and they are really just different ways of thinking about the same thing, but I am talking about plain English ways of describing the process.
My process goes like this:
Never move same tile twice in a row(obviously)
Prioritize moving right
When moving right, move to the closest pole that can be legally moved to.
When moving left, move to the farthest pole that can be legally moved to.
..
These rules differ from other descriptions of the algorithm in that:
The initial stack can be placed on any of the 3 pillars and still work without any adjustment to the rules needed.(Unlike solutions 2 and 3 and 4)
You don't have to number the disks(Unlike solutions 1 and 3 and 4)
I have tested this programmatically, and it always solved the puzzle in (2^n)-1 moves where n is the number of rings.
It seems to me that my description really is different from the other plain English descriptions I have found. Has any one seen this description before? If so, please show reference.
I think your description is pretty much the same as Iterative Solution. Just imagine the posts arranged around a circle or a triangle, mod 3 style. Your instructions and Wikipedia's instructions translate to the same thing in that way of viewing things.
This solution is a unidirectional version of the first iterative solution.
The difference between the unidirectional solution and the mono-directional version is the unidirectional solution doesn't specify an end position.
A simple solution for the toy puzzle: Alternate moves between the
smallest piece and a non-smallest piece. When moving the smallest
piece, always move it to the next position in the same direction (to
the right if the starting number of pieces is even, to the left if the
starting number of pieces is odd). If there is no tower position in
the chosen direction, move the piece to the opposite end, but then
continue to move in the correct direction. For example, if you started
with three pieces, you would move the smallest piece to the opposite
end, then continue in the left direction after that. When the turn is
to move the non-smallest piece, there is only one legal move. Doing
this will complete the puzzle in the fewest number of moves.
This description of the mono-directional version can be changed to be unidirectional if direction choices of direction are replaced with the rules from the unidirectional solution revolving around prioritizing moving right.
BACKGROUND
So I'm creating a program that recognizes chess moves. So far, I have implemented a fair number of algorithms to come up with the best results possible. What I've found so far is that the combination of undistorting an image (using undistort ), then applying a histogram equalization algorithm, and finally the goodFeaturesToTrack algorithm (I've found this to be better than the harris corner detection) yields pretty decent results. The goal here is to have every corner of every square accounted for with a point. That way, when I apply canny edge detection, I can process individual squares.
EXAMPLE
WHAT I'VE CONSIDERED
http://www.nandanbanerjee.com/index.php?option=com_content&view=article&id=71:buttercup-chess-robot&catid=78&Itemid=470
To summarize the link above, the idea is to find the upper-leftmost, upper-rightmost, lower-leftmost, and lower-rightmost points and divide the distance between them by eight. From there you would come up with probable points and compare them to the points that are actually on the board. If one of the points doesn't match, simply replace the point.
I've also considered some sort of mode, like finding the distance between neighboring points and storing them in a list. Then I would perform a mode operation to figure out the most probable distance and use that to draw points.
QUESTION
As you can see, the points are fairly accurate over most of the squares (though there are random points that do not do what I want). My question is what do you think the best way to find all corners on the chessboard (I'm open to all ideas) and could you give me a somewhat detailed description (just enough to steer me in the right direction or more if you choose :)? Also, (and this is a secondary question) do you have any recommendations on how to proceed in order to best recognize a move? I'm attempting to implement multiple ways of doing so and am going to compare methods to obtain best results! Thank you.
Please read these two links:
http://www.aishack.in/tutorials/sudoku-grabber-opencv-plot/
How to remove convexity defects in a Sudoku square?
I am searching for a thinning/skeletonization algorithm which works if I only know 4 neighbors not 8.
From all algorithms I could find I assume that I have knowledge about the diagonal neighbors.
So does anybody know about a thinning algorithm which also works if I only know the top, right, bottom, left neighbor?
The outcome should be like this:
http://www.cs.ru.nl/~ths/rt2/col/h9/thinning.GIF
These are not what I am looking for:
http://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Skel.png/220px-Skel.png
The shape should be maintained as in the first example
I'd suggest using one of the 8-neighbour algorithms, but feeding it dummy information for the diagonal cells or otherwise modifying the part of the algorithm that considers neighbours.
Since you're not too specific about the kinds of things you're looking at it's hard to offer concrete suggestions. Most algorithms will contain a part that looks like this:
for n in neighbours:
do stuff
in which case you need to edit neighbours.
Others will apply some kind of mask or kernel function. Edit that kernel.
I have played a little flash game recently called Just A Trim Please and really liked the whole concept.
The basic objective of the game is to mow the whole lawn by going over each square once. Your lawn mower starts on a tile and from there you can move in all directions (except where there are walls blocking you). If you run on the grass tiles more than once it will deteriorate and you will lose the level. You can only move left, right, up, or down.
However, as you finish the game, more tiles get added:
A tile you can only mow once (grass).
A tile you can run over twice before deteriorating it (taller grass).
A tiie you can go over as much as you want (concrete).
A tile you can't go over (a wall).
If you don't get what I mean, go play the game and you'll understand.
I managed to code a brute-force algorithm that can solve puzzles with only the first kind of tile (which is basically a variation of the Knight's Tour problem). However, this is not optimal and only works for puzzles with tiles that can only be ran on once. I'm completely lost as to how I'd deal with the extra tiles.
Given a starting point and a tile map, is there a way or an algorithm to find the path that will solve the level (if it can be solved)? I don't care about efficiency, this is just a question I had in mind. I'm curious as to how you'd have to go to solve it.
I'm not looking for code, just guidelines or if possible a plain text explanation of the procedure. If you do have pseudocode however, then please do share! :)
(Also, I'm not entirely sure if this has to do with path-finding, but that's my best guess at it.)
The problem is finite so, sure, there is an algorithm.
A non-deterministic algorithm can solve the problem easily by guessing the correct moves and then verifying that they work. This algorithm can be determinized by using for example backtracking search.
If you want to reduce the extra tiles (taller grass and concrete) to standard grass, you can go about it like this:
Every continuous block of concrete is first reduced into a single graph vertex, and then the vertex is removed, because the concrete block areas are actually just a way to move around to reach other tiles.
Every taller grass tile is replaced with two vertices that are connected to the original neighbors, but not to each other.
Example: G = grass, T = tall grass, C = concrete
G G T
G C T
C C G
Consider it as a graph:
Now transform the concrete blocks away. First shrink them to one (as they're all connected):
Then remove the vertex, connecting "through" it:
Then expand the tall grass tiles, connecting the copies to the same nodes as the originals.
Then replace T, T' with G. You have now a graph that is no longer rectangular grid but it only contains grass nodes.
The transformed problem can be solved if and only if the original one can be solved, and you can transform a solution of the transformed problem into a solution of the original one.
There is a DP approach for the travelling salesman.
Perhaps you could modify it (recalculating as more pieces are added).
For a long piece of grass, you could perhaps split it into two nodes since you must visit it twice. Then reconnect the two nodes to the nodes around it.