Reversing number order.

edited October 2014 in How To...


I have the following loop:

    for (TableRow row : table.rows()) {

        x = row.getInt("Height");


In this loop x is taken from a spreadsheet showing the height of 50 buildings sorted from highest to smallest.

At the moment the size of the circle is determined by the size of each building so the higher the building, the bigger the circle.

The output image is 50 concentric circles. I am trying to change the sketch so that the biggest building = the smallest circle (like contour lines). Because there is no pattern in the building heights the circles are not evenly spaced and I cant work out how to keep swap the circles around (small-hight / large=low) and keep the circles spaced correctly.

I hope this makes sense, thanks!


  • Have you tried something like: table.sortReverse("Height");? :-??

  • he just wants to map higher buildings to smaller radius.

    i think you can use map(radius, min_height, max_height, max_radius, min_radius); but it might not work given the data (which i've not seen)

  • Yes, thats correct. The bigger the building, the smaller the radius of the circle representing it. The data is simply a spreadsheet with two columns - First column is a list of building names and beside that is a column with the heights in metres.

  • Answer ✓

    I have worked out a solution (might not be the best solution but it seems to work)

    x = (-height)+200; ellipse(0,0,x,x);


Sign In or Register to comment.