I have a pair of continuous random variables $\{X,\,Y\}$ that follow a 2-dim density $f_{XY}$ which is uniform over a region (denoted $\mathcal{R}$) and zero elsewhere. The region $\mathcal{R}$ is the "hill top" of a sinusoidal wave such that
$$\begin{align} 0 &< y < g(x)~ &,&& g(x) &\equiv A\cos x - \lfloor A \rfloor \\ 0 &< x < x_0~ &,&& x_0 &\equiv \cos^{-1}\left( \frac{\lfloor A \rfloor}A\right) \quad \text{where}~ g(x_0) = 0 \end{align}$$
where the amplitude $A > 0$ can be any positive value except integers, and $\lfloor A \rfloor$ is the usual flooring, giving the largest integer (including zero) that is less than $A$.
$X$ and $Y$ are correlated simply because $\mathcal{R}$ is not a rectangle.
Here's My Question:
How to sample uniformly from $\mathcal{R}$ described above?
Currently I'm doing acception/rejection, but as usual it is not very efficient: generate $\{x,y\}$uniformly from the rectangle with width $x_0$ and height $g(0)$, and reject those out side of $\mathcal{R}$ where $y > g(x)$. This rejects about $1/3\ldots$ not too bad, but I wonder if it can be improved.
It's not clear to me if there's a transformation that can decouple $X$ and $Y$.
Another approached I have considered is to discretize the region (for given desired sample size $n$) into regular lattice points, then it becomes equivalent to a discrete sampling from $\{1,2,\ldots, n\}$. However, this feels like cheap shot, appropriate just for a certain kind of computations.
It's been many years since I last used Gibbs sampling so I'm still studying how to implement it.