当前位置: 首页 > 知识库问答 >
问题:

使用三边测量应用程序进行二维三边测量

石超
2023-03-14

我试图实现三维点之间的三元组。我最终尝试使用这个库三元组。我使用了下面给出的例子,并尝试执行它。下面是代码

import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
import org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer;

import com.lemmingapex.trilateration.NonLinearLeastSquaresSolver;
import com.lemmingapex.trilateration.TrilaterationFunction;


public class Pointofintersection {
public static void main() {


    // TODO Auto-generated method stub
    double[][] positions = new double[][] { { 5.0, -6.0 }, { 13.0, -15.0 }, { 21.0, -3.0 }, { 12.4, -21.2 } };
    double[] distances = new double[] { 8.06, 13.97, 23.32, 15.31 };
    NonLinearLeastSquaresSolver solver = new NonLinearLeastSquaresSolver(new TrilaterationFunction(positions, distances), new LevenbergMarquardtOptimizer());
    Optimum optimum = solver.solve();
    double[] centroid = optimum.getPoint().toArray();
    System.out.println(centroid);
    //System.out.println(centroid[1]);
}

}

那么现在我应该期望什么类型的输出。我得到了一些奇怪的输出,我无法理解它本身。

    -2.0433926409457167E-7d,
    -9.1973399031975E-8d,
    -1.5723449006087263E-7d,
    +7.887051614592191E-8d,
    +1.4166246290402286E-7d,
    +3.330146018487787E-8d,
    +2.3278688667580978E-7d,
    -2.1139124097042925E-7d,
    +1.334449995534113E-7d,
    -1.6104730195920897E-7d,
    -1.3902314592614197E-7d,
    +2.0169027167169864E-7d,
    -9.040643863751471E-8d,
    -5.946190852360168E-8d,
    -1.8013411720005014E-7d,
    +2.6595401669835947E-8d,
    +8.607292924069425E-8d,
    +4.84038176769263E-10d,
    -2.2798356346688802E-7d,
    -1.203028719549339E-7d,
    -1.5111906039270745E-7d,
    +1.5859915617670956E-7d,
    -1.426262681506497E-7d,
    -9.892260062323546E-8d,
    -1.8492643515928268E-7d,
    +7.840210076743552E-8d,
    +2.1643071541578027E-7d,
    +2.313664294893465E-7d,
    +1.2541842003811723E-7d,
    -9.920197743470107E-8d,
    +3.655589133934081E-8d,
    +5.807052689551411E-8d,
    -3.244024724169575E-8d,
    -2.327564406466327E-7d,
    -6.38187356721971E-8d,
    -2.3995994000400915E-10d,
    -3.9793609609721186E-8d,
    -1.802510054588344E-7d,
    +5.745586744591196E-8d,
    +1.987228872666507E-7d,
    -2.3105188606976847E-7d,
    +2.0088042407239129E-7d,
    +6.624793114025702E-8d,
    -1.5587043044056635E-7d,
    +1.3606464059428694E-8d,
    +1.0008761540741556E-7d,
    +1.058213771597129E-7d,
    +3.3058299602856804E-8d,
    -1.1594886810010702E-7d,
    +1.378919824418909E-7d,
    -1.5683631181406778E-7d,
    -4.4200075770425176E-8d,
    +1.2250985436706623E-9d,
    -1.8297013058336644E-8d,
    -1.005004229646318E-7d,
    +2.337202285991116E-7d,
    +3.296104292035678E-8d,
    -2.23668185816307E-7d,
    -5.7055442971184756E-8d,
    +5.82391923137467E-8d,
    +1.244950238958056E-7d,
    +1.4399358260219398E-7d,
    +1.1901862840583523E-7d,
    +5.1856152603337505E-8d,
    -5.520562000491495E-8d,
    -1.9987622893254038E-7d,
    +9.697418238031897E-8d,
    -1.1603376405901542E-7d,
    +1.170714288147407E-7d,
    -1.550851303094034E-7d,
    +2.3472546699189522E-8d,
    +1.78211222185955E-7d,
    -1.6540009048230807E-7d,
    -5.137865010872577E-8d,
    +4.57490653163866E-8d,
    +1.2829599363166098E-7d,
    +1.985773325073412E-7d,
    -2.1792661654989742E-7d,
    -1.652218131743459E-7d,
    -1.178234251477505E-7d,
    -7.34071933723896E-8d,
    -2.9646587857612632E-8d,
    +1.5787194498912167E-8d,
    +6.52252321321176E-8d,
    +1.2100088103262734E-7d,
    +1.8544977697201776E-7d,
    -2.159273204728711E-7d,
    -1.2711589287782304E-7d,
    -2.2610609958205195E-8d,
    +9.993330547750349E-8d,
    -2.33974236642384E-7d,
    -6.830955860192377E-8d,
    +1.2244183812423448E-7d,
    -1.3620325027706252E-7d,
    +1.1178574689680927E-7d,
    -8.490693031052439E-8d,
    +2.2975389535985893E-7d,
    +1.0445707500867073E-7d,
    +1.8405243253979117E-8d,
    -2.6033812325397097E-8d,
    -2.6489990728664908E-8d,
    +1.9409124727247465E-8d,
    +1.1403826867020365E-7d,
    -2.1706266226554237E-7d,
    -1.7839974359909697E-8d,
    +2.3725087624341041E-7d,
    +7.37567604176979E-8d,
    -2.9098805266958403E-8d,
    -6.892713087722722E-8d,
    -4.333719263537725E-8d,
    +5.006436936098099E-8d,
    +2.1367325342138113E-7d,
    -2.6949659655907758E-8d,
    -1.9256682968755803E-7d,
    +1.960616287777496E-7d,
    +1.876664741413704E-7d,
    -2.1534486893602122E-7d,
    -5.688830723853217E-8d,
    +1.8861113228746644E-7d,
    +4.6730779443102234E-8d,
    -3.275360514112964E-9d,
    +4.1011920825226876E-8d,
    +1.820141955326842E-7d,
    -5.468175655175594E-8d,
    -1.8981247089866317E-7d,
    -2.209492705846306E-7d,
    -1.4566110577298295E-7d,
    +3.848544860465368E-8d,
    -1.429109630340783E-7d,
    -2.105749999899302E-7d,
    -1.6206609756618993E-7d,
    +5.058693461947143E-9d,
    -1.8359244902596882E-7d,
    +2.2810251664891242E-7d,
    -1.8791776732592608E-7d,
    +1.3106843166204263E-9d,
    -1.5543153797220025E-7d,
    -1.7884997059081524E-7d,
    -6.648490725635754E-8d,
    +1.8412576154421806E-7d,
    +9.860939269906055E-8d,
    +1.5627006743114285E-7d,
    -1.17260039161597E-7d,
    +2.3416513526430908E-7d,
    -2.1749172296989992E-7d,
    -3.9242560971295217E-8d,
    -1.822826971477839E-7d,
    -1.6729355321895212E-7d,
    +8.208715337901827E-9d,
    -1.301267783434537E-7d,
    -1.029741755377153E-7d,
    +9.215765583599035E-8d,
    -1.907487641016455E-8d,
    +4.2661388254716074E-8d,
    -1.9697226735187428E-7d,
    +2.1819935527247946E-7d,
    -1.398318929248588E-7d,
    +1.6195123407015624E-7d,
    +1.723826394935661E-7d,
    -1.0602700638269148E-7d,
    -1.9392742205954563E-7d,
    -8.880302882034106E-8d,
    +2.1186420987133E-7d,
    +2.3375763256988976E-7d,
    -2.0599801342241997E-8d,
    -7.184550924856607E-8d,
    +8.254840070367875E-8d,
};
LN_MANT
{ 
    {+0.0d,                   +0.0d,                   }, // 0
    {+9.760860120877624E-4d,  -3.903230345984362E-11d, }, // 1
    {+0.0019512202125042677d, -8.124251825289188E-11d, }, // 2
    {+0.0029254043474793434d, -1.8374207360194882E-11d,}, // 3
    {+0.0038986406289041042d, -2.1324678121885073E-10d,}, // 4
    {+0.004870930686593056d,  -4.5199654318611534E-10d,}, // 5
    {+0.025073636323213577d,  +1.2289023836765196E-9d, }, // 26
    ......
    {+0.02602556347846985d,   +1.7990281828096504E-9d, }, // 27
    {+0.026976589113473892d,  -1.4152718164638451E-9d, }, // 28
    {+0.02792670577764511d,   +7.568772963781632E-10d, }, // 29
    {+0.0288759246468544d,    -1.1449998592111558E-9d, }, // 30
    {+0.029824241995811462d,  -1.6850976862319495E-9d, }, // 31
    {+0.030771657824516296d,  +8.422373919843096E-10d, }, // 32
    {+0.0317181795835495d,    +6.872350402175489E-10d, }, // 33
    {+0.03266380727291107d,   -4.541194749189272E-10d, }, // 34
    {+0.03360854089260101d,   -8.9064764856495E-10d,   }, // 35
    {+0.034552380442619324d,  +1.0640404096769032E-9d, }, // 36
    {+0.0354953333735466d,    -3.5901655945224663E-10d,}, // 37
    {+0.03643739968538284d,   -3.4829517943661266E-9d, }, // 38
    {+0.037378571927547455d,  +8.149473794244232E-10d, }, // 39
    {+0.03831886500120163d,   -6.990650304449166E-10d, }, // 40
    {+0.03925827145576477d,   +1.0883076226453258E-9d, }, // 41
    {+0.040196798741817474d,  +3.845192807999274E-10d, }, // 42
    {+0.04113444685935974d,   -1.1570594692045927E-9d, }, // 43
    {+0.04207121580839157d,   -1.8877045166697178E-9d, }, // 44
    {+0.043007105588912964d,  -1.6332083257987747E-10d,}, // 45
    {+0.04394212365150452d,   -1.7950057534514933E-9d, }, // 46
    {+0.04487626254558563d,   +2.302710041648838E-9d,  }, // 47
    {+0.045809537172317505d,  -1.1410233017161343E-9d, }, // 48
    {+0.04674194008111954d,   -3.0498741599744685E-9d, }, // 49
    {+0.04767347127199173d,   -1.8026348269183678E-9d, }, // 50
    {+0.04860413819551468d,   -3.233204600453039E-9d,  }, // 51
    {+0.04953393340110779d,   +1.7211688427961583E-9d, }, // 52
    {+0.05046287178993225d,   -2.329967807055457E-10d, }, // 53
    {+0.05139094591140747d,   -4.191810118556531E-11d, }, // 54
    {+0.052318163216114044d,  -3.5574324788328143E-9d, }, // 55
    {+0.053244516253471375d,  -1.7346590916458485E-9d, }, // 56
    {+0.05417001247406006d,   -4.343048751383674E-10d, }, // 57
    {+0.055094651877880096d,  +1.92909364037955E-9d,   }, // 58
    {+0.056018441915512085d,  -5.139745677199588E-10d, }, // 59
    {+0.05694137513637543d,   +1.2637629975129189E-9d, }, // 60
    {+0.05786345899105072d,   +1.3840561112481119E-9d, }, // 61
    {+0.058784693479537964d,  +1.414889689612056E-9d,  }, // 62
    {+0.05970507860183716d,   +2.9199191907666474E-9d, }, // 63
    {+0.0606246218085289d,    +7.90594243412116E-12d,  }, // 64
    {+0.06154331564903259d,   +1.6844747839686189E-9d, }, // 65
    {+0.06246116757392883d,   +2.0498074572151747E-9d, }, // 66
    {+0.06337818503379822d,   -4.800180493433863E-9d,  }, // 67
    {+0.06429435312747955d,   -2.4220822960064277E-9d, }, // 68
    {+0.06520968675613403d,   -4.179048566709334E-9d,  }, // 69
    {+0.06612417101860046d,   +6.363872957010456E-9d,  }, // 70
    {+0.06703783571720123d,   +9.339468680056365E-10d, }, // 71
    {+0.06795066595077515d,   -4.04226739708981E-9d,   }, // 72
    .......
    {+0.47036975622177124d,   +1.6922605350647674E-8d, }, // 615
    {+0.4709796905517578d,    +2.4667033200046904E-8d, }, // 616
    .......
    {+0.5952457189559937d,    +3.67972590471072E-8d,   }, // 833
    {+0.595784068107605d,     +4.566672575206695E-8d,  }, // 834
    {+0.5963221788406372d,    +3.2813537149653483E-9d, }, // 835
    {+0.5968599319458008d,    +2.916199305533732E-8d,  }, // 836
    {+0.5973974466323853d,    +4.410412409109416E-9d,  }, // 837
    {+0.5979346036911011d,    +4.85464582112459E-8d,   }, // 838
    {+0.5984715223312378d,    +4.267089756924666E-8d,  }, // 839
    {+0.5990082025527954d,    -1.2906712010774655E-8d, }, // 840
    {+0.5995445251464844d,    +1.3319784467641742E-9d, }, // 841
    {+0.6000806093215942d,    -3.35137581974451E-8d,   }, // 842
    {+0.6006163358688354d,    +2.0734340706476473E-9d, }, // 843
    {+0.6011518239974976d,    -1.0808162722402073E-8d, }, // 844
    {+0.601686954498291d,     +4.735781872502109E-8d,  }, // 845
    {+0.6022218465805054d,    +5.76686738430634E-8d,   }, // 846
    {+0.6027565002441406d,    +2.043049589651736E-8d,  }, // 847
    {+0.6032907962799072d,    +5.515817703577808E-8d,  }, // 848
    {+0.6038248538970947d,    +4.2947540692649586E-8d, }, // 849
    {+0.6043586730957031d,    -1.589678872195875E-8d,  }, // 850
    {+0.6048921346664429d,    -1.8613847754677912E-9d, }, // 851
    {+0.6054253578186035d,    -3.3851886626187444E-8d, }, // 852
    {+0.6059582233428955d,    +7.64416021682279E-9d,   }, // 853
    .........
    {+0.6872705221176147d,    +4.995334552140326E-8d,  }, // 1012
    {+0.687761664390564d,     -5.3763211240398744E-8d, }, // 1013
    {+0.6882524490356445d,    -4.0852427502515625E-8d, }, // 1014
    {+0.688742995262146d,     -3.0287143914420064E-8d, }, // 1015
    {+0.6892333030700684d,    -2.183125937905008E-8d,  }, // 1016
    {+0.6897233724594116d,    -1.524901992178814E-8d,  }, // 1017
    {+0.6902132034301758d,    -1.0305018010328949E-8d, }, // 1018
    {+0.6907027959823608d,    -6.764191876212205E-9d,  }, // 1019
    {+0.6911921501159668d,    -4.391824838015402E-9d,  }, // 1020
    {+0.6916812658309937d,    -2.9535446262017846E-9d, }, // 1021
    {+0.6921701431274414d,    -2.2153227096187463E-9d, }, // 1022
    {+0.6926587820053101d,    -1.943473623641502E-9d,  }, // 1023
};
SINE_TABLE_A=
{
    +0.0d,
    +0.1246747374534607d,
    +0.24740394949913025d,
    +0.366272509098053d,
    +0.4794255495071411d,
    +0.5850973129272461d,
    +0.6816387176513672d,
    +0.7675435543060303d,
    +0.8414709568023682d,
    +0.902267575263977d,
    +0.9489846229553223d,
    +0.9808930158615112d,
    +0.9974949359893799d,
    +0.9985313415527344d,
};
SINE_TABLE_B=
{
    +0.0d,
    -4.068233003401932E-9d,
    +9.755392680573412E-9d,
    +1.9987994582857286E-8d,
    -1.0902938113007961E-8d,
    -3.9986783938944604E-8d,
    +4.23719669792332E-8d,
    -5.207000323380292E-8d,
    +2.800552834259E-8d,
    +1.883511811213715E-8d,
    -3.5997360512765566E-9d,
    +4.116164446561962E-8d,
    +5.0614674548127384E-8d,
    -1.0129027912496858E-9d,
};
COSINE_TABLE_A=
{
    +1.0d,
    +0.9921976327896118d,
    +0.9689123630523682d,
    +0.9305076599121094d,
    +0.8775825500488281d,
    +0.8109631538391113d,
    +0.7316888570785522d,
    +0.6409968137741089d,
    +0.5403022766113281d,
    +0.4311765432357788d,
    +0.3153223395347595d,
    +0.19454771280288696d,
    +0.07073719799518585d,
    -0.05417713522911072d,
};
COSINE_TABLE_B=
{
    +0.0d,
    +3.4439717236742845E-8d,
    +5.865827662008209E-8d,
    -3.7999795083850525E-8d,
    +1.184154459111628E-8d,
    -3.43338934259355E-8d,
    +1.1795268640216787E-8d,
    +4.438921624363781E-8d,
    +2.925681159240093E-8d,
    -2.6437112632041807E-8d,
    +2.2860509143963117E-8d,
    -4.813899778443457E-9d,
    +3.6725170580355583E-9d,
    +2.0217439756338078E-10d,
};
TANGENT_TABLE_A=
{
    +0.0d,
    +0.1256551444530487d,
    +0.25534194707870483d,
    +0.3936265707015991d,
    +0.5463024377822876d,
    +0.7214844226837158d,
    +0.9315965175628662d,
    +1.1974215507507324d,
    +1.5574076175689697d,
    +2.092571258544922d,
    +3.0095696449279785d,
    +5.041914939880371d,
    +14.101419448852539d,
    -18.430862426757812d,
};
TANGENT_TABLE_B=
{
    +0.0d,
    -7.877917738262007E-9d,
    -2.5857668567479893E-8d,
    +5.2240336371356666E-9d,
    +5.206150291559893E-8d,
    +1.8307188599677033E-8d,
    -5.7618793749770706E-8d,
    +7.848361555046424E-8d,
    +1.0708593250394448E-7d,
    +1.7827257129423813E-8d,
    +2.893485277253286E-8d,
    +3.1660099222737955E-7d,
    +4.983191803254889E-7d,
    -3.356118100840571E-7d,
};

