/**
 **
 ** AffineImport.java - Affine (8-parameter) image transformation import from CSV
 **
 ** Copyright (C) 2024 Elphel, Inc.
 **
 ** -----------------------------------------------------------------------------**
 **
 **  AffineImport.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 AffineImport {
	public static final String AFFINE_TAG = "AFFINE";
	public static final int    AFFINE_LEN = 8;
	public String name;
	public double [][] affine;
	public static boolean matches(String [] tokens) {
		return ((tokens.length == AFFINE_LEN) && AFFINE_TAG.equals(tokens[0]));
	}
	public AffineImport(
			String [] tokens) {
		if (!matches(tokens)) {
			throw new IllegalArgumentException ("Not AffineImport tokens");
		}
		int indx = 1;
		name = 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++]);
			}
		}
	}
	
// String[] tokens	
}
