public void StoreMeshInfoInFile(MeshInfo meshInfo, string meshName) { StoredCurvature curvatures = new StoredCurvature(meshInfo); XmlSerializer xs = new XmlSerializer(typeof(StoredCurvature)); string path = Application.dataPath + "/Hatching/CurvatureData/" + meshName + ".xml"; TextWriter tw = new StreamWriter(path); xs.Serialize(tw, curvatures); Debug.Log(String.Format("Saved curvatures to {0}", path)); }
private MeshInfo rebuildMeshInfo(MeshInfo baseInfo, StoredCurvature newCurvatureInfo) { Debug.Log(CurvatureFilter.showArray(baseInfo.GetaDirection(0))); Debug.Log(CurvatureFilter.showArray(newCurvatureInfo.principalDirections0)); if (baseInfo.vertexCount == newCurvatureInfo.vertexPositions.Length) { Debug.Log(baseInfo.vertexCount.ToString() + ", " + newCurvatureInfo.principalDirections0.Length.ToString()); for (int i = 0; i < baseInfo.vertexCount; i++) { baseInfo.AllPrincipalDirections[i, 0] = newCurvatureInfo.principalDirections0[i]; baseInfo.AllPrincipalDirections[i, 1] = newCurvatureInfo.principalDirections1[i]; baseInfo.AllPrincipalDirections[i, 2] = newCurvatureInfo.principalDirections2[i]; baseInfo.AllPrincipalDirections[i, 3] = newCurvatureInfo.principalDirections3[i]; } } else { Debug.Log("Vertex count did not match, could not load data. " + baseInfo.vertexCount.ToString() + " x " + newCurvatureInfo.vertexPositions.Length.ToString()); } return(baseInfo); }