3
$\begingroup$

I created a graphic to obtain a triangle with three vertices.

The code is as follows:

a = {4, 2, 1}; b = {1, 0, 1}; c = {1, 2, 0};

Graphics3D[{
Text[Style["A", Large, Bold, Red], {4.28, 2.09, 1.05}],
Text[Style["B", Large, Bold, Red], {0.86, -0.25, 1.08}],
Text[Style["C", Large, Bold, Red], {0.81, 2.18, -0.15}],
Blue,
PointSize[.05], Point[a], Point[b], Point[c],
Black,
Line[{a, b, c, a}]
}]

Mathematica graphics

What would be the coordinate on the segment BC which forms another perpendicular segment through the point A?

$\endgroup$
4
  • 1
    $\begingroup$ I was already doing it. the smartphone is slower. :) $\endgroup$
    – LCarvalho
    Aug 27, 2016 at 18:14
  • $\begingroup$ You mean the projection of A onto BC? $\endgroup$
    – Feyre
    Aug 27, 2016 at 19:33
  • $\begingroup$ Yes. This projection forming 90 degree with BC. $\endgroup$
    – LCarvalho
    Aug 27, 2016 at 19:51
  • 1
    $\begingroup$ Have you seen Projection[]? $\endgroup$
    – Michael E2
    Aug 27, 2016 at 20:01

2 Answers 2

5
$\begingroup$

Using b as the origin:

p=Projection[a - b, c - b] + b;

Which is the same as:

p = ((a - b).(c - b) (c - b))/EuclideanDistance[b, c]^2 + b;

Graphics3D[{Text[Style["A", Large, Bold, Red], {4.28, 2.09, 1.05}], 
  Text[Style["B", Large, Bold, Red], {0.86, -0.25, 1.08}], 
  Text[Style["C", Large, Bold, Red], {0.81, 2.18, -0.15}], Blue, 
  PointSize[.05], Point[a], Point[b], Point[c], Point[p], Black, 
  Line[{a, b, c, a}], Thickness[0.02], Red, Dashed, Arrow[{b, p}], 
  Arrow[{a, p}]}]

enter image description here

Check:

Dot[p - b, a - p]

0

$\endgroup$
1
$\begingroup$

1. find the equation of the line through $b$ and $c$

a = {4, 2, 1};
b = {1, 0, 1};
c = {1, 2, 0};

line = t b + (1 - t) c;

2. find the shortest distance from $a$ to this line

enter image description here

p = line/.Last@Minimize[EuclideanDistance[{1, 2 (1 - t), t}, a], t]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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