Neigborhood

5 views (last 30 days)
developer
developer on 17 Aug 2011
Hello, I have set of n 3d Points P=[p1,...,pn]
where,
pi=[pix,piy,piz] represent the 3D coordinates of a point , i want to estimate a normal vector ni=[nix,niy,niz] from a set of points in neighborhood Qi=[qi1,qi2,...,qik]
I want to know how can find Q matrix for any point giving some value of k ,like f k=5
  4 Comments
developer
developer on 17 Aug 2011
Yes i want to fine 5 nearest points from a set of points
Jan
Jan on 17 Aug 2011
And the format your points are stored in is... ?

Sign in to comment.

Answers (1)

Jan
Jan on 17 Aug 2011
You can find lot of solutions in the FEX: FEX: Search for nearest neighbor
Perhaps this is fine: FEX: 15562.
If you have the statistics toolbox, look at knnsearch.
  4 Comments
developer
developer on 17 Aug 2011
i am talking about the function that is used in this example
Example:
a = [1 1; 2 2; 3 2; 4 4; 5 6];
b = [1 1; 2 1; 6 2];
[neighbors distances] = kNearestNeighbors(a,b,2);
Output:
neighbors =
1 2
1 2
4 3
distances =
0 1.4142
1.0000 1.0000
2.8284 3.0000
in kNearestNeighbors function 'a' is mention as datamatrix and 'b'
as querymatrix, what i get data matrix will be my 3D data points , but i dont know from where and how can i take query matrix 'b'
Jan
Jan on 18 Aug 2011
@developer: It would be helpful, if you mention where this function is coming from. Although I do not have the chance to look in its documentation (did you do this already?), I guess that this function uses the same input as all other KNN function from the FEX: "a" is the set of points you are searching in, "b" is the set of points you want to find the nearest neighbors of. E.g. imagine any normally distributed random points and you want to find the 10 points nearest to the origin: kNearestNeighbors(randn(1000, 3), [0,0,0], 10) - or perhaps with transposed inputs.
I assume, that for your case "b" equals "a". There might be a method to tell the function that both sets are equal.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!