parameters: (circle1, circle2)
docstring: Calculate the radical axis of two circles.
  
      On the radical axis (also called power line) of two circles any
      tangents drawn from a point on the axis to both circles have
      the same length.
  
      http://en.wikipedia.org/wiki/Radical_axis
      http://mathworld.wolfram.com/RadicalLine.html
  
      See Also
      --------
      findRadicalCenter
docstring_summary: Calculate the radical axis of two circles.
docstring_tokens: Calculate the radical axis of two circles .
function: def findRadicalAxis(circle1, circle2):
      """Calculate the radical axis of two circles.
  
      On the radical axis (also called power line) of two circles any
      tangents drawn from a point on the axis to both circles have
      the same length.
  
      http://en.wikipedia.org/wiki/Radical_axis
      http://mathworld.wolfram.com/RadicalLine.html
  
      See Also
      --------
      findRadicalCenter
      """
      if (geomType(circle1) == "Circle") and (geomType(circle2) == "Circle"):
          print("debug: findRadicalAxis bad parameters! Must be circles.")
          return None
  
      if DraftVecUtils.equals(circle1.Curve.Center, circle2.Curve.Center):
          return None
  
      r1 = circle1.Curve.Radius
      r2 = circle1.Curve.Radius
      cen1 = circle1.Curve.Center
      # dist .. the distance from cen1 to cen2.
      dist = DraftVecUtils.dist(cen1, circle2.Curve.Center)
      cenDir = cen1.sub(circle2.Curve.Center)
      cenDir.normalize()
  
      # Get the perpedicular vector.
      perpCenDir = cenDir.cross(App.Vector(0, 0, 1))
      perpCenDir.normalize()
  
      # J ... The radical center.
      # K ... The point where the cadical axis crosses the line of cen1->cen2.
      # k1 ... Distance from cen1 to K.
      # k2 ... Distance from cen2 to K.
      # dist = k1 + k2
  
      k1 = (dist + (r1**2 - r2**2) / dist) / 2.0
      # k2 = dist - k1
  
      K = App.Vector.add(cen1, cenDir.multiply(k1))
  
      # K_ .. A point somewhere between K and J; actually with a distance
      # of 1 unit from K.
      K_ = App.Vector.add(K, perpCenDir)
  
      # Original code didn't specify the value of origin nor dir,
      # so this is a guess:
      # radicalAxis = Part.LineSegment(K, Vector.add(origin, dir))
  
      origin = App.Vector(0, 0, 0)
      radicalAxis = Part.LineSegment(K, App.Vector.add(origin, perpCenDir))
  
      if radicalAxis:
          return radicalAxis
      else:
          return None
function_tokens: def findRadicalAxis ( circle1 , circle2 ) : if ( geomType ( circle1 ) == "Circle" ) and ( geomType ( circle2 ) == "Circle" ) : print ( "debug: findRadicalAxis bad parameters! Must be circles." ) return None if DraftVecUtils . equals ( circle1 . Curve . Center , circle2 . Curve . Center ) : return None r1 = circle1 . Curve . Radius r2 = circle1 . Curve . Radius cen1 = circle1 . Curve . Center # dist .. the distance from cen1 to cen2. dist = DraftVecUtils . dist ( cen1 , circle2 . Curve . Center ) cenDir = cen1 . sub ( circle2 . Curve . Center ) cenDir . normalize ( ) # Get the perpedicular vector. perpCenDir = cenDir . cross ( App . Vector ( 0 , 0 , 1 ) ) perpCenDir . normalize ( ) # J ... The radical center. # K ... The point where the cadical axis crosses the line of cen1->cen2. # k1 ... Distance from cen1 to K. # k2 ... Distance from cen2 to K. # dist = k1 + k2 k1 = ( dist + ( r1 ** 2 - r2 ** 2 ) / dist ) / 2.0 # k2 = dist - k1 K = App . Vector . add ( cen1 , cenDir . multiply ( k1 ) ) # K_ .. A point somewhere between K and J; actually with a distance # of 1 unit from K. K_ = App . Vector . add ( K , perpCenDir ) # Original code didn't specify the value of origin nor dir, # so this is a guess: # radicalAxis = Part.LineSegment(K, Vector.add(origin, dir)) origin = App . Vector ( 0 , 0 , 0 ) radicalAxis = Part . LineSegment ( K , App . Vector . add ( origin , perpCenDir ) ) if radicalAxis : return radicalAxis else : return None