Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of points in a 3d space. These Points are positioned mainly along one direction. What I need to do is to find this direction (I guess PCA may do the trick) and then split this set of points in two groups along this direction.

Let's say (I'm just making an example to explain) these points are positioned along the Y axis, all I want to do is to have one group with all the points that have the Y greater than the point P, and the other group with all the points that have the Y smaller than the point P.

P is a given point of this set. I had troubles dividing this set ALONG the main direction. I hope I made myself clear =)

share|cite|improve this question
up vote 1 down vote accepted

Well if you have the main direction $\mathbf{v}$ (as 3D vector) (either known or computed by PCA) and point $\mathbf{p}$ (as 3D location vector), all you need to do is project the points onto $\mathbf{v}$ (using the standard 3D dot product) and compare this projection to that of $\mathbf{p}$:

$S_1 = \{\mathbf{q}:\mathbf{q}\cdot\mathbf{v} < \mathbf{p}\cdot\mathbf{v}\}$

$S_2 = \{\mathbf{q}:\mathbf{q}\cdot\mathbf{v} \geq \mathbf{p}\cdot\mathbf{v}\}$

In other words you create a plane through $\mathbf{p}$ with normal $\mathbf{v}$ and classify the points into those behind the plane and those in front of the plane.

For your example of $\mathbf{v}$ being just $(0, 1, 0)^T$, this gerneral case will of course reduce to just comparing the y-values of the points.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.