Пример #1
0
    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);
        }
    }