所以,请让我知道,如果我做错了什么,或者它是真实的数据,我应该解析,并用于其他一些计算。

共有1个答案

鲁阳焱
2023-03-14

你能用这个系统打印一个双数组吗。出来println()和您正在做的一样?

double[] centroid = optimum.getPoint().toArray();
System.out.println(centroid);

您是否尝试过这样的方法:打印Java数组的最简单方法是什么?

 类似资料:
  • 我一直在通过维基百科上的页面阅读三边测量,并试图制作一个我自己的二维版本。然而,我遇到了一些问题,我希望对数学有更好理解的人能帮我解决。 我是和C#一起做这件事的。 我的场景包括屏幕中央的3个球体。球体1总是在标记0,0,0。在这些球体旁边,我有一个立方体,我想移动到3个球体的交叉点。 到目前为止,这是我的代码: P1,P2和P3是我对维基页面以下数学公式的解释: 我的X和Y公式如下: 当我将所有

  • 我试图用Javascript使用https://github.com/gheja/trilateration.js而且它似乎在起作用。然而,某些简单的情况应该产生解决方案,但事实并非如此。例如: 这似乎是一个简单得可笑的例子,应该在x:0,y:0产生一个解,但是函数告诉我没有解。我是否对三边测量有误解,或者函数中是否存在错误? 任何帮助都将不胜感激。

  • 我试图找出一个问题,你假装你是一个在未知目标位置(纬度和经度坐标)的GPS装置。我得到了4颗卫星的数据(纬度和经度坐标对,每对卫星到目标位置的距离(以公里为单位)和增量时间)。有人知道如何计算目标位置的坐标吗?我试着做研究,但所涉及的数学知识远远超出了我的能力。提前感谢您的帮助。 以下是数据:

  • 如我所知,三次分割是寻找三个球体交汇区域中心的过程。我在c中写了三边测量法,我取了方程式,它是维基百科中三边测量中心和二维三边测量的细节 举一个如下的例子: 例1:p1(5,10),p2(15,10),p3(10,20),r1=9,r2=7,r3=8,答案是(11.6,13.8),这是逻辑答案。 但当像下面的例子一样的情况下,答案就像一个垃圾数字,我从计算中确定,但在这种情况下,我不知道原因! E

  • 我正在使用wifi三边测量技术开发室内导航应用程序, 我有3个接入点我得到了lat 我需要转换每个lat 加上如果我得到x,y不可能转换成它的拉特 谢啦

  • 对于三角测量,您需要知道设备接收信号的方向。我们可以计算到达角,但计算到达角需要一组接收器。手机能计算到达角吗?我问这个问题是因为我遇到了诸如wifi/BLE三角测量、通过三角测量计算位置等术语,但在大多数情况下,它们实际上是指三边测量。我知道三边测量在手机上的工作原理和所有细节,但我认为三角测量是不可能的。如果可能的话,如何可能?如果使用ibeacons来近似位置,哪个(三角测量或三边测量)会产