So, I have been working on some code with a group of people/organisations etc. and I've hit a small bump in the road that I thought someone on here may be able to help me with :)

I have developed some code that draws 3D towers to represent the amount energy particular objects have, thus creating a sort of graph. I am currently using a very basic linear scaling algorithm but I wish to use a logarithmic method of scaling.

Currently my algorithm does the following:

NB: I only scale in x, y as z is the height and represents a completely different thing.

1: Calculates the centre point of the object

2: Calculates the distance between the centre and each corner

3: Divides this by the data collections maximum/highest energy

4: Multiplies this by the current objects energy

5: Adds this final value to the centre point

e.g.

```
corners[i].x = centre[0] + ( ( ( corners[i].x - centre[0] ) / max ) * energy );
corners[i].y = centre[1] + ( ( ( corners[i].y - centre[1] ) / max ) * energy );
```

In effect this scales the objects in proportion to the maximum recorded energy for a given data collection (a sort of percentage).

I wish to use a logarithmic scaling method to do the same thing but I am not sure how I would do this.

I am not all that great when it comes to Maths but particularly when it comes to logarithmic scaling in C++.....I would appreciate if someone could give me a hand with this. In particular coding examples in C++ would be very useful

Thanks in advance

*Edited
by Valaraukar*: n/a