[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Signed distance function vectorization
From: |
fotios |
Subject: |
Signed distance function vectorization |
Date: |
Wed, 04 Sep 2013 12:52:44 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
Hello list!
So here is my problem (weakly coupled to Octave). Given a
non-self-intersecting closed curve (simply connected) and a grid
comprised by square elements, I would like to get the signed distance
function from the centers of those elements on that grid. Currently the
way I do it is shown below
function [ d ] = sdistf ( cx, cy, x, y )
n = [ diff( y ), -diff( x ) ];
n = (n ./ repmat( sqrt( n(:, 1).^2 + n(:, 2).^2 ), 1, 2 ));
r = [ x(1:(end - 1)) - cx, y(1:(end - 1)) - cy ]';
d = min( diag( n*r ) );
endfucntion
mytest
# yada yada
for row = 1 : numel( cx )
for col = 1 : numel (cx)
d(row, col) = sdistf ( xc(row, col), yc(row, col), px, py );
end
end
# bla bla
and I was able to vectorize everything in the worst (memory-wise) way .
. . a clever way of doing this in Octave (without using level-sets or
anything like that, just an vectorized version of the above). As a
result of my try to find some info - or a starting point for you that
will try to help me - I found that one
http://statinfer.wordpress.com/2011/11/14/efficient-matlab-i-pairwise-distances/
/Fotis
- Re: problems installing openmpi_ext, Francis Poulin, 2013/09/02
- Re: problems installing openmpi_ext, c., 2013/09/03
- Re: problems installing openmpi_ext, Francis Poulin, 2013/09/03
- Re: problems installing openmpi_ext, c., 2013/09/03
- Re: problems installing openmpi_ext, c., 2013/09/03
- Re: problems installing openmpi_ext, Francis Poulin, 2013/09/03
- Re: problems installing openmpi_ext, c., 2013/09/04
- Signed distance function vectorization,
fotios <=
- Re: problems installing openmpi_ext, Alexander Hansen, 2013/09/06
- Re: problems installing openmpi_ext, Alexander Hansen, 2013/09/06
- Re: problems installing openmpi_ext, Alexander Hansen, 2013/09/07
- Re: problems installing openmpi_ext, c., 2013/09/08
- Re: problems installing openmpi_ext, c., 2013/09/08
- Re: problems installing openmpi_ext, Francis Poulin, 2013/09/08
- Re: problems installing openmpi_ext, Benjamin Abbott, 2013/09/08
- Re: problems installing openmpi_ext, Francis Poulin, 2013/09/08
- Re: problems installing openmpi_ext, Alexander Hansen, 2013/09/08
- parcellfun test issue on Mac OS 10.8, was Re: problems installing openmpi_ext, Alexander Hansen, 2013/09/08