Compare 3D Points to get the vertical line between two points

Hi,

I have some 3dPoints given and now I have to calculate the angel between every Point and the vertical.
In the code below you can see my 3D Points which are included in controlPoints.
numPoints give the Number of Points and I read all Coordinates for x, y, z.

Now I neet to identify the two points which are generate a vertical line (e.g. which have the lowest angle between point and a vertival line)
Can someone help me?

1
2
3
4
5
6
7
8
9
const int numPoints = controlPoints.size()/3.;
		for (int count = 0; count < numPoints; count++)
		{
			xxx = xxx + controlPoints[3*count];
			yyy = yyy + controlPoints[3*count+1];
			zzz = zzz + controlPoints[3*count+2];
			
			
		}
What do you mean by "angle between a point and a line"?

A point is either on a line, or some distance from a line. There is an angle between two lines, but only if those lines cross each other.
if I have a polygon with five points i´m looking for the two points which are building the vertical with the highest accuracy.

for example a door polygon and I need the axis (left or right doesnt matter) which are exists of two point´s.
That doesn't answer the "angle of a point" question. Lets ignore that for a moment.

Lets have a polygon of four points {a,b,c,d}. A square. We can draw lines that pass through two points:
{ab, ac, ad, bc, bd, cd}. Six lines. Edges and diagonals of the square. (A two-point polygon has one line, a triangle has three, and every additional point contributes to combinatorial explosion.)

When you have two points, you can translate both with same vector so that the first point becomes (0,0,0). Treat he translated second point as directional vector. Lets call it vB.

I presume that you mean by vertical a line colinear with (0,0,z). A vector from (0,0,0) to (0,0,1) is unit length and vertical. Lets call it vZ.

Make your directional vector unit length: vB' = vB/l|vB|. Compute dot product vZ*vB'. Drop the sign. The line with largest result is closest to vertical.

Back to the square. I draw it on the floor. All of its lines are equally orthogonal to the vertical line.
Topic archived. No new replies allowed.