Drive in a circle with 'radius' for 'distance'
321856
def _on_arc(self, speed, radius_mm, distance_mm, brake, block, arc_right):
        

        if radius_mm < self.min_circle_radius_mm:
            raise ValueError("{}: radius_mm {} is less than min_circle_radius_mm {}" .format(
                    self, radius_mm, self.min_circle_radius_mm))

        # The circle formed at the halfway point between the two wheels is the
        # circle that must have a radius of radius_mm
        circle_outer_mm = 2 * math.pi * (radius_mm + (self.wheel_distance_mm / 2))
        circle_middle_mm = 2 * math.pi * radius_mm
        circle_inner_mm = 2 * math.pi * (radius_mm - (self.wheel_distance_mm / 2))

        if arc_right:
            # The left wheel is making the larger circle and will move at 'speed'
            # The right wheel is making a smaller circle so its speed will be a fraction of the left motor's speed
            left_speed = speed
            right_speed = float(circle_inner_mm/circle_outer_mm) * left_speed

        else:
            # The right wheel is making the larger circle and will move at 'speed'
            # The left wheel is making a smaller circle so its speed will be a fraction of the right motor's speed
            right_speed = speed
            left_speed = float(circle_inner_mm/circle_outer_mm) * right_speed

        log.debug("%s: arc %s, radius %s, distance %s, left-speed %s, right-speed %s, circle_outer_mm %s, circle_middle_mm %s, circle_inner_mm %s" %
            (self, "right" if arc_right else "left",
             radius_mm, distance_mm, left_speed, right_speed,
             circle_outer_mm, circle_middle_mm, circle_inner_mm
            )
        )

        # We know we want the middle circle to be of length distance_mm so
        # calculate the percentage of circle_middle_mm we must travel for the
        # middle of the robot to travel distance_mm.
        circle_middle_percentage = float(distance_mm / circle_middle_mm)

        # Now multiple that percentage by circle_outer_mm to calculate how
        # many mm the outer wheel should travel.
        circle_outer_final_mm = circle_middle_percentage * circle_outer_mm

        outer_wheel_rotations = float(circle_outer_final_mm / self.wheel.circumference_mm)
        outer_wheel_degrees = outer_wheel_rotations * 360

        log.debug("%s: arc %s, circle_middle_percentage %s, circle_outer_final_mm %s, outer_wheel_rotations %s, outer_wheel_degrees %s" %
            (self, "right" if arc_right else "left",
             circle_middle_percentage, circle_outer_final_mm,
             outer_wheel_rotations, outer_wheel_degrees
            )
        )

        MoveTank.on_for_degrees(self, left_speed, right_speed, outer_wheel_degrees, brake, block)
144056
function distanceFromIntersectArea(r1, r2, overlap) {
        // handle complete overlapped circles
        if (Math.min(r1, r2) * Math.min(r1,r2) * Math.PI <= overlap + SMALL$1) {
            return Math.abs(r1 - r2);
        }

        return bisect(function(distance$$1) {
            return circleOverlap(r1, r2, distance$$1) - overlap;
        }, 0, r1 + r2);
    }
552971
def angToDisc(nside, lon, lat, radius, inclusive=False, fact=4, nest=False):
    
    vec = angToVec(lon,lat)
    return query_disc(nside,vec,radius,inclusive,fact,nest)
1360446
def point_in_circle(pt, center, radius):
    '''
    
    '''
    d = np.linalg.norm(np.asarray(pt) - np.asarray(center))
    return d <= radius
788637
function Circle2D( x , y , r ) {
	this.center = new Vector2D( x , y ) ;
	this.r = + r ;
}
1219453
function setMaxDistance(direction, distance) {
    		distance = Math.max(distance, getMaxDistance(direction) );
    		maximumsMap[direction].distance = distance;
		}
1048461
def circle(self, cx, cy, r, stroke=None, fill=None, stroke_width=1):
        
        self.put(' <circle cx="')
        self.put(str(cx))
        self.put('" cy="')
        self.put(str(cy))
        self.put('" r="')
        self.put(str(r))
        self.put('" stroke-width="')
        self.put(str(stroke_width))
        self.put('"')
        if fill:
            self.put(' fill="')
            self.put(fill)
            self.put('"')
        if stroke:
            self.put(' stroke="')
            self.put(stroke)
            self.put('"')
        self.put('/>\n')
