Loxy getLoxy(double UpDown, ref Base Base) { Loxy Result = new Loxy(); if ((Curvextruders != null) && (Curvextruders.Count > 0) && (Curvextruders[0].Count > 3)) { xyzArray A = new xyzArray(); for (int j = 0; j < Curvextruders[0].Count; j++) { A.Add(Curvextruders[0][j].Value(0, UpDown)); } xyz N = A.normal(); Base = Base.DoComplete(Curvextruders[0][0].Value(0, UpDown), N); for (int i = 0; i < Curvextruders.Count; i++) { xyArray _A = new xyArray(); Result.Add(_A); for (int j = 0; j < Curvextruders[i].Count; j++) { xy P = Base.Relativ(Curvextruders[i][j].Value(0, UpDown)).toXY(); _A.Add(P); } if (_A.Count > 0) { _A.Add(_A[0]); } } } return(Result); }
{/// <summary> /// returns the contur of a list of triangles /// </summary> /// <param name="L">List of triangles</param> /// <returns></returns> public static Loxyz GetContour(List <Triangle> L) { Dictionary <xyz, xyz> D = new Dictionary <xyz, xyz>(); for (int i = 0; i < L.Count; i++) { INeighbors N = L[i] as INeighbors; ITriangle T = L[i]; if ((T.GetB() - T.GetA() & T.GetC() - T.GetA()).length() < 0.0000001) { continue; } if (N.GetNeighbor(0) == -1) { D.Add(T.GetA().Toxyz(), T.GetB().Toxyz()); } if (N.GetNeighbor(1) == -1) { D.Add(T.GetB().Toxyz(), T.GetC().Toxyz()); } if (N.GetNeighbor(2) == -1) { D.Add(T.GetC().Toxyz(), T.GetA().Toxyz()); } } Loxyz Result = new Loxyz(); while (true) { if (D.Count == 0) { break; } xyz First = new xyz(0, 0, 0); foreach (KeyValuePair <xyz, xyz> Pt in D) { First = Pt.Key; break; } xyz Current = First; xyzArray A = new xyzArray(); Result.Add(A); while (true) { if (D.ContainsKey(Current)) { xyz C = D[Current]; A.Add(C); D.Remove(Current); Current = C; } else { break; } } } return(Result); }
void SetCurveArray() { Matrix M = StandardBase.ToMatrix();// xyz K = B.BaseO + B.BaseX * P.x + B.BaseY * P.y; _CurveArray = new xyzArray(); if ((Direction.length() == 0) || (Curve == null)) { return; } xyArray xyA = Curve.ToXYArray(); for (int i = 0; i < xyA.Count; i++) { _CurveArray.Add(xyA[i].toXYZ()); } CurveArray = M * _CurveArray; }