package jp.mydns.masahase.abaqus.weldline;

import jp.mydns.masahase.InherentStrain.InherentStrainType;
/**
 * 曲線の溶接線(ミラーリングあり).
 * 板幅方向に対して絶対値で判断する。
 * @author MASA.H
 */
public class CurveLineMirror extends CurveLine {

	public CurveLineMirror(InherentStrainType pedata, double[] StartPos,
			double[] EndPos, double[] CenterPos, double angle) {
		super(pedata, StartPos, EndPos, CenterPos, angle);
		// TODO Auto-generated constructor stub
	}

	@Override
	public double[] getPE(double x, double y, double z) {
		double[] ret = new double[6];
		double[] tmp = { x, y, z };
		double[] coord = changeCoordinate(tmp);
		double theta = Math.atan2(coord[1], coord[0]);
		for (int i = 0; i < ret.length; i++) {
			ret[i] = 0.0;
		}
		if (-theta <= EndAngle && -theta >= 0) {
			double[] coord0 = new double[2];
			double tmp_x, tmp_y;
			tmp_x = Math.sqrt(coord[0] * coord[0] + coord[1] * coord[1]) - R;
			tmp_y = coord[2];
			coord0[0] = Math.abs(tmp_x * Math.cos(angle) + tmp_y
					* Math.sin(angle));
			coord0[1] = -tmp_x * Math.sin(angle) + tmp_y * Math.cos(angle);
			getPE_(ret, coord0);
			ret = changeECoordinate(ret, coord);
		}
		return ret;
	}
}
