The signs of the two coordinates choose the quadrant. You will sort a cloud of points, count each quadrant, and colour the points by where they fall.
The idea. Quadrant I is , II is , III is and IV is . A point with a coordinate is on an axis: give it the number .
Your tasks.
quadrant, return , , or , or for a point on an axis.counts so that counts[q] is the number of points with quadrant equal to q, for q from to .colours with one colour per point, taken from palette by its quadrant number.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…