643967
def make_simple(self):
        
        (inner_radius, outer_radius) = self.get_radii()
        radius = (inner_radius + outer_radius) / 2
        return cadquery.Workplane('XY') \
            .circle(radius).extrude(self.length)
325585
public void setRadius(float radius) {
		if (getOriginalLocation() != null) {
			Bbox oldBounds = (Bbox) getOriginalLocation();
			Bbox newBounds = (Bbox) oldBounds.clone();
			newBounds.setWidth(2 * radius);
			newBounds.setHeight(2 * radius);
			newBounds.setCenterPoint(oldBounds.getCenterPoint());
			setOriginalLocation(newBounds);
		} else {
			setOriginalLocation(new Bbox(0, 0, 2 * radius, 2 * radius));
		}
	}
1321914
def getDrivingDistance2D(self, vehID, x, y):
        
        self._connection._beginMessage(
            tc.CMD_GET_VEHICLE_VARIABLE, tc.DISTANCE_REQUEST, vehID, 1 + 4 + 1 + 8 + 8 + 1)
        self._connection._string += struct.pack("!BiBddB", tc.TYPE_COMPOUND, 2,
                                                tc.POSITION_2D, x, y, tc.REQUEST_DRIVINGDIST)
        return self._connection._checkResult(tc.CMD_GET_VEHICLE_VARIABLE, tc.DISTANCE_REQUEST, vehID).readDouble()
131968
def within(self, lat, lon, radius):
		'''
		
		'''
		self._geo = { "$circle": { 
						"$center": [
							factual.common.shared_filter_helpers.GeoScalar(lat), 
							factual.common.shared_filter_helpers.GeoScalar(lon), 
							], 
						"$meters": radius 
						}
					}
		return self
1351087
function findClosestPointIndexWithinRadius(points, x, y, radiusThreshold) {
    let closestIdx;
    let closestDist = Number.MAX_VALUE;
    points.forEach((d, idx) => {
      let distSqrd = Math.pow(d.x - x, 2) + Math.pow(d.y - y, 2); // changeto: (d.x - x)**2 + (d.y - y)**2;
      if (distSqrd < closestDist && distSqrd < radiusThreshold) {
        closestIdx = idx;
        closestDist = distSqrd;
      }
    });
    return closestIdx;
  }
267978
def circle_right(self, radius_m, velocity=VELOCITY, angle_degrees=360.0):
        
        distance = 2 * radius_m * math.pi * angle_degrees / 360.0
        flight_time = distance / velocity

        self.start_circle_right(radius_m, velocity)
        time.sleep(flight_time)
        self.stop()
754440
def endpoint(distance, heading)
      d = (distance / 1000.0) / EARTH_RADIUS_KM;
      heading = deg2rad(heading);

      oX = lng * Math::PI / 180;
      oY = lat * Math::PI / 180;

      y = Math.asin(Math.sin(oY) * Math.cos(d) + Math.cos(oY) * Math.sin(d) * Math.cos(heading));
      x = oX + Math.atan2(Math.sin(heading) * Math.sin(d) * Math.cos(oY), Math.cos(d) - Math.sin(oY) * Math.sin(y));

      y = y * 180 / Math::PI;
      x = x * 180 / Math::PI;

      self.class.new(:lat => y, :lng => x)
    end
95251
def radius_cmp(a, b, offsets):
    ''''''
    diff = radius(a, offsets) - radius(b, offsets)
    if diff > 0:
        return 1
    if diff < 0:
        return -1
    return 0
195467
def round_corner(radius, fill):
    """"""
    corner = Image.new('L', (radius, radius), 0)  # (0, 0, 0, 0))
    draw = ImageDraw.Draw(corner)
    draw.pieslice((0, 0, radius * 2, radius * 2), 180, 270, fill=fill)
    return corner
814801
def vary_radius(dt):
	""""""
	global time
	time += dt
	disc.inner_radius = disc.outer_radius = 2.5 + math.sin(time / 2.0) * 1.5