Home > Software engineering >  Strives for the algorithm! More difficult! Be urgent!
Strives for the algorithm! More difficult! Be urgent!

Time:10-09

Have 4000 points coordinates, first check the distance between any two points not less than a set value such as D1, if there are two points of distance is less than the condition of D1, request according to the given value R1, will be one arbitrary point on the circle radius is R1 any move, until find a distance not less than D1, ultimately through mobile, 4000 points all conform to the coordinates of any two points is greater than the set value, the distance between D1,

CodePudding user response:

R1 must be greater than or equal to 2 D1/?

CodePudding user response:

Not all have the solution,

Consider two extreme situation,

Case 1: R1=D1/2 and there are five points of overlap,
You keep point 0 still, the rest four points upward, respectively, the left and right two r1 (center of the circle is that they respectively and point halfway to the zero point), just to solve,

Situation 2: R1=D1/2 and there are six points of overlap,
Obviously, many a under two-dimensional condition can't point out,

CodePudding user response:

Still have a kind of computing cannot solve,

Every move a point, can enter the other point of the "turf" (at that point as the center of the circle, D1 circle of radius), it involves moving other points, and in some cases, the final iteration calculation would be beyond the scope of can be achieved,

CodePudding user response:

No it doesn't matter, just have a tip,
Difficult is difficult in the [color=# FF0000] every move a point, can enter the other point of the "turf" (at that point as the center of the circle, D1 circle of radius) [/ color], it doesn't matter, no solution now only require an implementation algorithm!

CodePudding user response:

Yesterday issued by work in the post on the second floor has a defect,

In fact, in a radius of circumscribed circle of D1, up to 7 points, including a center for the other 6 six vertices of hexagon circumscribed circle, this is known as "honeycomb" structure,

Give you an idea, that is, will occupy the space to maximize all points,

First of all find out all points to occupy the center of the space, note that this could happen to have an "point", may also have no,

Then, find the outer points, its "radiation" in the direction away from the center of the distance of 2 * R1, this step, is to expand the territory,

After check just move the distance between each point, because it is the outermost layer, the probability of mutual infestation is small, if any, will reset, then, is the outside-in can adjust step by step,

Adjustment algorithm, I haven't thought good, but there are several rules is necessary:
1 must be the first to find multiple point aggregation point by the "outside", give priority to move them,
2 moves, you can find the nearest has moved to a fixed point of two, if very close, want to consider to close on two points into the position of an equilateral triangle, because of the honeycomb structure can accommodate more points,
  • Related