= edgeX;
                    <span class="keyword">elseif</span> dir == 2
                        edge = edgeY;
                    <span class="keyword">end</span>

                    <span class="comment">% check if the edge belong to the boundary</span>
                    <span class="keyword">if</span> norm(edge-ref) &lt; 1.0e-12

                        <span class="comment">% Compute the length of the edge</span>
                        dx = edgeX(2) - edgeX(1);
                        dy = edgeY(2)