/**
 **
 ** Affine2Import.java - Affine2 (10-parameter) image transformation import from CSV
 **
 ** Copyright (C) 2024 Elphel, Inc.
 **
 ** -----------------------------------------------------------------------------**
 **
 **  Affine2Import.java 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/>.
 ** -----------------------------------------------------------------------------**
 **
 */
package com.elphel.imagej.orthomosaic;

public class Affine2Import {
	public static final String AFFINE2_TAG = "AFFINE2";	
	public static final int    AFFINE2_LEN = 10;
	public String name1;
	public String name2;
	public double overlap;
	public double [][] affine;
	public static boolean matches(String [] tokens) {
		return ((tokens.length == AFFINE2_LEN) && AFFINE2_TAG.equals(tokens[0]));
	}
	public Affine2Import(
			String [] tokens) {
		if (!matches(tokens)) {
			throw new IllegalArgumentException ("Not Affine2Import tokens");
		}
		int indx = 1;
		name1 = tokens[indx++];
		name2 = tokens[indx++];
		overlap = Double.parseDouble(tokens[indx++]);
		affine = new double [2][3];
		for (int i = 0; i < affine.length; i++) {
			for (int j = 0; j < affine[i].length; j++) {
				affine[i][j] = Double.parseDouble(tokens[indx++]);
			}
		}
	}
}
