Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

baryToCart - Class: TriRep

Converts point coordinates from barycentric to Cartesian

Syntax

XC = baryToCart(TR, SI, B)

Description

XC = baryToCart(TR, SI, B) returns the Cartesian coordinates XC of each point in B that represents the barycentric coordinates with respect to its associated simplex SI.

Inputs

TRTriangulation representation.
SIColumn vector of simplex indices that index into the triangulation matrix TR.Triangulation
BB is a matrix that represents the barycentric coordinates of the points to convert 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.

Outputs

XCMatrix of cartesian coordinates of the converted points. 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).

Definitions

A simplex is a triangle/tetrahedron or higher-dimensional equivalent.

Example

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)

Compute the barycentric coordinates of the incenters.

cc = incenters(dt);
tri = dt(:,:);
subplot(1,2,1);
triplot(dt); hold on;
plot(cc(:,1), cc(:,2), '*r'); hold off;
axis equal;
title(sprintf('Original triangulation and ...
     reference points.\n'));

Stretch the triangulation and 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);
subplot(1,2,2);
triplot(tr); hold on;
plot(xc(:,1), xc(:,2), '*r'); hold off;
axis equal;
title(sprintf('Deformed triangulation and mapped\n ...
    locations of the reference points.\n'));

See Also

TriRep.cartToBary
DelaunayTri.pointLocation
DelaunayTri class
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS