1

プログラムで三辺測量を使用して、実際の生活でどのようになるかをシミュレートしようとしています。信号が移動するたびに弱くなる信号を送信する 3 つの送信機があります。数値の大まかな円を生成する 2D 配列とコードを使用しています。これは送信機の1つを示しています

00000000000000000000
00000000000000000000
00000000000000000000
00000000001000000000
00000000112110000000
00000001223221000000
00000001234321000000
00000012344432100000
00000001234321000000
00000001223221000000
00000000112110000000
00000000001000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000

私の質問は、グリッド内の受信機の位置を見つけるにはどうすればよいですか? 3 つの円すべてが交差する場所を見つけるにはどうすればよいですか? 円の方程式を互いに等しく設定して解こうとしましたが、何も得られず、虚数が得られました。

コードを編集して、円が塗りつぶされないようにすることもできます。各円の半径は変更可能

各送信機の信号強度は受信機によって事前に認識されており、強度も変更できます (100、200、300 の範囲、またはその他の範囲)。

4

1 に答える 1

0

You basically have 2 problems

  1. Finding the location of the transmitters
  2. Calculating the intersection

Point 1:

Point 1 can be solved by checking specific points in the grid in a brute force manner. However there are a couple of optimalisations possible while trying to find the first. As soon as you find one, you can make educated guesses about the locations of the others based on the radius of the transmitter you just found and the ones you need to find.

I would recommend probing the grid on intervals that are close to that of the biggest known radius. Assuming all transmitters are fully within the grid you can probe as like in the following figure (assuming the biggest radius you have is 5) - A's mark the probing points:

00000000000000000000
00000000000000000000
00000000000000000000
00000000001000000000
0000A00011211A000000
00000001223221000000
00000001234321000000
00000012344432100000
00000001234321000000
00000001A23221000A00
00000000112110000000
00000000001000000000
00000000000000000000
00000000000000000000
0000A00000000A000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
00000000A00000000A00

With this you could probe your current grid with 8 probes tops. This can be reduced further with some extra checks when it comes to distance to the edges of your grid. But in your case you would notice that your third probing point falls within a radius. From there on you can break off the probing and look for the center of the found transmitter.

Now that you have at least 1 center of a transmitter found, you can make educated guesses about the location of the other transmitters since you know the ranges of each transmitter and you have the knowlegde that the distance to the next transmitter will be less than the range of the biggest + the smallest range. Again you can probe around at decent intervals within your grid to find the second transmitter fast. Again calculate the exact center of your second transmitter.

The third transmitter is easy to calculate. Calculate the point that is at the center of the line between the 2 found transmitters (easy to do in a coordinate system or in a grid). The missing point should be on the either side of the imaginary line you've drawn between the 2 found transmitters at a maximum distance of the transmitter's range you haven't found yet from the center point of that line.

Point 2:

The answer can be found in this post

An alternative could be the TULIP Algorithm

于 2013-05-27T18:00:50.827 に答える