package fem;

import math.Maths;
import math.matrix.Matrix;

public class T {

	/**
	 * Drehung um y: Dimension in x
	 * @param alpha
	 * @return Transformationsmatrix
	 */
	public static Matrix yx(double alpha){
		double s = Maths.sind(alpha);
		double c = Maths.cosd(alpha);
		return new Matrix(new double[][]{{c,-s}});
	}

	/**
	 * Drehung um y: Dehnstab in x
	 * @param alpha
	 * @return Transformationsmatrix
	 */
	public static Matrix yx2(double alpha){
		return yx(alpha).sumDirect(yx(alpha));
	}

	/**
	 * Drehung um z: Dimension in x
	 * @param beta
	 * @return Transformationsmatrix
	 */
	public static Matrix zx(double beta){
		double s = Maths.sind(beta);
		double c = Maths.cosd(beta);
		return new Matrix(new double[][]{{c,s}});
	}

	/**
	 * Drehung um z: Dehnstab in x
	 * @param beta
	 * @return Transformationsmatrix
	 */
	public static Matrix zx2(double beta){
		Matrix T = zx(beta);
		return T.sumDirect(T);
	}

	/**
	 * Drehung um z: Dehnstab in x
	 * @param beta
	 * @return Transformationsmatrix
	 */
	public static Matrix zx3(double beta){
		Matrix T = zx(beta);
		return T.sumDirect(T).sumDirect(T);
	}

	/**
	 * Drehung um y: Biegebalken in z und um y
	 * @param alpha
	 * @return Transformationsmatrix
	 */
	public static Matrix yzy(double alpha){
		double s = Maths.sind(alpha);
		double c = Maths.cosd(alpha);
		return new Matrix(new double[][]{
				{s,c,0,0,0,0},
				{0,0,1,0,0,0},
				{0,0,0,s,c,0},
				{0,0,0,0,0,1}});
	}

	/**
	 * Drehung um y: Dehnstab in x und Biegebalken in z und um y
	 * @param alpha
	 * @return Transformationsmatrix
	 */
	public static Matrix yxzy(double alpha){
		double s = Maths.sind(alpha);
		double c = Maths.cosd(alpha);
		return new Matrix(new double[][]{
				{c,-s,0,0,0,0},
				{s,c,0,0,0,0},
				{0,0,1,0,0,0},
				{0,0,0,c,-s,0},
				{0,0,0,s,c,0},
				{0,0,0,0,0,1}});
	}
	
	
	public static void main(String[] args){
		System.out.println(T.zx3(190));
		System.out.println(T.zx(190).sumDirect(T.zx(190)).sumDirect(T.zx(190)));
	}
}
