Hello Colin,
It currently uses ELLIPSE3D, CIRCULARCYLINDER, CYLINDER, CIRCLE3D only. (with my version).
I found the source code of this console version and extend the argument list by the keyword PLANE
, see code below.
Please download the modified version and check it out:
https://dev.applied-geodesy.org/tmp/FormFittingToolboxConsole.jar
Let my know, if/how it works.
regards
Micha
/**********************************************************************
* FormFittingToolboxConsole *
************************************************************************
* Copyright (C) by Michael Loesler, http//derletztekick.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
* or write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
**********************************************************************/
package com.derletztekick.geodesy.formFittingToolbox.v2.console;
import java.io.File;
import java.util.Locale;
import com.derletztekick.geodesy.formFittingToolbox.v2.form.Form;
import com.derletztekick.geodesy.formFittingToolbox.v2.form.form3d.Circle3D;
import com.derletztekick.geodesy.formFittingToolbox.v2.form.form3d.CircularCylinder;
import com.derletztekick.geodesy.formFittingToolbox.v2.form.form3d.Cylinder;
import com.derletztekick.geodesy.formFittingToolbox.v2.form.form3d.Ellipse3D;
import com.derletztekick.geodesy.formFittingToolbox.v2.form.form3d.Plane;
import com.derletztekick.geodesy.formFittingToolbox.v2.gui.FormManager;
import com.derletztekick.geodesy.formFittingToolbox.v2.io.PointFileReader;
public class FormFittingToolboxConsole {
/**
* @param args
*/
public static void main(String[] args) {
System.setProperty("com.github.fommil.netlib.BLAS", "com.github.fommil.netlib.F2jBLAS");
System.setProperty("com.github.fommil.netlib.LAPACK", "com.github.fommil.netlib.F2jLAPACK");
System.setProperty("com.github.fommil.netlib.ARPACK", "com.github.fommil.netlib.F2jARPACK");
int dim = 3;
double levmar = 0;
String formType = args[0];
try {levmar = Double.parseDouble(args[1]);} catch(NumberFormatException nfe) {nfe.printStackTrace();}
File pointFile = new File(args[2]);
File exportFile = new File(args[3]);
FormManager formManager = new FormManager(null, Locale.getDefault());
formManager.setDimension(dim);
formManager.setLevMarDampingValue(Math.abs(levmar));
formManager.adjustUnknownParametersOnly(true);
// ELLIPSE3D/CIRCULARCYLINDER/CYLINDER/CIRCLE3D/PLANE
if (formType.equalsIgnoreCase("ELLIPSE3D"))
formManager.setFormClass(Ellipse3D.class);
else if (formType.equalsIgnoreCase("CYLINDER"))
formManager.setFormClass(Cylinder.class);
else if (formType.equalsIgnoreCase("CIRCULARCYLINDER"))
formManager.setFormClass(CircularCylinder.class);
else if (formType.equalsIgnoreCase("CIRCLE3D"))
formManager.setFormClass(Circle3D.class);
else if (formType.equalsIgnoreCase("PLANE"))
formManager.setFormClass(Plane.class);
else {
System.err.println("Error, unknwon surface type: " + formType);
return;
}
PointFileReader reader = new PointFileReader(pointFile, dim);
reader.ignoreLinesWhichStartWith("#");
int status = -1;
if (reader.readSourceFile()) {
formManager.setPointGroup(reader.getPoints());
Form form = formManager.createForm();
status = form.estimateModel();
}
if (status == 1) {
formManager.exportFormParametersToFile(exportFile);
System.out.println("\n\nEstimation successfully finished!");
}
else {
System.err.println("Estimation failed!");
return;
}
}
}