I still believe that the original implementation of normalizeWidth:min:max:using does its job well.
The width of each element ranges from 5 to 30 pixels. As expected from the script.
Width can be less than 5 pixels, which is not what one would expect.
So, if we had two numbers 10 and 5 to be normalized between 0 and 100, we would get:
- 10 => 100
- 5 => 0
This rule works for colors, but for numbers, we want that 5 to be 50.
Actually no, I think that 5 and should be 0, and not 50 since 5 is the minimum value of { 10 . 5 }
Maybe we could add #normalizeWidth:minWidth:maxWidth:minValue:using: ? This method would then fit your need. Does it make sense?
This is an essential piece of Roassal2, and it has to be well done and flexible.
Cheers,
Alexandre
On Sep 19, 2014, at 3:20 AM, Tudor Girba <
tudor@tudorgirba.com> wrote:
Hi,
I discovered a significant problem in RTMetricNormalizer>>normalizeWidth:min:max:using:.
The method is used in the Charter package and it produces an unwanted normalization. I fixed it for this case (see the comment below), but I think we should take the time to review the whole class.
Name: Roassal2-TudorGirba.476
Author: TudorGirba
Time: 19 September 2014, 12:14:30.030534 pm
UUID: 097886cf-6898-d541-a4a7-21431cfecd67
Ancestors: Roassal2-TudorGirba.475
Patched normalizeWidth. This is used in the Charter package.
The old implementation was like this:
tt := min + ((max - min) * ( (t - minValue) / (maxValue - minValue))) asInteger.
The problem with this is that the normalization will return for the lowest value, the specified min value.
So, if we had two numbers 10 and 5 to be normalized between 0 and 100, we would get:
- 10 => 100
- 5 => 0
This rule works for colors, but for numbers, we want that 5 to be 50.
So, the current implementation looks like:
tt := t * (max-min) / maxValue.
Cheers,
Doru
--
www.tudorgirba.com
"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.