I'm trying to measure a Cube using computer vision. So I have a lot of lines in 3D space, I would like to find if three lines are perpendicular to each other in C++. Is that possible to find a fast method of doing that ?
1 Answer
consider the parametric equations for the lines:
$$P_1+\vec v_1t$$$$P_2+\vec v_2t$$$$P_3+\vec v_3t$$
and then impose that
$$\vec v_1\cdot \vec v_2=\vec v_2\cdot \vec v_3=\vec v_3\cdot \vec v_1=0$$
-
$\begingroup$ Thanks. Can you show some code in C++ ? How would I convert points for examples into parametric lines ? $\endgroup$ Dec 23, 2017 at 19:59
-
$\begingroup$ Coding questions are not usually asked here. You could try at stackoverflow.com $\endgroup$ Dec 23, 2017 at 20:07
-
1$\begingroup$ @AhmedSaleh I'm not skilled in C++. Find parametric lines is simple once you have two points P and Q it is: P+(Q-P)t. For example: P(1,2,3) and Q(3,2,2) thus line PQ: (1,2,3)+t(2,0,-1) therefore the vector v is Q-P (2,0,-1). $\endgroup$– userDec 23, 2017 at 20:12
-
-
$\begingroup$ $t$ is a parameter $\in \mathbb{R}$, for each value you obtain a point on the line, EG for t=0 P and for t=1 Q, but for your needing v is the important object for you $\endgroup$– userDec 23, 2017 at 20:15