Matlab - Propagate points orthogonally on to the edge of shape boundaries
        Posted  
        
            by Graham
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Graham
        
        
        
        Published on 2010-04-18T23:54:48Z
        Indexed on 
            2010/04/19
            0:43 UTC
        
        
        Read the original article
        Hit count: 400
        
Hi
I have a set of points which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I also have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points.
I want to cast a ray from each point from the set of points in an orthogonal direction and detect at which point it intersects the shape boundary at.
What would be the best method to do this? Are there some sort of ray tracing algorithms that could be used?
Or would it be a case of taking orthogonal unit vector and multiplying it by a scalar and testing after multiplication if the end point of the vector is outside the shape boundary. When the end point of the unit vector is outside the shape, just find the point of intersection?
Thank you very much in advance for any help!
© Stack Overflow or respective owner