cartToBary
(Not recommended) Convert point coordinates from Cartesian to barycentric
cartToBary(TriRep)
is not recommended. Use cartesianToBarycentric(triangulation)
instead.
TriRep
is not recommended. Use triangulation
instead.
Syntax
Description
Examples
Stretch Triangulation and Map Incenters
Create a Delaunay triangulation for a set of points, calculate the location of the incenters, and then stretch the triangulation and compute the mapped locations of the incenters on the deformed triangulation.
Compute the Delaunay triangulation of a set of points.
x = [0 4 8 12 0 4 8 12]'; y = [0 0 0 0 8 8 8 8]'; dt = DelaunayTri(x,y)
dt = DelaunayTri with properties: X: [8x2 double] Triangulation: [6x3 double] Constraints: []
Compute the barycentric coordinates of the incenters.
cc = incenters(dt); tri = dt(:,:);
Plot the original triangulation and reference points.
subplot(1,2,1) triplot(dt) hold on plot(cc(:,1), cc(:,2), '*r') hold off axis equal
Stretch the triangulation and use baryToCart
to compute the mapped locations of the incenters on the deformed triangulation.
b = cartToBary(dt,[1:length(tri)]',cc); y = [0 0 0 0 16 16 16 16]'; tr = TriRep(tri,x,y); xc = baryToCart(tr, [1:length(tri)]', b);
Plot the deformed triangulation and mapped locations of the reference points.
subplot(1,2,2) triplot(tr) hold on plot(xc(:,1), xc(:,2), '*r') hold off axis equal
Input Arguments
TR
— Triangulation representation
TriRep
or DelaunayTri
object
Triangulation representation, specified as a TriRep
or DelaunayTri
object.
SI
— Simplex indices
column vector
Simplex indices, specified as a column vector. SI
contains
simplex indices that index into the triangulation matrix
TR.Triangulation
.
XC
— Cartesian coordinates to convert
matrix
Cartesian coordinates to convert, specified as a matrix. XC
is of
size m
-by-n
, where n
is the
dimension of the space where the triangulation resides. That is, the Cartesian
coordinates of the point B(j)
with respect to simplex
SI(j)
is XC(j)
.
Output Arguments
B
— Barycentric coordinates of converted points
matrix
Barycentric coordinates of converted points, specified as a matrix.
B
is a matrix that represents the barycentric coordinates of the
points with respect to the simplices SI
. B
is of
size m
-by-k
, where m
=
length(SI)
, the number of points to convert, and
k
is the number of vertices per simplex.
More About
Simplex
A simplex is a triangle/tetrahedron or higher-dimensional equivalent.
Version History
Introduced in R2009a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)