## Thursday, October 18, 2007

### HP-35s Euclid Implementation - XIV : Barycentric to Cartesian coordinates

Going from barycentric to cartesian coordinates (problem 15 in the requirements) is the easy part of Cartesian<->Barycentric 2D/3D conversion, this will be a much shorter blog entry than this one!

Stack Input/Output:
`3D case: [[b1, b2, b3], Y, Z, T | L]-> XEQ A ->[[x, y, z], Y, Z, T | [b1, b2, b3]]2D case: [[b1, b2, b3], Y, Z, T | L]-> XEQ A ->[[x, y], Y, Z, T | [b1, b2, b3]]`
Variables:

`K : First vertex (3D vector), in 3D case. Populated by the T program.L : Second vertex (3D vector), in 3D case. Populated by the T program.M : Third vertex (3D vector), in 3D case. Populated by the T program.U : First vertex of triangle projected to 2D (2D vector), in 2D case. Populated by the T program.V : Second vertex of triangle projected to 2D (2D vector), in 2D case. Populated by the T program.W : Third vertex of triangle projected to 2D (2D vector), in 2D case. Populated by the T program.`
Program:
`A001 LBL AA002 ABSA003 RDNA004 FS? 2A005 GTO A008A006 eq Kx([1,0,0]xLASTX)+Lx([0,1,0]xLASTX)+Mx([0,0,1]xLASTX)A007 RTNA008 eq Ux([1,0,0]xLASTX)+Vx([0,1,0]xLASTX)+Wx([0,0,1]xLASTX)A009 RTN`