Wikipedia:Reference desk/Archives/Mathematics/2024 July 22

Mathematics desk
< July 21 << Jun | July | Aug >> July 23 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


July 22

edit

Computing the centre of a triangle...

edit

(On math section as it's a geometric/trig problem essentially)

In CSS, color-mix() takes 2 Params.. However I have colors to mix that take 3 or more params.

Whilst with 2 params you can do a simple linear interpolation, based on the weights of the 2 params, I wasn't sure how it could be done for 3.

One approach I had considered was (at least for an RGB blend) is to compute the centrepoint of a triangle in 3D space, where the 3 points of the triangle are the three colors. However that would assume equal weights of each color, I figured

So for a given "triangle" defined by (r1,g1,b1),(r2,g2,g2), (r3,b3,g3) and a mix ratio of w1:w2:w3  compute the centroid(?) of the triangle representing the blended color. ?

Alternatively is there a different math/geometrical technique that is used in actual computer graphics work?
ShakespeareFan00 (talk) 17:18, 22 July 2024 (UTC)[reply]

I don't have an actual computer graphics answer, but the interpolation method still works for three points, simply take the weighted sum of points assuming   (if not, then just define new values   which do add to  .) In other words, you can just take   (or, more concisely,  .) GalacticShoe (talk) 17:45, 22 July 2024 (UTC)[reply]
Thanks. I thought I was thinking along the right lines..
In case you are wondering why I asked -s:Page:The_color_printer_(1892).djvu/55 ShakespeareFan00 (talk) 17:52, 22 July 2024 (UTC)[reply]
The weighted average makes sense for additive colour mixing, but the colour resulting from pigment mixing is not so easily determined. For example, the colours   and   are complementary. Their sum in RGB colour models is   and their average is  , as grey as it gets. However, mixing red and green paint gives more of a brown colour.[1] A colour model that is more likely close to that of The Color Printer is the RYB colour model. If the pigments are fully opaque, the subtractive model is adequate, but generally pigments are not fully opaque.  --Lambiam 21:22, 22 July 2024 (UTC)[reply]

This is something I actually did! Back in the '80s, I was consulting for a company called ImageSet. One of our specialties was tools to allow people to take the equivalent of screenshots on MSDOS (using a TSR program), and then convert them to matching colors to be printed. We used trilinear interpolation to achieve the desired colors, if I remember right. It was a ridiculous amount of precision, especially considering that every CRT user adjusted the brightness etc. to their own favored wrong colors. --jpgordon𝄢𝄆𝄐𝄇 17:06, 27 July 2024 (UTC)[reply]