Incenter of triangulation elements
Compute Incenters of 2-D Delaunay Triangulation
Create a 2-D Delaunay triangulation.
x = [0 1 1 0 0.5]'; y = [0 0 1 1 0.5]'; TR = delaunayTriangulation(x,y);
Compute the incenters of the triangles.
C = incenter(TR);
Plot the triangles and incenters.
triplot(TR) axis equal axis([-0.2 1.2 -0.2 1.2]) hold on plot(C(:,1),C(:,2),'*r')
Load a 3-D triangulation.
Calculate the incenter coordinates of the first five tetrahedra in the triangulation, in addition to the radii of their inscribed spheres.
TR = triangulation(tet,X); [C,r] = incenter(TR,[1:5]')
C = 5×3 -6.1083 -31.0234 8.1439 -2.1439 -31.0283 5.8742 -1.9555 -31.9463 7.4112 -4.3019 -30.8460 10.5169 -3.1596 -29.3642 6.1851
r = 5×1 0.7528 0.9125 0.8430 0.6997 0.7558
ID — Triangle or tetrahedron IDs
scalar | column vector
Triangle or tetrahedron IDs, specified as a scalar or a column vector
whose elements each correspond to a single triangle or tetrahedron in the
triangulation object. The identification number of each triangle or
tetrahedron is the corresponding row number of the
C — Incenters
Incenters, returned as a matrix whose rows contain the coordinates of an incenter.
r — Radii
Radii of the inscribed circles or spheres, returned as a vector.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.