Circle in circle collision - collision

How to find a collision between two circles if one circle inside another circle.
As the screenshot like this
Thanks for any help!

If the distance between the centers of the two circles is equal to the radius of the big circle minus the radius of the small circle, then they are colliding.

Related

Point within multiple spheres

The above graphic is meant to more efficiently display my problem than I would ever hope to be able to explain with words.
As you can see, there is an n-number ( 3 in this case ) of spheres ( displayed as circles for simplicity ) of varying sizes, and a point ( the red one ) which technically belongs to all 3 of them at once.
However, a point can only belong to a single sphere at any one time.
What I'm trying to find is an efficient algorithm, which will allow me to determine which of these spheres the point actually belongs to. The end result, I'm hoping, will look a little something like this:
Here, I've used the radial lines to "clip" the circles in the graphic where appropriate, and it is clear now that the red dot belongs to the large left-most circle.
Any help would be appreciated! :D
Not an answer, just a comment.
If I am right, the loci of the points equidistant to two spheres in the reduced sense (proportionally to the radius) are themselves on a sphere (that can degenerate to a plane).
The diagram is as below:
To check if a point lies within a circle, define the circle by its center and a radius and check if the distance of the point to the center is less than the radius.
To find which circle a point belongs to (in the manner indicated by your diagram), compute the power of the point as the distance of the point to the circle center point, squared, minus the square of the circle radius:
power = distance2 - radius2
If the result is less than 0, it's inside that circle. It belongs to the circle with the smallest power.

Circle inscribed in a rectangle

I am given a lot of points and the points are suppose to be from a rectangle. I'm required to calculate the boundary of the rectangle.(which is relatively easy) But I also have to figure out radius of a candle(cylinder) that could be anywhere in the rectangle. All of this from just the given points. I would appreciate if someone could suggest ways to achieve this.
The points in my case are measurements of a robot wandering through this rectangle, and the empty circle is a pole of a certain unknown radius inside the rectangle that the robot can hit. So I need to figure out the radius of the pole in order to avoid that. I need to estimate the pole. It doesn't have to be exact. I'm expecting robot measurements to be enough that they'd give me pretty good idea where pole is.
If you can afford it, just rasterize the area, mark the affected pixels, then start "growing" areas around them until they meet (this will give you raster versions of their Voronoi regions). The pixel (inside the rectangle) with the largest distance to any point will likely be the empty circle's center.
Alternatively, you can do a Delauney triangulation, find the largest triangle inside the rectangle, and add its neighbours while they form a convex shape. That shape will be an approximation of the circle.

Separate circle and rectangle

In a 2d space there are a rectangle and a circle that overlap each other. How can
I calculate the smallest distance (depth) that I need to separate the circle and the rectangle?
I'll assume from the way you've described it if one shape entirely contains the other, that still counts as "overlapping"
The strategy to separate a circle from a rectangle while moving the circle the shortest distance is as follows:
Draw a line from the circle's centre to the nearest point on one of the rectangle's vertices
Pull the circle along this line until they are no longer overlapping
So to calculate the distance that it needs to be pulled, your formula will be:
pullDistance = radius - centreDistance
Where:
pullDistance is what you're trying to calculate
radius is the radius of the circle
centreDistance is the distance of the centre of the circle from the nearest point on the edge of the rectangle.
Two things to note:
If the centre of the circle is inside the rectangle, then centreDistance should be calculated the same way, but made negative
If the pullDistance is negative then the two shapes are already not overlapping, so the true distance is 0.
So since radius is known, all you have to do is calculate the centreDistance. The way to do this is to find the distance from the circle's centre point to each of the rectangle's four line segments and take the minimum. Finding the distance between a point and a line segment is a common task, I won't repeat how to do that here. This question has a lot of samples and information for how to do it.

Algorithm for a "Blob" Border

I have several 2 dimensional circles that I want to draw a border around. I've done this using a convex hull before, but my goal is to make the border almost like a surrounding "blob". I attached a picture to show what I mean.
Essentially, I want the border to outline the circles, and be pulled slightly into the middle of the area if no circles are present. The center shape shows my current train of thought -- create normal lines for each circle, and somehow merge them into a complete shape.
Summed up, I have 2 questions:
1. Are there any existing algorithms to do this?
2. If not, are there any algorithms that would help me merge the circle outlines into a single larger path?
Thank you!
"Everything You Always Wanted to Know About Alpha Shapes But Were Afraid to Ask" is for you http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/belair/alpha.html
One way to get this border could be to simply compute the distance to the centers of circles: for a given point this distance is the minimum of the distances from this point to all the centers of the given circles. Then sample this distance function over a regular grid. And finally extract the f-level of this function as a collection of polylines with an isocurve extraction algorithm (like Marching Squares). f should be the radius of the circles augmented with the desired margin.

drawing arc points

Can someone provide me an algorithm to draw points on arc? I know the start-point, end-point and radius. I need to show points on the arc made by this information(start-point, end-point and radius).
See the image for more details
I have Start-Point (x,y), End-Point(a,b). I have to calculate equally distance 5 points on arc. Is it possible?
The standard algorithm for this is the Midpoint circle algorithm (sometimes called Breshenham's circle algorithm).
Note that your arc specification is incomplete. There are generally two arcs of the same radius joining two given points, one for the center on each side of the line joining the points. Also, as #In silico points out, the radius can be no smaller than half the distance between the points.
The means of specifying an arc is similar to that used in SVG, which has some detailed implementation notes which are too long to copy here. For circular arcs, the x and y radii are equal so the x axis angle is not important. As Ted Hopp noted, you need a flag to indicate which direction the arc is drawn in ( in SVG called large-arc-flag ).
Once you have the centre and angles of start and end of the arc, divide the angle into six and use the sin/cos of this angle to plot the five intermediate points.

Resources