Пример #1
0
        internal void FreezeMesh(bool recreateARAP)
        {
            for (int i = 0; i < vertices.Count; i++)
            {
                vertices[i].orgPosition = vertices[i].position;
            }
            if (recreateARAP)
            {
                // 制御点もフリーズして
                for (int i = 0; i < controlPoints.Count; i++)
                {
                    controlPoints[i].orgPosition = controlPoints[i].position;
                }

                // ARAPをつくりなおす
                arap = new ARAPDeform(vertices.Select(v => v.orgPosition).ToList(), vertices.Select(v => v.part).ToList());
                foreach (var c in controlPoints)
                {
                    arap.AddControlPoint(c.position, c.orgPosition, c.part);
                }

                BalancePartCount();
                arap.BeginDeformation();
            }
        }
Пример #2
0
        public void BeginDeformation()
        {
            // 制御点をPatchMesh, ARAPで同期させる
            arap.ClearControlPoints();
            foreach (var c in controlPoints)
            {
                arap.AddControlPoint(c.position, c.orgPosition, c.part);
            }

            BalancePartCount();

            arap.BeginDeformation();
        }
Пример #3
0
        internal void ScaleByRatio(float rx, float ry)
        {
            for (int i = 0; i < vertices.Count; i++)
            {
                vertices[i].ScaleByRatio(rx, ry);
            }

            for (int i = 0; i < controlPoints.Count; i++)
            {
                controlPoints[i].ScaleByRatio(rx, ry);
            }

            arap = new ARAPDeform(vertices.Select(v => v.orgPosition).ToList(), vertices.Select(v => v.part).ToList());
            foreach (var c in controlPoints)
            {
                arap.AddControlPoint(c.position, c.orgPosition, c.part);
            }

            BalancePartCount();
            arap.BeginDeformation();
        }