How to determine the edge points of a line segment passing through a point on a ternary diagram

78 Views Asked by At

I'm working with ternary diagrams as a (hopefully convenient) way to lay out patterns in a triangle.

Briefly, (From Wikipedia:) "A ternary plot, ternary graph, triangle plot, simplex plot, Gibbs triangle or de Finetti diagram is a barycentric plot on three variables which sum to a constant, usually 1.0 or 100%." Wikipedia entry for Ternary plots

Typical ternary plot (image)

What I'm currently trying to do is figure out how to take a specific point in the diagram (A, B, C) and determine the (AP, BP, CP) point that is on a designated edge and is the endpoint of a line segment between the edge and the point that is perpendicular to the edge. After that, I need (and think it would be easier) to find the extension of that line segment which then intersects on of the other edges of the triangle.

I'm trying to express this in terms of the ternary coordinates (A, B, C) but I'm not having much success in keeping the logic straight, avoiding thinking in terms of Cartesian geometry, or discovering if there is a "ternary geometry" that allows me to do some kind of Pythagorean trigonometry in terms of ternary coordinates.

I understand that lines parallel to the edges are lines of constant component (the values along that edge are 0, and at the opposite vertex are 1). I understand that a "ray" extending from a vertex to an edge is a line of constant composition of the other two components.

What I need is some kind of formula or explanatory diagram that illustrates the changing composition as any given point is moved along a path perpendicular to a given edge.

I have written plenty of other macros to make a lot of patterns, based on https://www.boristhebrave.com/2021/05/23/triangle-grids/ and I need to draw line segments from points IN the graph to specific points on the edges of the graph. I just don't have any experience in doing this kind of thing specifically in terms of the ternary coordinates.

I have a macro that allows me to draw perpendicular lines when I start from an edge, which initially deceived me into thinking I had solved the problem - but I'm now plugging in points that are in the graph, and I'm just (erroneously) projecting along the line of constant composition. But at least at this point, I understand enough of what I'm doing wrong to ask a (hopefully) good question.

Thanks to anyone who can provide a solution or point me in the direction to a good reference that would let me unravel this.

  • Bill

Update: I made some progress by working backwards from the Cartesian coordinates of the reference point that I want the perpendicular line to pass through. However, this is the simplest case, since I'm working off the bottom edge which is x-axis aligned. Since X = 0.5 * (2b+c)/(a+b+c), first I calculate the x-coordinate of the reference point. I sub that back in to the equation, and since the bottom edge is at c=0, X= 0.5 * (2b)/(a+b). Then since a+b(+c=0)=1 by definition, then X=0.5 2b/1 = 0.52b = b. So b=X. Then I just find a by subtracting b from 1.

Now I need to think about doing this perpendicular to the 60-degree sides.

Second Update: I was able to partially solve the side edge cases by doing exactly the same calculations for the previous update, and then swapping coordinates. This however, seems to be only a partial, and/or should I say, point coordinate dependent solution. If I have points in the lower left or right corner regions, everything seems to work fine, but a point in the top corner region results in and endpoint at a triangle vertex. If I however use the Y Cartesian coordinate for that point, everything works.

Now I have to find out why it's case dependent and what metric I use to switch from one case to the other. Highly encouraging, since I'm so close, but somewhat unexpected.

After a whole lot more staring at triangles and applying logic and intuition, I have gotten everything worked out for all the sides.

For the right side, where A=0, and C determines where on that edge the point is, the perpendicular point is at <0, sqrt3/2-Y, Ysqrt3>. A = 1 - (2abs(0.5-Y)). The other endpoint ("Anglepoint") lies on either the C = 0 edge or the B = 0 edge #if (Y < sqrt(3)/6) #local A = 1 - (2*abs(0.5-X)); #local C = 0; #local B = 1 - (A+C); #local AnglePoint = (A, B, C); #else #local B = 0; #local C = 1 - (A+B); #local AnglePoint = (A, B, C);

For the left edge, where B=0 and A determines where on that edge the point is, the perpendicular point is at <sqrt3/2-Y, 0, Ysqrt3>. B = 1 - (2abs(0.5-Y)). The other endpoint lies on either the A = 0 edge or the C = 0 edge #if (Y > sqrt(3)/6) #local A = 0; #local C = 1 - (A+B); #local C = Y/sqrt3; #local AnglePoint = (A, B, C); #else #local B = 1 - (2*abs(0.5-X)); #local C = 0; #local A = 1 - (B+C); #local AnglePoint = (A, B, C);

All that allowed me to progress to the latest stage of the project:

http://news.povray.org/povray.general/message/%3Cweb.642c8afbeebe912c1f9dae3025979125%40news.povray.org%3E/#%3Cweb.642c8afbeebe912c1f9dae3025979125%40news.povray.org%3E