private static float Scale(int maxPixel, float maxSkeleton, float position) { float value = (((((float)maxPixel) / maxSkeleton) / 2f) * position) + (maxPixel / 2); if (value > maxPixel) { return (float)maxPixel; } if (value < 0f) { return 0f; } return value; }