File Exchange

image thumbnail

Tetrahedron circumscribed sphere

version 2.1 (33.6 KB) by Nicolas Douillet
Compute the centre and the radius of the sphere circumscribed to a given tetrahedron


Updated 16 Nov 2019

View License

Tetrahedron_circumscribed_sphere : function to compute
the centre and the radius of the sphere circumscribed to
a given tetrahedron.

Author & support : nicolas.douillet (at), 2017-2019.

C = Build_tetra_circumsphere(T)
[C, r] = Build_tetra_circumsphere(T)

C = Build_tetra_circumsphere(T) computes coordinates of C, which is the
centre of the circumscribed sphere to the tetrahedron T.

[C, r] = Build_tetra_circumsphere(T) also returns the radius of the
circumscribed sphere.

Input argument

[V1x V2x V3x V4x]
- T : [V1y V2y V3y V4y] numeric array of the four tetrahedron vertices
[V1z V2z V3z V4z]

V1, V2, V3, and V4 -finite- coordinates.

Output arguments

C : [Cy] numeric vector of the circumscribed centre coordinates.

- radius : numeric scalar, the radius of the circumscribed sphere.

Example #1

Random tetrahedron
T = 2*(rand(3,4)-0.5);
[C, radius] = Tetrahedron_circumscribed_sphere(T);
theta = (0:pi/10:pi)';
phi = (0:pi/10:2*pi);
xS = radius*sin(theta)*cos(phi);
yS = radius*sin(theta)*sin(phi);
zS = repmat(radius*cos(theta),1,length(phi));
set(gcf,'Color',[0 0 0]);
plot3(T(1,:),T(2,:),T(3,:),'.','Linewidth',5), hold on;
plot3(C(1,1),C(2,1),C(3,1),'go','Linewidth',5), hold on;
couples = combnk(1:4,2);
for k = 1:size(couples,1)
line(T(1,couples(k,:)),T(2,couples(k,:)),T(3,couples(k,:)), 'Color', [0 1 1], 'Linewidth',2), hold on;
plot3(C(1,1)+xS(:,1:end),C(2,1)+yS(:,1:end),C(3,1)+zS(:,1:end),'w-.'), hold on;
plot3(C(1,1)+yS(1:end,:)',C(2,1)+xS(1:end,:)',C(3,1)+zS(1:end,:)','w-.'), hold on;
set(gca,'Color',[0 0 0]);
axis equal, axis tight;

Example #2

Flat tetrahedron
V1 = [2*sqrt(2)/3 0 -1/3];
V2 = [-sqrt(2)/3 sqrt(6)/3 -1/3];
V3 = [-sqrt(2)/3 -sqrt(6)/3 -1/3];
V4 = [0 0 -1/3];
T = [V1' V2' V3' V4'];
[C, radius] = Tetrahedron_circumscribed_sphere(T);

Please rate if it helped you. Thanks :)

Cite As

Nicolas Douillet (2019). Tetrahedron circumscribed sphere (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)



+ set back sections


+ improved help, doc, description, typo


+ doc

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux