carttobaryVL
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 1.0, Creation date: 2012-08-04, Last change: 2025-09-14
converts a 3D planar vertex list into a 2D barycentric coordinate list [u,v]
Description
WARNING: This function is absolutely correct but numerically instable for triangles with tan < 1e-7!
USE UV=cartesianToBarycentric(triangulation([1 2 3],VL),ones(size(VL,1),1),VL); UV=UV(:,[ 3 2])
instead that works for tan >= 1e-15
Expecting all vertices in the plane of a triangle p1p2p3, the coordinates of the vertices can be formulated as p1 + u*(p2-p1) + v* (p3-p1). The Barycentric coordinates are [u v].
See Also: barytocartUVL
Example Illustration
Syntax
UVL=carttobaryVL(p1,p2,p3,VL)
Input Parameter
p1: | | Point 1 of the triangle |
p2: | | Point 2 of the triangle |
p3: | | Point 3 of the triangle |
VL: | | Vertex list, all points in plane |
Output Parameter
UVL: | | n x 2 list with [u v] |
Examples
carttobaryVL([0 0 0],[ 0 10 10],[0 0 20],[ 5 5 5])
Copyright 2012-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Last html export of this page out of FM database by TL: 2025-09-21