Please support our C++ advertiser: Programming Forums
•
•
Join Date: Sep 2006
Location: Michigan State University, United States
Posts: 232
Reputation:
Rep Power: 3
Solved Threads: 1
Alright, I'm developing a program that is going to take in .pbm image files, manipulate them, and output them in .ppm (P3) format.
That's all fine and good; I've got that down.
However, I'm looking for suggestions on good and efficient ways to figure out if 2 points ( row , col ) are connected in an object within an object. By object I mean a region of all one colour, that has no diagonal connectivity. If I figure this out fast enough, I will implement a diagonal-connectivity checker as well.
Any suggestions? I was thinking about using an STL stack to store my moves, in case I end up at a dead end, so I can go back a few moves and take another possible road. something like this (but I don't think this is efficient enough for me.), conceptually.
push all possible moves in order W , S , E , N - impossible moves are moves that go outside the region.
These will be something like a struct I'll call move, like this:
pop off the last possibility and go that way.
repeat.
if I run out of possibilities for moves (a dead end) pop and set my position to the next in the first alternative possibility and go forth.
However, it seems to me that if I were to go that way, with the specific order of directions to take, it would be horribly inefficient.
Any ideas? I'll be much obliged. I just wanna bounce ideas.
That's all fine and good; I've got that down.
However, I'm looking for suggestions on good and efficient ways to figure out if 2 points ( row , col ) are connected in an object within an object. By object I mean a region of all one colour, that has no diagonal connectivity. If I figure this out fast enough, I will implement a diagonal-connectivity checker as well.
Any suggestions? I was thinking about using an STL stack to store my moves, in case I end up at a dead end, so I can go back a few moves and take another possible road. something like this (but I don't think this is efficient enough for me.), conceptually.
push all possible moves in order W , S , E , N - impossible moves are moves that go outside the region.
These will be something like a struct I'll call move, like this:
struct point
{
int row;
int col;
};
struct move
{
point here;
point next;
};repeat.
if I run out of possibilities for moves (a dead end) pop and set my position to the next in the first alternative possibility and go forth.
However, it seems to me that if I were to go that way, with the specific order of directions to take, it would be horribly inefficient.
Any ideas? I'll be much obliged. I just wanna bounce ideas.
Damn the man! Save the Empire!
Similar Threads
Other Threads in the C++ Forum
- How to create image maps that look so nice... (Graphics and Multimedia)
- Square Image Thumbnail (PHP)
- paging problem (ASP)
- Image Swap Problems (JavaScript / DHTML / AJAX)
- Loading image to HTML (JavaScript / DHTML / AJAX)
- Image functions in php (PHP)
- Open Source Image Uploading Script (Website Reviews)
- Image capture into HTML/IE and Oracle databases... (Oracle)
- searching multiple fields (PHP)
- What Language is used in software like Adobe Photoshop? (C++)
Other Threads in the C++ Forum
- Previous Thread: what does func(int x, int y, int z=1) mean?
- Next Thread: VC++ console based webserver
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Threaded Mode