public ASTRAMemberLoad() { mArrowPoints.Add(new gPoint(0.0d, 0.0d, 0.0d)); mArrowPoints.Add(new gPoint(-1.0d, -0.1665d, 0.0d)); mArrowPoints.Add(new gPoint(-1.0d, 0.1665d, 0.0d)); mArrowPoints.Add(new gPoint(0.0d, 0.0d, 0.0d)); }
public ASTRAArrowLine() { mArrowPoints.Add(new gPoint(0.0d, 0.0d, 0.0d)); mArrowPoints.Add(new gPoint(-1.0d, -0.1665d, 0.0d)); mArrowPoints.Add(new gPoint(-1.0d, 0.1665d, 0.0d)); mArrowPoints.Add(new gPoint(0.0d, 0.0d, 0.0d)); }
public override gPoints GetGripPoints() { gPoints ret = new gPoints(); ret.Add(StartPoint); ret.Add(EndPoint); return(ret); }
double GetArea3D(gPoint gp1, gPoint gp2, gPoint gp3) { try { gPoints gps = new gPoints(); gps.Add(gp1); gps.Add(gp2); gps.Add(gp3); return(Math.Abs(gps.Area3D(gps.GetNormal()))); } catch { } return(0.0); }
public gPoints GetDisNetPipePoints() { string fName = "C:\\DisNetPoints.txt"; StreamReader sr = new StreamReader(new FileStream(fName, FileMode.Open, FileAccess.Read)); gPoints pts = new gPoints(); string[] values; string kStr = ""; double dx = 0.0, dy, dz; dx = dy = dz = 0.0; while (!sr.EndOfStream) { try { kStr = sr.ReadLine(); values = kStr.Split(new char[] { ',' }); dx = double.Parse(values[0]); dy = double.Parse(values[1]); dz = double.Parse(values[2]); pts.Add(dx, dy, dz); } catch (Exception exx) { } } sr.Close(); return(pts); }
public gPoints GetPoints(int div, double unitFactor) { gPoints gps = new gPoints(); div = 10; double x, y, xIncr; x = y = xIncr = 0.0d; xIncr = Length / div; UdlLoad = UdlLoad / unitFactor; for (int i = 0; i <= div; i++) { y = CalculateMomentWithConsLoad(x); if (i == 0) { y = -(Math.Abs(StartMoment)); } else if (i == div) { y = -(Math.Abs(EndMoment)); } gPoint gp = new gPoint(x, y); gps.Add(gp); x += xIncr; } return(gps); }
public override gPoints GetGripPoints() { gPoints ret = new gPoints(); gPoint cen = new gPoint(); ret.Add(cen); double stepangle = Globals.VD_TWOPI / this.NumSides; double sang = 0.0d; for (int i = 0; i < NumSides; i++) { ret.Add(gPoint.Polar(cen, sang, Radius)); sang += stepangle; } ECSMatrix.Transform(ret); return(ret); }
public override gPoints GetGripPoints() { gPoints ret = new gPoints(); gPoint cen = new gPoint(); ret.Add(cen); ECSMatrix.Transform(ret); return(ret); }
public static Vertexes GetVertexesFromPoints(List<PointData> points) { Vertexes vtxs = new Vertexes(); gPoints gps = new gPoints(); points.ForEach(pt => gps.Add(new gPoint(pt.X, pt.Y, pt.Z))); gps.RemoveEqualPoints(0.01); vtxs.AddRange(gps); return vtxs; }
bool Merge3DFace(vdPolyface vdp) { int II = int.MaxValue; Int32Array i32 = vdp.FaceList; Dictionary <int, int> deleteID = new Dictionary <int, int>(); Dictionary <int, int> kk1 = new Dictionary <int, int>(); Dictionary <int, int> kk2 = new Dictionary <int, int>(); //合并三角形 #region 合并三角形 for (int i = 0; i < i32.Count; i = i + 5) { if (i32[i + 4] != II && i32[i] == i32[i + 3]) //一定是没有被合并过的,说明是三角形 { int i1 = i32[i]; int i2 = i32[i + 1]; int i3 = i32[i + 2]; kk1.Clear(); kk1.Add(i1, i1); kk1.Add(i2, i2); kk1.Add(i3, i3); for (int j = i + 5; j < i32.Count; j = j + 5) { if (i32[j + 4] != II && i32[j] == i32[j + 3]) //剔除已经处理过的 { int j1 = i32[j]; int j2 = i32[j + 1]; int j3 = i32[j + 2]; //kk2.Clear(); //kk2.Add(j1, j1); //kk2.Add(j2, j2); //kk2.Add(j3, j3); int k1 = 0; int k2 = 0; int k3 = 0; int k4 = 0; //找到公共边 if ((i1 == j1 || i1 == j2 || i1 == j3) && (i2 == j1 || i2 == j2 || i2 == j3)) { k1 = i3; k2 = i1; k4 = i2; } else if ((i2 == j1 || i2 == j2 || i2 == j3) && (i3 == j1 || i3 == j2 || i3 == j3)) { k1 = i1; k2 = i2; k4 = i3; } else if ((i1 == j1 || i1 == j2 || i1 == j3) && (i3 == j1 || i3 == j2 || i3 == j3)) { k1 = i2; k2 = i3; k4 = i1; } else { continue; } if (!kk1.ContainsKey(j1)) { k3 = j1; } if (!kk1.ContainsKey(j2)) { k3 = j2; } if (!kk1.ContainsKey(j3)) { k3 = j3; } //检查是否共面 gPoints gps3 = new gPoints(); //gps3.Add(vdp.VertexList[i1 - 1]); //gps3.Add(vdp.VertexList[i2 - 1]); //gps3.Add(vdp.VertexList[i3 - 1]); gps3.Add(vdp.VertexList[k1 - 1]); gps3.Add(vdp.VertexList[k2 - 1]); gps3.Add(vdp.VertexList[k4 - 1]); Vector vec = gps3.GetNormal(); // 导出时,下面计算dist的方法有异常OutOfRange异常抛出,特加以下判断 if (k3 > vdp.VertexList.Count || k1 > vdp.VertexList.Count || k3 <= 0 || k1 <= 0) { continue; } double dist = Globals.DistancePointToPlane(vdp.VertexList[k3 - 1], vec, vdp.VertexList[k1 - 1]); if (Math.Abs(dist) > Globals.VD_ZERO6) { continue; } //判断是否是凹多边形 凹多边形有显示问题 ////判断是否构成了三角形 gps3.InsertAt(3, vdp.VertexList[k3 - 1]); //gPoints gps4=gps3.Clone() as gPoints; //gps3.makeClosed(); //gps4.makeClosed(); //gps4.RemoveInLinePoints(); //if (gps3.Count != gps4.Count) continue; double area1 = GetArea3D(gps3[0], gps3[1], gps3[2]); double area2 = GetArea3D(gps3[3], gps3[1], gps3[2]); double area3 = GetArea3D(gps3[0], gps3[1], gps3[3]); double area4 = GetArea3D(gps3[0], gps3[2], gps3[3]); double area = Math.Max(area3, area4); if (area1 + area2 <= area) //凹多边形 { continue; } i32[i] = k4; i32[i + 1] = k1; i32[i + 2] = k2; i32[i + 3] = k3;//这里放到第3个点经常出现问题 i32[j + 4] = II; break; } } } } #endregion #region 生成新的polyface Int32Array iii32 = new Int32Array(); for (int i = 0; i < vdp.FaceList.Count; i = i + 5) { if (vdp.FaceList[i + 4] != II) { iii32.Add(i32[i]); iii32.Add(i32[i + 1]); iii32.Add(i32[i + 2]); iii32.Add(i32[i + 3]); iii32.Add(i32[i + 4]); } } vdp.FaceList = iii32; vdp.Invalidate(); #endregion return(true); }
/// <summary> /// /处理polyface /// </summary> //bool <param name="vdp"></param> bool GetVDPBorderLine(vdPolyface vdp, vdFigure vdPf) { vdPolyface vdpOut = new vdPolyface(); Dictionary <string, bool> kvs = new Dictionary <string, bool>(); Int32Array iii32 = vdp.FaceList; for (int i = 0; i < iii32.Count; i++) { if (vdp.FaceList[i] < 0) { if (i % 5 != 4) { vdp.FaceList[i] = -vdp.FaceList[i]; } } } iii32 = vdp.FaceList; for (int i = 0; i < iii32.Count; i = i + 5) { AddSide(kvs, iii32[i], iii32[i + 1]); AddSide(kvs, iii32[i + 1], iii32[i + 2]); AddSide(kvs, iii32[i + 2], iii32[i]); } //找到外边界 Int32Array i32 = ParaseSide2List(kvs, vdp.VertexList.Count + 1); if (i32.Count < 5) { return(false); } //找到向量 ///int iii = 1; gPoints Points = vdp.VertexList; Points.makeClosed(); gPoints gps = new gPoints();// Points.Clone() as gPoints; foreach (int ii in i32) { gps.Add(Points[ii - 1]); } gps.RemoveEqualPoints(Globals.VD_ZERO5); //gps.RemoveInLinePoints(); Int32Array ii32 = new Int32Array(); gPoints gpss = new gPoints(); #region 延长线段到最长 gpss.Add(gps[0]); for (int i = 0; i < gps.Count - 1; i++) { //if (i == 5) //{ // int j = 0; //} if (i != gps.Count - 2) { double dd = Globals.distPointFromLine(gps[i + 2], gps[i], gps[i + 1]); if (Globals.distPointFromLine(gps[i + 2], gps[i], gps[i + 1]) < 0.2) { continue; } else { gpss.Add(gps[i + 1]); } } if (i == gps.Count - 2) { if (Globals.distPointFromLine(gps[1], gps[i], gps[i + 1]) < 0.2) { gpss.RemoveAt(0); } else { gpss.Add(gps[i + 1]); } } } #endregion gpss.makeClosed(); gpss.RemoveLast(); //找到四条边中符合圆柱体标准的。 if (gpss.Count % 2 != 0 || gpss.Count < 10) { return(false); } int half = gpss.Count / 2; gPoints gEndSide1 = new gPoints(); gPoints gEndSide2 = new gPoints(); gPoints gParaSide1 = new gPoints(); gPoints gParaSide2 = new gPoints(); for (int i = 0; i < gpss.Count / 2; i++) { Vector v1 = new Vector(gpss[i], gpss[i + 1]); Vector v2 = new Vector(gpss[i + half], gpss[(half + i + 1) % gpss.Count]); v1.Cross(v2); if (v1.Length < Globals.VD_ZERO6) //说明平行 { gEndSide1.RemoveAll(); gEndSide2.RemoveAll(); gParaSide1.RemoveAll(); gParaSide2.RemoveAll(); gParaSide1.Add(gpss[i]); gParaSide1.Add(gpss[i + 1]); gParaSide2.Add(gpss[i + half]); gParaSide2.Add(gpss[(half + i + 1) % gpss.Count]); for (int j = i + 1; j < i + half; j++) { gEndSide1.Add(gpss[j]); } for (int j = i + half + 1; j < i + 2 * half; j++) { gEndSide2.Add(gpss[j % gpss.Count]); } gPoint sp1 = new gPoint(); gPoint sp2 = new gPoint(); double radius = 0.0; //判断是个边是否符合圆柱体标准 if (!IS4SideCyln(gEndSide1, gEndSide2, gParaSide1, gParaSide2, ref sp1, ref sp2, out radius)) //不符合圆柱体标准 ,直接返回错误 { continue; } gpss.RemoveAll(); //这里可以进行圆柱简化 gpss.AddRange(gEndSide1); gpss.AddRange(gParaSide2); gpss.AddRange(gEndSide2); gpss.AddRange(gParaSide1); //是否齐头圆柱,即没有切过的圆柱,如果齐圆柱头,特殊处理,此处暂时不变, // half = gpss.Count / 2; vdpOut.VertexList = gpss; vdpOut.FaceList = new Int32Array(); for (int ii = 1; ii < half; ii++) { vdpOut.FaceList.Add(ii); vdpOut.FaceList.Add(ii + 1); vdpOut.FaceList.Add(gpss.Count - (ii + 1) + 1); vdpOut.FaceList.Add(gpss.Count - ii + 1); vdpOut.FaceList.Add(-1); } vdp.FaceList = vdpOut.FaceList; vdp.VertexList = vdpOut.VertexList; //vdp.Invalidate(); //vdp.Update(); break; } } //找到两个顶边,如果多个就扔掉了。 //GetNonParaSide(vdp.VertexList, i32, orign, vector); return(true); //Int32Array side1= }