Changeset 817 for cpp/frams/model/similarity/simil_model.cpp
- Timestamp:
- 10/07/18 13:23:11 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/similarity/simil_model.cpp
r782 r817 35 35 36 36 static ParamEntry MSparam_tab[] = { 37 { "Creature: Similarity", 1, 6, "ModelSimilarity", "Evaluates morphological dissimilarity. More information:\nhttp://www.framsticks.com/bib/Komosinski-et-al-2001\nhttp://www.framsticks.com/bib/Komosinski-and-Kubiak-2011\nhttp://www.framsticks.com/bib/Komosinski-2016", },37 { "Creature: Similarity", 1, 7, "ModelSimilarity", "Evaluates morphological dissimilarity. More information:\nhttp://www.framsticks.com/bib/Komosinski-et-al-2001\nhttp://www.framsticks.com/bib/Komosinski-and-Kubiak-2011\nhttp://www.framsticks.com/bib/Komosinski-2016", }, 38 38 { "simil_parts", 0, 0, "Weight of parts count", "f 0 100 0", FIELD(m_adFactors[0]), "Differing number of parts is also handled by the 'part degree' similarity component.", }, 39 39 { "simil_partdeg", 0, 0, "Weight of parts' degree", "f 0 100 1", FIELD(m_adFactors[1]), "", }, … … 41 41 { "simil_partgeom", 0, 0, "Weight of parts' geometric distances", "f 0 100 0", FIELD(m_adFactors[3]), "", }, 42 42 { "simil_fixedZaxis", 0, 0, "Fix 'z' (vertical) axis?", "d 0 1 0", FIELD(fixedZaxis), "", }, 43 { "simil_weightedMDS", 0, 0, "Should weighted MDS be used?", "d 0 1 0", FIELD(wMDS), "", }, 43 44 { "evaluateDistance", 0, PARAM_DONTSAVE | PARAM_USERHIDDEN, "evaluate model dissimilarity", "p f(oGeno,oGeno)", PROCEDURE(p_evaldistance), "Calculates dissimilarity between two models created from Geno objects.", }, 44 45 { 0, }, … … 75 76 isFuzzy = 0; 76 77 fuzzyDepth = 10; 78 79 //Determines whether weighted MDS should be used. 80 wMDS = 0; 77 81 } 78 82 … … 1981 1985 int nSize = m_Mod[iMod]->getPartCount(); 1982 1986 1983 double *pDistances = (double *)malloc(nSize * nSize * sizeof(double));1987 double *pDistances = new double[nSize * nSize]; 1984 1988 1985 1989 for (int i = 0; i < nSize; i++) … … 1993 1997 Pt3D P1Pos, P2Pos; // positions of parts 1994 1998 double dDistance; // the distance between Parts 1999 2000 double *weights = new double[nSize]; 2001 for (int i = 0; i < nSize; i++) 2002 { 2003 if (wMDS==1) 2004 weights[i] = 0; 2005 else 2006 weights[i] = 1; 2007 } 2008 2009 if (wMDS==1) 2010 for (int i = 0; i < pModel->getJointCount(); i++) 2011 { 2012 weights[pModel->getJoint(i)->p1_refno]++; 2013 weights[pModel->getJoint(i)->p2_refno]++; 2014 } 2015 1995 2016 for (iP1 = 0; iP1 < pModel->getPartCount(); iP1++) 1996 2017 { … … 2020 2041 } // for (iP1) 2021 2042 2022 MatrixTools:: SVD(vEigenvalues, nSize, pDistances, m_aPositions[iMod]);2043 MatrixTools::weightedMDS(vEigenvalues, nSize, pDistances, m_aPositions[iMod], weights); 2023 2044 if (fixedZaxis == 1) //restore the original vertical coordinate of each Part 2024 2045 { … … 2029 2050 } 2030 2051 2031 free(pDistances); 2052 delete[] pDistances; 2053 delete[] weights; 2032 2054 } 2033 2055
Note: See TracChangeset
for help on using the changeset viewer.