QA-7: QA-Conversion DT -> CT – coordinates

Let S1.S2.S3 be the QA-Diagonal Triangle of the Reference Quadrangle P1.P2.P3.P4.
Let S1.S2.S3 be the Reference Triangle.
Let P4 be an arbitrary point of the Quadrangle with coordinates (p:q:r) wrt the DT.
The Component Triangle P1.P2.P3 is the Anticevian Triangle of P4 wrt S1.S2.S3.
Let Q be some point to be converted from DT- to CT-coordinates. Let Qc  (xc : yc : zc)  be the presentation of Q in barycentric coordinates wrt the Component Triangle.
Let Qd (xd : yd : zd) be the presentation of Q in barycentric coordinates wrt the Diagonal Triangle.
Now Qd = xd.cfd1.S1 + yd.cfd2.S2 + zd.cfd3.S3 wrt the Reference Diagonal Triangle
also Qc  = xc.cfc1.P1 + yc.cfc2.P2  + zc.cfc3.P3 wrt the Diagonal Triangle,
where:
• (xc  : yc : zc) are the barycentric coordinates of Q wrt the Component Triangle,
• (xd : yd : zd) are the barycentric coordinates of Q wrt the Diagonal Triangle,
• cfc1,  cfc2, cfc3 are the Compliance Factors of the Component Triangle,
• cfd1, cfd2, cfd3 are the Compliance Factors of the Diagonal Triangle.
Explanation of Compliance Factors can be found at (Ref-26).
Since the Diagonal Triangle is the Reference Triangle, the Compliance Factors of the Component Triangle are all equal 1.
The Compliance Factors of the Component Triangle are:
• cfc1 = Det [Gc, P2, P3] / Det [P1, P2, P3]
• cfc2 = Det [P1, Gc, P3] / Det [P1, P2, P3]
• cfc3 = Det [P1, P2, Gc] / Det [P1, P2, P3]
where Gc = the Centroid of the Component Triangle and “Det” is abbreviation for “Determinant”.
Calculation gives 2 presentations of the coordinates of Q wrt the Diagonal Triangle:
• Qd = (xd : yd : zd),
• Qc =  (-p (  p2 xc - q2 xc + 2 q r xc - r2 xc + p2 yc - q2 yc - 2 p r yc + r2 yc + p2 zc - 2 p q zc + q2 zc - r2 zc) :
-q (-p2 xc + q2 xc - 2 q r xc + r2 xc - p2 yc + q2 yc + 2 p r yc - r2 yc + p2 zc - 2 p q zc + q2 zc - r2 zc) :
-r (-p2 xc + q2 xc - 2 q r xc + r2 xc + p2 yc - q2 yc - 2 p r yc + r2 yc - p2 zc + 2 p q zc - q2 zc + r2 zc) )

Since Qc and Qd present the same point we can now calculate the coordinates of Q wrt the Component Triangle:
• (xc : yc : zc) = (p (p - q - r) (r yd + q zd)  :  q (-p + q - r) (r xd + p zd)  :  r (-p - q + r) (q xd + p yd)).
However we have to bear in mind that the variables in these coordinates are expressions in (a,b,c) and (p,q,r), which are variables wrt the Diagonal Triangle.
Therefore the DT > CT-conversion of P(x : y : z) consists of 3 consecutive steps:
1.   Transform: (x : y : z) --> (p (p - q - r) (r y + q z)  :  q (-p + q - r) (r x + p z)  :  r (-p - q + r) (q x + p y))
2.   Replace:       a2 -> (p2 (q - r)2 SA + q2 (p + r)2 SB + (p + q)2 r2 SC) / ((p + q)2 (p + r)2),
b2 -> (p2 (q + r)2 SA + q2 (p - r)2 SB + (p + q)2 r2 SC) / ((p + q)2 (q + r)2),
c2 -> (p2 (q + r)2 SA + q2 (p + r)2 SB + (p - q)2 r2 SC) / ((p + r)2 (q + r)2).
3.   Replace:       p  --> (q + r)
q  --> (p + r)
r  --> (p + q)