Пример #1
0
            public static void Align(IList <Vector> C1
                                     , ref List <Vector> C2
                                     , HPack <List <Vector> > optMoveC2 = null
                                     , HPack <Trans3> outTrans          = null
                                     , HPack <double> optRmsd           = null
                                     )
            {
                Trans3 trans = GetTrans(C1, C2);

                Vector[] nC2 = trans.GetTransformed(C2).ToArray();
                if (optMoveC2 != null)
                {
                    optMoveC2.value = new List <Vector>(nC2.Length);
                    for (int i = 0; i < nC2.Length; i++)
                    {
                        optMoveC2.value[i] = nC2[i] - C2[i];
                    }
                }
                if (optRmsd != null)
                {
                    optRmsd.value = 0;
                    for (int i = 0; i < nC2.Length; i++)
                    {
                        optRmsd.value += (nC2[i] - C1[i]).Dist2;
                    }
                    optRmsd.value /= nC2.Length;
                }
                C2 = new List <Vector>(nC2);
                if (outTrans != null)
                {
                    outTrans.value = trans.Clone();
                }
            }
Пример #2
0
            public static void Align(IList <Vector> C1
                                     , ref List <Vector> C2
                                     , IList <double> weight
                                     , HPack <Trans3> outTrans = null
                                     )
            {
                Trans3 trans = GetTrans(C1, C2, weight);

                Vector[] nC2 = trans.GetTransformed(C2).ToArray();
                C2 = new List <Vector>(nC2);
                if (outTrans != null)
                {
                    outTrans.value = trans.Clone();
                }
            }