private void saveTriangleIndexToFile(string fileName) { float[] shoulderL = planes.getControlPlane("shoulderLeft"); float[] shoulderR = planes.getControlPlane("shoulderRight"); //float[] back = planes.getControlPlane ("back"); int[] tri = clothMesh.triangles; //Vector3[] vertices = clothMesh.vertices; Vector3[] vertices = clothVertices; string data = ""; int index = 0; for (int i = 0; i < tri.Length; i += 3, index++) { for (int j = 0; j < 3; j++) { if (!AuxMath.isAbovePlane(vertices [tri [i + j]], shoulderL) && !AuxMath.isAbovePlane(vertices [tri [i + j]], shoulderR) ) { data += index.ToString() + " "; break; } } } FileOperator.SaveDataToFile(fileName, data); }
private void initGrith(string planeName, HumanSize grithKey, HumanBone planeInBone) { float[] plane = { 0.0f, 0.0f, 0.0f, 0.0f }; planes.getControlPlane(planeName, plane); ArrayList grithList = new ArrayList(); ArrayList edgeList = templateBody.edgeIndexsPerBone [planeInBone]; for (int i = 0; i < edgeList.Count; i++) { Edge e = edgeList [i] as Edge; if (AuxMath.isAbovePlane(templateMesh.vertices [e.e1], plane) != AuxMath.isAbovePlane(templateMesh.vertices [e.e2], plane)) { Vector3 intersectPoint = AuxMath.intersectPlane(templateMesh.vertices [e.e1], templateMesh.vertices [e.e2], plane); if (intersectPoint != AuxMath.nullVector) { if (HumanSize.Thigh_Grith == grithKey) { if (intersectPoint.x < 0.0f) { grithList.Add(intersectPoint); } } else { grithList.Add(intersectPoint); } } } } if (grithList.Count > 0) { ArrayList grithIndex = new ArrayList(); AuxMath.convexInPlane(new Vector3(plane [0], plane [1], plane [2]), grithList, grithIndex); initMeasurements [(int)grithKey - 1] = AuxMath.getLength(grithIndex, grithList); measurement [grithKey] = initMeasurements [(int)grithKey - 1] / (2.0f * Mathf.PI); } }