Note that there are some explanatory texts on larger screens.

plurals
  1. POIntersection between two Arcs? (arc = distance between pair of angles)
    primarykey
    data
    text
    <p>I'm trying to find a way to calculate the intersection between two arcs. I need to use this to determine how much of an Arc is visually on the right half of a circle, and how much on the left. I though about creating an arc of the right half, and intersect that with the actual arc. But it takes me wayyy to much time to solve this, so I thought about asking here - someone must have done it before.</p> <p>Edit: I'm sorry the previous illustration was provided when my head was too heavy after crunching angles. I'll try to explain again:</p> <p>In <a href="http://i.stack.imgur.com/QSu2D.png" rel="nofollow">this link</a> you can see that I cut the arc in the middle to two halves, the right part of the Arc contains 135 degrees, and the left part has 90.</p> <p>This Arc starts at -180 and ends at 45. (or starts at 180 and ends at 405 if normalized).</p> <p>I have managed to create this code in order to calculate the amount of arc degrees contained in the right part, and in the left part:</p> <pre><code>f1 = (angle2&gt;270.0f?270.0f:angle2) - (angle1&lt;90.0f?90.0f:angle1); if (f1 &lt; 0.0f) f1 = 0.0f; f2 = (angle2&gt;640.0f?640.0f:angle2) - (angle1&lt;450.0f?450.0f:angle1); if (f2 &lt; 0.0f) f2 = 0.0f; f3 = (angle2&gt;90.0f?90.0f:angle2) - angle1; if (f3&lt;0.0f) f3=0.0f; f4 = (angle2&gt;450.0f?450.0f:angle2) - (angle1&lt;270.0f?270.0f:angle1); if (f4&lt;0.0f) f4=0.0f; </code></pre> <p>It works great after normalizing the angles to be non-negative, but starting below 360 of course. Then f1 + f2 gives me the sum of the left half, and f3 + f4 gives me the sum of the right half. It also does not consider a case when the arc is defined as more than 360, which may be an "error" case.</p> <p>BUT, this seems like more of a "workaround", and not a correct mathematical solution. I'm looking for a more elegant solution, which should be based on "intersection" between two arc (because math has no "sides", its not visual";</p> <p>Thanks!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload