Dynamic Colours using x and y coordinates of points in a list

Christopher Policari shared this question 2 years ago
Needs Answer

Maybe I'm trying to do this the hard way, but I want to create a coloured partition of the plane (Voronoi Diagram) that automatically re-adjusts as the user drags the individual site points around. Since I can't seem to dynamically define the graphics view background colour based on x and y coordinates, I've instead created a list of 10,000 points in a 1 x 1 square. I intend to dynamically control the colour of each point by changing their RGB values based on their distances from each of the sites in the diagram. To do this, I will need to reference the x and y coordinates of each point. If my list is named 'list' I've tried referencing the coordinates as x(list) and y(list) and it doesn't seem to work.

As a test, I wanted to see if I could make the right half of the square turn red. So I selected all the points in the spreadsheet, right clicked to change all their properties at once, went to dynamic colours, and entered if(x(list) > 0.5, 255) in the Red field, and zeroes in both Green and Blue. Nothing happened.

Am I going about this wrong?

Comments (1)


If you create point A1 in the spreadsheet and set the Red dynamic colour to eg

If(x(A1) < 0, 0, 1)
then if you copy and paste A1 to A2 then that condition will update, for example to

If(x(A2) < 0, 0, 1)

© 2023 International GeoGebra Institute