資源簡介
四參數計算類代碼,實現知道2個以上公共點的坐標求出四個轉換參數
代碼片段和文件信息
package?com.android.test.test;
import?android.content.pm.ActivityInfo;
import?android.widget.Toast;
/**
?*?Created?by?11920?on?2017/5/12.
?*/
public?class?FourParaChange?{
????private?double?dxdyKdAngle;
????public?FourParaChange?(Matrix?MP)?{
????????int?iCol?=?MP.getCol();//MP矩陣的列數【X?Y?x?y】
????????int?iRow?=?MP.getRow();//MP矩陣【X?Y?x?y】的行數,等價于已知的公共點個數
????????if?(iRow?2?||?iCol?!=?4)
????????{
??????????return;
????????}
????????//方程:A*X=Mb
???//構建系數矩陣A?和?Mb
????????Matrix?A=new?Matrix(2?*?iRow?4);/*??A=X?-Y?1?0
???????????????????Y??X?0?1???*/
????????Matrix?Mb=new?Matrix(2?*?iRow?1);//b=?~[x?y]
????????int?j?=?0;
????????for?(int?i?=?0;?i?2?*?iRow;?i?+=?2)
????????{
????????????double?X?=?MP.getElem(j?0)?Y?=?MP.getElem(j?1);
????????????A.setElem(i?0X);
????????????A.setElem(i?1-Y);
????????????A.setElem(i?21);
????????????A.setElem(i?30);
????????????A.setElem(i?+?1?0Y);
????????????A.setElem(i?+?1?1X);
?
- 上一篇:java聊天室程序設計報告
- 下一篇:JSP簡單的猜字游戲
評論
共有 條評論