public static DPMeshGeometry3D GetSimplifiedMeshGeometry3D(DPMeshGeometry3D dPMeshGeometry3D, double unitSize) { var meshRefactor = new MeshRefactor(dPMeshGeometry3D.TriangleIndices, dPMeshGeometry3D.Positions, dPMeshGeometry3D.Normals, unitSize); return(meshRefactor.CreateGeometry3D()); }
public MeshRefactor(List <Int32> triangleIndices, List <Point3D> positions, List <Vector3D> normals, double unitSize) { MeshGeometry = new DPMeshGeometry3D() { TriangleIndices = triangleIndices, Positions = positions, Normals = normals }; UnitSize = unitSize; }
public MeshRefactor(List <Int32> triangleIndices, List <Point3D> positions, List <Vector3D> normals, UInt32 resolution) { MeshGeometry = new DPMeshGeometry3D() { TriangleIndices = triangleIndices, Positions = positions, Normals = normals }; var bounds = MeshGeometry.GetBounds(); var max = Math.Max(bounds.SizeX, bounds.SizeY); UnitSize = Math.Max(max, bounds.SizeZ) / resolution; }
private DPMeshGeometry3D LoadMeshGeometry3D(XmlTextReader reader) { try { if (!MoveToNextNode(reader, XmlNodeType.Element, "MeshGeometry3D")) { return(null); } List <Int32> triangleIndices = null; List <Point3D> positions = null; List <Vector3D> normals = null; if (reader.MoveToAttribute("TriangleIndices")) { triangleIndices = LoadInt32Collection(reader.Value); } if (reader.MoveToAttribute("Positions")) { positions = LoadPoint3DCollection(reader.Value); } if (reader.MoveToAttribute("Normals")) { normals = LoadVector3DCollection(reader.Value); } reader.MoveToElement(); if (!reader.IsEmptyElement) { reader.Read(); } var ret = new DPMeshGeometry3D(); ret.Positions = positions; ret.Normals = normals; ret.TriangleIndices = triangleIndices; return(ret); } catch (Exception ex) { return(null); } }