private static void translation() { Const.listdata_translation.Clear(); PointXYZ point = null; double dx = Const.FK_LINE.getTranslationVector().getX(); double dy = Const.FK_LINE.getTranslationVector().getY(); // AM20191025 - 注意: 这里的dx和dy可能存在取反的情况 if (isReverse()) { dx = -dx; dy = -dy; } Const.distance_recovery = Math.Sqrt(dx * dx + dy * dy); double k = Const.FK_LINE.getFLine().getK(); double b = Const.FK_LINE.getFLine().getB(); double tx = 0; double ty = 0; double tz = 0; double nx = 0; double ny = 0; for (int i = 0; i < Const.listdata.Count; i++) { tx = Const.listdata[i].getX(); ty = Const.listdata[i].getY(); tz = Const.listdata[i].getZ(); //沿着断层进行区域分割,断层下盘不变,上盘移动 if (k * tx + b - ty > 0) { //断层上盘 point = new PointXYZ(); //按照平移向量进行水平移动 nx = tx + dx; ny = ty + dy; point.setX(nx); point.setY(ny); point.setZ(tz); Const.listdata_translation.Add(point); } else { //断层下盘不进行变换 Const.listdata_translation.Add(Const.listdata[i]); } } }
private static void translation2() { Const.listdata_translation.Clear(); PointXYZ point = null; // double dx = Const.FK_LINE.getTranslationVector().getX(); // double dy = Const.FK_LINE.getTranslationVector().getY(); double k = Const.fline.getK(); double b = Const.fline.getB(); // 这里需要求dx和dy double ds = Const.distance_recovery; double dx = ds * 1 / Math.Sqrt(1 + k * k); double dy = ds * k / Math.Sqrt(1 + k * k); double tx = 0; double ty = 0; double tz = 0; double nx = 0; double ny = 0; for (int i = 0; i < Const.listdata.Count; i++) { tx = Const.listdata[i].getX(); ty = Const.listdata[i].getY(); tz = Const.listdata[i].getZ(); //沿着断层进行区域分割,断层下部分不变,上部分移动 if (k * tx + b - ty < 0) // 这里修改了符号 { //断层上部分 point = new PointXYZ(); //按照平移向量进行水平移动 nx = tx - dx; // 这里修改了符号: [+]变[-] ny = ty - dy; // 这里修改了符号: [+]变[-] point.setX(nx); point.setY(ny); point.setZ(tz); Const.listdata_translation.Add(point); } else { //断层下盘不进行变换 Const.listdata_translation.Add(Const.listdata[i]); } } }
public static PointXYZ getPoint(String line) { string str = System.Text.RegularExpressions.Regex.Replace(line, @"\s+", ","); string[] sd = str.Split(','); PointXYZ point = new PointXYZ(); point.setX(Convert.ToDouble(sd[0])); point.setY(Convert.ToDouble(sd[1])); point.setZ(Convert.ToDouble(sd[2])); return(point); }
public static void transformLine(List <PointXYZ> listdata, double k, double b) { Const.listdata_h_kxb.Clear(); PointXYZ point = null; for (int i = 0; i < listdata.Count; i++) { point = new PointXYZ(); point.setX(listdata[i].getX()); point.setY(listdata[i].getY()); double z = Const.ALTITUDE_MIN + k * (listdata[i].getZ() - Const.ALTITUDE_MIN) + b; point.setZ(z); Const.listdata_h_kxb.Add(point); } }