public void addAdjBone(BodyBone bone) { _adjBones.Add(bone); }
} // saveHumanPose public void loadPose(string filename) { if (!File.Exists(filename)) { return; } using (StreamReader sr = new StreamReader(filename)) { char[] separator = { ' ', '\t' }; string line = sr.ReadLine().Trim(); string[] strs = line.Split(separator); int nnodes = 0; try { nnodes = Int16.Parse(strs[0]); } catch (System.FormatException) { return; } _bodyNodes = new List <BodyNode>(); for (int i = 0; i < nnodes; ++i) { line = sr.ReadLine().Trim(); strs = line.Split(separator); string name = strs[0]; Vector3d pos = new Vector3d(double.Parse(strs[1]), double.Parse(strs[2]), double.Parse(strs[3])); BodyNode bn = new BodyNode(name, pos); _bodyNodes.Add(bn); if (bn._NAME == "body_hip") { bn.setAsRoot(); _root = bn; } } int nbones = 0; line = sr.ReadLine().Trim(); strs = line.Split(separator); try { nbones = Int16.Parse(strs[0]); } catch (System.FormatException) { return; } _bodyBones = new List <BodyBone>(); for (int i = 0; i < nbones; ++i) { line = sr.ReadLine().Trim(); strs = line.Split(separator); string name = strs[0]; int inode = Int16.Parse(strs[1]); int jnode = Int16.Parse(strs[2]); double wid = double.Parse(strs[3]); double thi = double.Parse(strs[4]); BodyBone bb = new BodyBone(_bodyNodes[inode], _bodyNodes[jnode], name, wid, thi, 20); _bodyBones.Add(bb); } BuildTree(); } // read } // loadHuamPose