# How do I solve for the coordinates of the vertices of a Trirectangular Tetrahedron using the symbolic toolbox?

10 views (last 30 days)
cui on 15 Aug 2022
Commented: cui on 16 Aug 2022
The coordinates of the three points on the base of a right-angled tetrahedron ABCD (Trirectangular Tetrahedron: a tetrahedron with three prisms perpendicular to each other at a common vertex) are known to be B(x1,y1,z1), C(x2,y2,z2) and D(x3,y3,z3). vertex A is at right angles. Take only one of the symmetries,how to find the coordinates of the vertex A?The schematic diagram is as follows.

How to find the coordinates of the point A through the symbolic toolbox, I tried to solve it but the calculation took a long time and I still could not get an analytical solution, even though I made many assumptions.
syms x y z x1 y1 z1 x2 y2 z2 x3 y3 z3
assume([x y z x1 y1 z1 x2 y2 z2 x3 y3 z3],'real')
pointA = [x,y,z];
pointB = [x1,y1,z1];
pointC = [x2,y2,z2];
pointD = [x3,y3,z3];
AB = pointB-pointA;
AC = pointC-pointA;
BC = pointC- pointB;
BD = pointD- pointB;
CD = pointD- pointC;
assumeAlso(dot(BC,BD)>0 & dot(-BD,-CD)>0 & dot(-BC,CD)>0) % triangular BCD is an acute triangle,make sure you can find the solution set
equ1 = dot(AB,AC)==0;
sol2 = solve([equ1,equ2,equ3],[x,y,z])
cui on 16 Aug 2022
The link below shows the vertex results using wolfram cloud, which is much faster.

cui on 15 Aug 2022
Edited: cui on 16 Aug 2022
After experimentation, the coordinates of the base triangle BCD are solved indirectly by solving for the coordinates of the orthocenter (xo,yo,zo) of the base triangle BCD and then solving for the coordinates of point A via the OA direction vector. The following is its analytical solution.（see attachment mlx file）
syms x y z x1 y1 z1 x2 y2 z2 x3 y3 z3 xo yo zo
assume([x y z x1 y1 z1 x2 y2 z2 x3 y3 z3 xo yo zo],'real')
% vertices and orthocenter
pointA = [x,y,z];
pointB = [x1,y1,z1];
pointC = [x2,y2,z2];
pointD = [x3,y3,z3];
pointO = [xo,yo,zo]; % orthocenter of tri-BCD
% edge vector
AB = pointB-pointA;
AC = pointC-pointA;
BC = pointC- pointB;
BD = pointD- pointB;
CD = pointD- pointC;
% orthocenter vector
BO = pointO-pointB;
CO = pointO-pointC;
% 底面三角形垂心约束
equ1 = dot(BO,CD)==0;
equ2 = dot(CO,BD)==0;
equ3 = dot(BD,cross(BO,CO))==0;
% solve orthocenter of base triangule BCD, direct solve
[xo_,yo_,zo_] = solve([equ1,equ2,equ3],[xo,yo,zo])
xo_ =
yo_ =
zo_ =
AO = pointO-pointA;
BO = pointO-pointB;
syms a b c real positive
equs1 = a.^2+b.^2==dot(BD,BD);
equs2 = b.^2+c.^2==dot(BC,BC);
equs3 = a.^2+c.^2==dot(CD,CD);
[a,b,c] = solve([equs1,equs2,equs3],[a,b,c],IgnoreAnalyticConstraints=true)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
a =
b =
c =
h = subs(sqrt(b^2-dot(BO,BO)),[xo,yo,zo],[xo_,yo_,zo_]) % altitude of AO, A点垂足即为O点，也即底面三角形垂心
h =
normVec = cross(BC,BD)./norm(cross(BC,BD));
n=h.*normVec; % OA vector
x_uint = sym([1,0,0]);
y_uint = sym([0,1,0]);
z_uint = sym([0,0,1]);
x = xo_+dot(n,x_uint);
y = yo_+dot(n,y_uint);
z = zo_+dot(n,z_uint);
A_coordinate = [x,y,z]
A_coordinate =
for example, the coordinates of B, C, D are (0,0,0), (2,2*sqrt(3),0), (-2,2*sqrt(3),0) respectively. then i can directly get altitude h and A coordinate.
BCD = [0,0,0;
2,2*sqrt(3),0;
-2,2*sqrt(3),0];% 底边点B,C,D顺序
values = BCD';
values = values(:);
myh = simplify(subs(h,[x1 y1 z1 x2 y2 z2 x3 y3 z3],values'))
myh =
myA_coord = simplify(subs(A_coordinate,[x1 y1 z1 x2 y2 z2 x3 y3 z3],values'))
myA_coord =

### Categories

Find more on Calculus in Help Center and File Exchange

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!