How to find the percentage value from A to B when I know the X value in between these two points?
I created this picture to kind of illustrate what I mean better.
I wrote this function which gets the percentage, but how do I also include the center offset?
private float GetPercentage(Vector2 point, float radiusOffset, float centerOffset)
{
float radius = Math.Min(radiuscircle.rect.width / 2f, radiuscircle.rect.height / 2f);
radius *= radiusOffset;
return 1f - (Math.Max(Math.Abs(point.x), Math.Abs(point.y)) / radius);
}
The radius offset is from 0-1, 0 being the 0,0 position and 1 full radius. The center offset is from 1-0, 1 being the 0,0 position and 0 being the radius border.