Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

252
Vistas
How to determine the points belonging to the distance between two not intersecting lines in space

I have a question that I would like to share with you in case you could help me. I am working on 3D lines and I need to obtain the exact points at which the minimum distance of two intersecting lines is located. Why do I need these points?

Of each one of the infinite lines, I would only be interested in knowing if this minimum distance is in a certain range from that of points on the same line. For example, I have the points P (0,0,0) and Q (10,10,10) of a line r and I would only be interested to know if said minimum distance is in that coordinate interval or not.

To obtain the distance, I use the formula:

But once said I do not know how to ensure if such a minimum distance is reached within the range of values of P and Q that I comment above.

If anyone has any better ideas on how to check this or knows how to get such points, I would really appreciate it.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

If I understand your question right:

for point P get orthogonal projections onto both lines (denominator is not needed if v and w are normalized)

PAproj = A - P + dot(AP, v) / dot(v,v) * v
PBproj = B - P + dot(BP, w) / dot(w,w) * w

Then check that these vectors are anticollinear

 cross(PAproj, PBproj) == 0   
   and 
 dot(PAproj, PBproj) has negative sign
over 4 years ago · Santiago Trujillo Denunciar

0

Usually, lines in 3D are specified by the coordinates of one point on the line and the coordinates of one vector aligned (or parallel) to the line. So I am going to assume that what you have as input data is:

1) line s with point S = [xS, yS, zS] on l and a vector u = [u1, u2, u3] aligned with s

2) line r defined by the pair of points P = [xP, yP, zP] and Q = [xQ, yQ, zQ] 

Your goal is to check whether the point on r that is closest to line s 
is inside the line segment PQ on r or not.

Algorithm.

n = u x (Q - P)
SP = P - S
SQ = Q - S
proj_SP = SP - ( (n . SP) / (n . n) )  n 
proj_SQ = SQ - ( (n . SQ) / (n . n) )  n
w = n x u
if (proj_SP . w) * (proj_SQ . w) < 0
    then the point on r that is closest to line s 
         is inside the line segment PQ
else
         the point on r that is closest to line s 
         is outside the line segment PQ
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda