[Math] Intersection of a point and absolute value function contained within a circle

absolute valuecirclesgraphing-functionstrigonometry

I'm attempting some crazy ideas while programming a game and ran into the following math problem that has been bugging me for a few days:

Given a unit circle and a random point $P$ within the circle, what is the equation that maps an absolute value function such as $y = 1 – |1-x|$ so that the left side passes through the origin, the right side passes through the $P$, and the apex of the absolute value function is on the circle? If it helps, I'm only concerned with the upper-right quadrant.

The end result would be an isosceles triangle with side lengths 1 (the radius) that treats the circle as a kind of reflective surface, but the reflection is like that of a horizontal surface (reversing only y, not x.) I figured the circle "height" function as $y = \sqrt{1-x^2}$ but I'm not sure how to use it to create an absolute value function that also passes through $(0,0)$ and $P$. Any help would be appreciated.

Best Answer

A general form of all absolute value functions (translated and scaled) is

$$y=a+k|x+b|$$

There are three conditions. The equation must pass through the origin:

$$a=-k|b|$$

The apex must lie on the unit circle:

$$a^2+b^2=1$$

And the equation must pass through $P=(p_x,p_y)$:

$$p_y=a+k|p_x+b|$$

In order to find an absolute value function that satisfies these requirements, you will need to solve these three simultaneous equations for $a$, $b$, and $k$.