|
|
|
@ -17,9 +17,13 @@ public class ObjExporter |
|
|
|
|
.GroupBy(entity => entity.PlaneCode) |
|
|
|
|
.ToDictionary(group => group.Key, group => group.ToList()); |
|
|
|
|
//腰 单组 |
|
|
|
|
List<Viewport3DTriangleEntity> waistList = entities |
|
|
|
|
// List<Viewport3DTriangleEntity> waistList = entities |
|
|
|
|
// .Where(entity => entity.PlaneType == PlaneType.Girdle) |
|
|
|
|
// .ToList(); |
|
|
|
|
Dictionary<string, List<Viewport3DTriangleEntity>> gridleList = entities |
|
|
|
|
.Where(entity => entity.PlaneType == PlaneType.Girdle) |
|
|
|
|
.ToList(); |
|
|
|
|
.GroupBy(entity => entity.PlaneCode) |
|
|
|
|
.ToDictionary(group => group.Key, group => group.ToList()); |
|
|
|
|
|
|
|
|
|
//同一个面只保留外边框(除了腰) |
|
|
|
|
Dictionary<string, List<Vector3>> resultPoints = new Dictionary<string, List<Vector3>>(); |
|
|
|
@ -35,17 +39,29 @@ public class ObjExporter |
|
|
|
|
} |
|
|
|
|
resultPoints.Add(dic.Key, ViewportHelperPro.VectorClockwiseSort(new HashSet<Vector3>(tempPoints).ToList())); |
|
|
|
|
} |
|
|
|
|
List<Vector3> selFaceVector = new List<Vector3>(); |
|
|
|
|
if (waistList.Count > 0) |
|
|
|
|
|
|
|
|
|
foreach (var dic in gridleList) |
|
|
|
|
{ |
|
|
|
|
foreach (var entity in waistList) |
|
|
|
|
List<Vector3> tempPoints = new List<Vector3>(); |
|
|
|
|
foreach (var entity in dic.Value) |
|
|
|
|
{ |
|
|
|
|
selFaceVector.Add(entity.Point1); |
|
|
|
|
selFaceVector.Add(entity.Point2); |
|
|
|
|
selFaceVector.Add(entity.Point3); |
|
|
|
|
tempPoints.Add(entity.Point1); |
|
|
|
|
tempPoints.Add(entity.Point2); |
|
|
|
|
tempPoints.Add(entity.Point3); |
|
|
|
|
} |
|
|
|
|
resultPoints.Add(dic.Key, ViewportHelperPro.VectorClockwiseSort(new HashSet<Vector3>(tempPoints).ToList())); |
|
|
|
|
} |
|
|
|
|
resultPoints.Add("yao", selFaceVector); |
|
|
|
|
// List<Vector3> selFaceVector = new List<Vector3>(); |
|
|
|
|
// if (waistList.Count > 0) |
|
|
|
|
// { |
|
|
|
|
// foreach (var entity in waistList) |
|
|
|
|
// { |
|
|
|
|
// selFaceVector.Add(entity.Point1); |
|
|
|
|
// selFaceVector.Add(entity.Point2); |
|
|
|
|
// selFaceVector.Add(entity.Point3); |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// resultPoints.Add("yao", selFaceVector); |
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
|
@ -83,8 +99,13 @@ public class ObjExporter |
|
|
|
|
|
|
|
|
|
// 获取面上的所有顶点并排序 |
|
|
|
|
List<Vector3> faceVertices = face.Value; |
|
|
|
|
// Vector3 center = GetCenterOfVertices(faceVertices); |
|
|
|
|
// faceVertices.Sort((v1, v2) => GetAngle(v1, center).CompareTo(GetAngle(v2, center))); |
|
|
|
|
if (!face.Key.StartsWith("11_")) |
|
|
|
|
{ |
|
|
|
|
Vector3 center = GetCenterOfVertices(faceVertices); |
|
|
|
|
faceVertices.Sort((v1, v2) => GetAngle(v1, center).CompareTo(GetAngle(v2, center))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 正面:按顺时针顺序输出 |
|
|
|
|
sb.Append("f"); |
|
|
|
|