1 / 22

Generation Of Random Digital Curve in 2-D

Generation Of Random Digital Curve in 2-D. Submitted By Amit Samanta, Sougata Singha, Souvik Pal. Algorithm for 2-Dimension. Basic Features. 4 Connectivity, can be extended to 8 connectivity No Backtracking, choses points on the fly Simple Data Structure Complexity ~ O(n)

imelda
Download Presentation

Generation Of Random Digital Curve in 2-D

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Generation Of Random Digital Curve in 2-D Submitted By Amit Samanta, Sougata Singha, Souvik Pal

  2. Algorithm for 2-Dimension

  3. Basic Features • 4 Connectivity, can be extended to 8 connectivity • No Backtracking, choses points on the fly • Simple Data Structure • Complexity ~ O(n) • Direction of movement: • 0: Right • 1: Up • 2: Left • 3: Down 1 2 0 3

  4. Basic Features Data Structure Used – For each Point • Integer ‘val’ – to denote if this point is visited or not • Char ‘prev’ and ‘next’ – to track the previous and next move to/from that point • Boolean array Turn[4] – to validate each of 4 neighbours of a point

  5. Algorithm • Initially all the points are unvisited. • Select a Seed Point P from user. • Set seed point as Current Point P’. • Select a valid and safe neighbor P” randomly. • Modify the ‘next’ and ‘prev’ values of P’ and P” accordingly.

  6. Algorithm • Set the selected point P” as current point P’. • Mark P’ as visited. • Check if current point P’ is uni-distant from seed point P. • In that case, select P as neighbor of P’ and close the graph. • Otherwise goto step 4.

  7. Key Concepts • Selection of a neighbor point depends on the outcome of an random draw. • A neighbor is valid if it is not been visited earlier. • A move to a neighbor is safe if does not enter in any endless loop. • No extra care is taken to close the curve. Eventually it will be closed within (NxM)+1 moves.

  8. Randomness • At each point, the next possible move is generated by a random number generator. • Uses system function rand(). • Modifies the seed with srand() to increase randomness.

  9. Validity • All the randomly generated points are not valid. • A point is valid if it is not visited early, or • If the point is not a restricted point • E.g. Points outside the boundary

  10. Safe Move • Initially all the points in the plane are safe. • First the seed point is made visited. One of its neighbor is selected from the draw, here safe move is not considered. • For each point P, we select a random neighbor P’. Consider the neighbor’s 4 neighbors (a,b,c,d).

  11. Safe Move • If any of them (except P) is visited, consider the movement of the graph at that point from the prev and next values. • Also consider the corner points if they are visited. • Checking the movements, we discard some neighbors.

  12. Safe Move • Check if there is any safe neighbor of P’ or not. • If P’ has no safe neighbor, donot move to P’. • Re-draw, and select another neighbor of P and follow the same procedure.

  13. A Simple Demostration

  14. The Digital Plane Four Neighbors Randomly Selected Seed Point It is Safe and We Move Is this Safe Move ?

  15. A Bit Complex Situation

  16. invalidate Consider another situation, where some of its neighbors are visited Check the prev and next values Similar situations for corner points invalidate invalidate If there is any valid neighbors, actually make the move

  17. Some Results

  18. THANK YOU

More Related