c# - Difference in two angles in radians? -
i have simple chart whereby user can determine start & end direction in radians. control draws chart using override of  onrender. drawing arcs streamgeometrycontext.arcto. method has islargearc property determines how arc drawn (true > 180 degrees (pi), false < 180 degrees). determining value condition works fine:
 //rule not exceed 180 degrees in direction (radian), islargearc= false else true  if (start < math.pi && (end - start) < math.pi || //currently unknow condition in here deal < pi when start angle > end angle?)   {      //islargearc = false;   }   else   {      //islargearc= true;   } the issue comes when start < end. e.g. 270 degrees 120 degrees. need condition satisfy angle on 180 degrees (pi) in situation. maths not strong point. think need add pi*2 end , somehow compare 2 values not sure on how achieve this?
well, add full circle end, (or start; according direction) angle e.g.:
if (start < end)     start += 2 * math.pi; //full circle in radians. this way you'll add full circle end angle, doesn't change position drawing , results in valid , correct angle if subtract them (start - end).
although must say, expect start > endcondition.
if start > end or visa versa, tells direction.

Comments
Post a Comment