Neigborhood

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

Jan
Jan on 17 Aug 2011
If P=[p1, ...,pn] how can pi=[pix,piy,piz]? Is P a cell array?
How do you define a normal vector from a set of points? Imagine the points are equally distributed on a sphere or on a line - what is a normal vector?!
How do you define "neighborhood" exactly?
Jan
Jan on 17 Aug 2011
@developer: I do have access to research papers, but it is your turn to read them and compile the contents such, that an answer to your question is possible.
While your P=[p1,...pn] notation is meaningful as a written formula, it is meaningless in MATLAB. Please choose a valid MATLAB format for the inputs, otherwise any suggestion could be more confusing than helpful.
Do you want to ask, how to find the 5 nearest points from a set of points?
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

0 votes

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
thanks i actually have seen this before and used it, but i will thankful to you if u explain one thing, that what is query matrix , does it always has to be given or how we intialize or define the query points for any set of data?
Jan
Jan on 17 Aug 2011
Which function are you talking of?
As far as I understand, the query points equal your data points.
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.

Asked:

on 17 Aug 2011

Community Treasure Hunt

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

Start Hunting!