package ipp.imse.fusionOptics.imse;

import fusionOptics.interfaces.IsoIsoInterface;
import fusionOptics.lenses.Nikon135mmF28;
import fusionOptics.lenses.Nikon50mmF11;
import fusionOptics.lenses.SchneiderXenon25mmF095;
import fusionOptics.materials.BK7;
import fusionOptics.materials.IsotropicFixedIndexGlass;
import fusionOptics.optics.SimpleDoubleConvexLens;
import fusionOptics.types.Medium;

public class IMSEOptics75_25_imgFielded_fibreFielded extends IMSEOptics {
	public IMSEOptics75_25_imgFielded_fibreFielded() {
		
		double focalLengthCollect = 0.150;
		double fieldToImagerDistance = 0.150;
		double focalLengthField = 0.100;
		double focalLengthImager = 0.025;
		double focalLengthFibreField = -0.070; //field lens at fibre plane
		
		double secondCollectorShift = 0.010;

		double imagerToCCDDist = 1.0 / (1.0/focalLengthImager - 1.0/fieldToImagerDistance);
	
		focalLength1 = 0.075;
		
		//this is now the effective focal length of the whole (collectors + field + imager)
		focalLength2 = focalLengthCollect + fieldToImagerDistance + imagerToCCDDist + secondCollectorShift;

		rotateObjLens = true;
		
		imgLensPlaneToCell = 0; //we do it differently here

		objLensPlaneToCell = rotateObjLens ? 0.060 : 0.080; //for the 75 (50 scaled)
		
		objLens = new Nikon50mmF11(new double[]{ focalLength1 + focusAdjustObj, 0, 0 }, 0.075/0.050);
		objLensCaseRadius = ((Nikon50mmF11)objLens).getCaseRadius();
		
		imgLens = new SchneiderXenon25mmF095(new double[]{ 
				focalLength1 + objLensPlaneToCell + cellLength + focalLengthCollect 
					+ fieldToImagerDistance + secondCollectorShift
				, 0, 0 });
		imgLensCaseRadius = ((SchneiderXenon25mmF095)imgLens).getCaseRadius();
					
		init();

		addElement(new SimpleDoubleConvexLens("fibreField", 
				new double[]{ 0, 0, 0 }, 
				new double[]{ 1, 0, 0 }, 
				0.020, 
				new Medium(new IsotropicFixedIndexGlass(1.9)),
				IsoIsoInterface.ideal(),
				focalLengthFibreField, 
				wavelength));

		addElement(new SimpleDoubleConvexLens("imgCollector1", 
				new double[]{ focalLength1 + objLensPlaneToCell + cellLength, 0, 0 }, 
				new double[]{ 1, 0, 0 }, 
				cellApature/2, 
				new Medium(new IsotropicFixedIndexGlass(1.9)),
				IsoIsoInterface.ideal(),
				focalLengthCollect*2, 
				wavelength));
		

		addElement(new SimpleDoubleConvexLens("imgCollector2", 
				new double[]{ focalLength1 + objLensPlaneToCell + cellLength + secondCollectorShift, 0, 0 }, 
				new double[]{ 1, 0, 0 }, 
				cellApature/2, 
				new Medium(new IsotropicFixedIndexGlass(1.9)),
				IsoIsoInterface.ideal(),
				focalLengthCollect*2, 
				wavelength));

		addElement(new SimpleDoubleConvexLens("imgField1", 
				new double[]{ focalLength1 + objLensPlaneToCell + cellLength 
							+ focalLengthCollect + secondCollectorShift - 0.005, 0, 0 }, 
				new double[]{ 1, 0, 0 }, 
				0.030, 
				new Medium(new IsotropicFixedIndexGlass(1.9)),
				IsoIsoInterface.ideal(),
				focalLengthField*2, 
				wavelength));
		

		addElement(new SimpleDoubleConvexLens("imgField2", 
				new double[]{ focalLength1 + objLensPlaneToCell + cellLength 
							+ focalLengthCollect + secondCollectorShift + 0.005, 0, 0 }, 
				new double[]{ 1, 0, 0 }, 
				0.030, 
				new Medium(new IsotropicFixedIndexGlass(1.9)),
				IsoIsoInterface.ideal(),
				focalLengthField*2, 
				wavelength));
		
		filterAtField.shift(new double[]{ secondCollectorShift + focalLengthCollect, 0, 0 });
	}
}
