/// <summary> /// creates a <see cref="Face"/> for a <see cref="Solid"/> with <see cref="Model.Solid"/>. /// <b>Curves</b> /// /// /// /// /// Erstell ein massives <see cref="Face"/>. Wenn <b>Solid</b> nicht null ist, wird dieses Face eingebaut in /// <b>Solid</b>. <b>Curves</b> spezifizieren einee Liste von Curve3d-Lists. Sie werden als <see cref="Edge.EdgeCurve"/> /// in jede <see cref="Edge"/> gesetzt. <b>Curves</b> müssen von der Struktur identisch sein wie Bounds, /// d.h. die selbe Länge und jeder Eintrag in Bounds ( Bounds[i] ) muss die selbe Länge haben wie /// der entsprechende Eintrag in <b>Curves</b> (Curves[i]). /// gesetzt /// </summary> /// <param name="Solid"><see cref="Solid"/> in which the result<see cref="Face"/> will be integrated.</param> /// <param name="Surface"><see cref="Surface"/> belonging to the new <see cref="Face"/>.</param> /// <param name="Bounds">list of <see cref="Vertex3dArray"/>, who contains the start and end points of the <see cref="Edge"/>s.</param> /// <param name="Curves"><see cref="Curve3D"/>, which are the new <see cref="Edge.EdgeCurve"/>s. Their start points and their end point must correspond to /// the parameter Bounds start and end points.</param> /// <returns>a <see cref="Face"/>, which will be added to the <b>Solid</b>.</returns> public static Face SolidFace(Solid Solid, Surface Surface, Vertex3dArray_2 Bounds, Loca3D Curves) { if (Bounds.Count == 0) { return(null); } Face Result = new Face(); Result.Surface = Surface; for (int i = 0; i < Bounds.Count; i++) { EdgeLoop Edgeloop = new EdgeLoop(); Result.Bounds.Add(Edgeloop); for (int j = 0; j < Bounds[i].Count; j++) { Vertex3d A = Bounds[i][j]; Vertex3d B = null; if (j == Bounds[i].Count - 1) { B = Bounds[i][0]; } else { B = Bounds[i][j + 1]; } Edge E = Edge.SolidEdge(Solid, Result, A, B, Curves[j][i]); Edgeloop.Add(E); } } return(Result); }
/// <summary> /// creates a <see cref="Face"/> for a <see cref="Solid"/> in the <see cref="Model.Solid"/>. /// The Curves are all <see cref="Line3D"/>. The <see cref="Face"/> is plane and has as <see cref="Face.Surface"/> a <see cref="PlaneSurface"/>. /// </summary> /// <param name="Solid">is the target in which the <see cref="Face"/> will be posed.</param> /// <param name="Bounds">contains the <see cref="Vertex3d"/> for the <see cref="Line3D"/>.</param> /// <returns>a <see cref="Face"/></returns> public static Face SolidPlane(Solid Solid, Vertex3dArray_2 Bounds) { if (Bounds.Count == 0) { return(null); } xyz N = new xyz(0, 0, 0); xyz P = Bounds[0][0].Value; for (int i = 1; i < Bounds[0].Count - 1; i++) { xyz A = Bounds[0][i].Value; xyz B = Bounds[0][i + 1].Value; xyz M = N; N = N + ((A - P) & (B - P)); } N = N.normalized() * (-1); Base Base = Base.UnitBase; Base.BaseO = P; Base.BaseZ = N; if ((Base.BaseZ & new xyz(1, 0, 0)).dist(xyz.Null) > 0.01) { Base.BaseY = (Base.BaseZ & (new xyz(1, 0, 0))).normalized(); Base.BaseX = Base.BaseY & Base.BaseZ; } else { Base.BaseY = (Base.BaseZ & (new xyz(0, 1, 0))).normalized(); Base.BaseX = Base.BaseY & Base.BaseZ; } PlaneSurface Surface = new PlaneSurface(); Surface.Base = Base; //------------------------------------- //-------- Create the Face Face Result = new Face(); // ---- With Plane Surface Result.Surface = Surface; if (Solid != null) { Solid.FaceList.Add(Result); } //----- Set the Edges for (int i = 0; i < Bounds.Count; i++) { EdgeLoop Edgeloop = new EdgeLoop(); Result.Bounds.Add(Edgeloop); for (int j = 0; j < Bounds[i].Count; j++) { Vertex3d A = Bounds[i][j]; Vertex3d B = null; if (j == Bounds[i].Count - 1) { B = Bounds[i][0]; } else { B = Bounds[i][j + 1]; } Edge E = Edge.SolidEdge(Solid, Result, A, B, new Line3D(A.Value, B.Value)); Edgeloop.Add(E); } } Result.RefreshParamCurves(); return(Result); }