user73342: Hopefully the thread title isn't confusing - I'm trying to find out how would it be possible to make a different way of proximity warning with GPS.
Default/simplest way is by forming a radius around a goal waypoint, so the proximity criteria will get triggered when you're "inside" the circle. I know about geofencing but that does seem very demanding and complex, so I'd like to ask if something like shown in this pic would be achievable.
So instead of proximity criteria being a radius around a waypoint, forming a circular geofence so to speak, would it be possible to create a half-circle like this, at a specific angle.


user7508: Let

(x, y) be the Cartesian coordinates of the vector going from the
waypoint to your position

radius be the radius of the circle

theta be the orientation of the straight line, in radians.


You can then build a unit vector normal to the straight line:
n = (cos(θ+π/2), sin(θ+π/2)) = (−sin θ, cos θ)
You are on the colored side of the line if the scalar product of n
with (x, y) is positive.
In code:
bool is_inside(float x, float y)
{
    float product = - x * sin(theta) + y * cos(theta);
    float r2 = x * x + y * y;
    return r2 <= radius * radius && product >= 0;
}


73342: <p>Hopefully the thread title isn't confusing - I'm trying to find out how would it be possible to make a different way of proximity warning with GPS.</p>
<p>Default/simplest way is by forming a radius around a goal waypoint, so the proximity criteria will get triggered when you're &quot;inside&quot; the circle. I know about geofencing but that does seem very demanding and complex, so I'd like to ask if something like shown in this pic would be achievable.</p>
<p>So instead of proximity criteria being a radius around a waypoint, forming a circular geofence so to speak, would it be possible to create a half-circle like this, at a specific angle.</p>
<p><a href="https://i.stack.imgur.com/EtXv3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EtXv3.jpg" alt="enter image description here" /></a></p>
 7508: <p>Let</p>
<ul>
<li><p>(<code>x</code>, <code>y</code>) be the Cartesian coordinates of the vector going from the
waypoint to your position</p>
</li>
<li><p><code>radius</code> be the radius of the circle</p>
</li>
<li><p><code>theta</code> be the orientation of the straight line, in radians.</p>
</li>
</ul>
<p>You can then build a unit vector normal to the straight line:</p>
<p><strong>n</strong> = (cos(θ+π/2), sin(θ+π/2)) = (−sin θ, cos θ)</p>
<p>You are on the colored side of the line if the scalar product of <strong>n</strong>
with (<code>x</code>, <code>y</code>) is positive.</p>
<p>In code:</p>
<pre class="lang-cpp prettyprint-override"><code>bool is_inside(float x, float y)
{
    float product = - x * sin(theta) + y * cos(theta);
    float r2 = x * x + y * y;
    return r2 &lt;= radius * radius &amp;&amp; product &gt;= 0;
}
</code></pre>
