public EditRecordedForm(Principal pM) : base(pM) { mySkeleton = new HumanSkeleton(); path = Environment.CurrentDirectory + "\\Data\\Animation\\default.ani"; //Para simular el inicio del dispositivo desde un archivo. myMiddle = new SkeletonReaderMiddle(); myMiddle.addUser(mySkeleton, path); ready = false; //--Render myAvatar = new Avatar(mySkeleton); camara = new Camera(pM.graphics); //--Estados myStates = DB4ObjectState.loadStates(Environment.CurrentDirectory + "\\Data\\States\\default.sta"); //--Gestos myGestures = DB4ObjectGesture.loadGestures(Environment.CurrentDirectory + "\\Data\\Gestures\\default.ges"); myPartialGestures = new List <Pair>(); //Crear formulario de edición de gestos formEditor = new WFEditGestures(this); formEditor.Show(); this.LoadContent(); }
virtual protected void Awake() { _humanScale = new HumanScale(animator); _humanScale.GenerateScaleBone(); _humanSlide = new HumanSlide(_humanScale); _humanSlide.GenerateCache(); _humanSlide.GenerateAvatar(humanSlideModel); //humanAvatar.GenerateCache(animator); _skeletonInfos = SkeletonCacheUtil.GenerateFromRootBone(animator.transform).ToArray(); _humanSkeleton = new HumanSkeleton(animator, _skeletonInfos); _humanSkeletonInfos = _humanSkeleton.GenerateCache().ToArray(); _humanScale.GenerateAvatar(_humanSkeletonInfos); // これはUpdateAnimatorAvatarをする前に必ず必要? // ここがHumanSkeletonのGenerateAvatarに該当 HumanAvatarUtil.UpdateAnimatorAvatar(animator, humanAvatar.GetHumanDescription(), _humanSkeletonInfos); // ここまでがHumanArmature.AwakeのGenerateScaleBoneコール // 昔のソースコードだとここに記述してあったが、正しくは上のほうだと思う。 //_humanSlide.GenerateAvatar(humanSlideModel); }
public override void update() { if ((DateTime.Now - timeLastFrame) < this.interval) { for (int i = 0; i < skeletons.Count; i++) { if (this.getState(i).Equals(this.DETECTADO)) { SkeletonData data = skeletonFrame.Skeletons[skeletonsPosition[i]]; if (SkeletonTrackingState.Tracked == data.TrackingState) { HumanSkeleton skeleton = skeletons.ElementAt(i); foreach (DictionaryEntry dE in skeleton.getBodyParts()) { Joint j = data.Joints[getSkeletonJoint((String)dE.Key)]; ((HumanBodyPart)dE.Value).setPosition(j.Position.X, j.Position.Y, j.Position.Z); } } else { skeletonsPosition[i] = -1; this.setState(i, this.BUSCANDO); } } } } else { loseUsers(); } }
// TRUE: Si parte 1 esta a la izquierda de parte 2 // Presicion, refiere a datos reales enviados por el dispositivo public override bool cumple(HumanSkeleton hS) { HumanBodyPart p1 = hS.getBodyPart(part1); HumanBodyPart p2 = hS.getBodyPart(part2); return((p2.X - p1.X) > presicion); }
//Se calcula la posición relativa al torso. public override bool cumple(HumanSkeleton hS) { HumanBodyPart p1 = hS.getBodyPart(part1); HumanBodyPart torso = hS.getBodyPart("Torso"); return(true); }
public override bool cumple(HumanSkeleton hS1, HumanSkeleton hS2) { HumanBodyPart p1 = hS1.getBodyPart(part1); HumanBodyPart p2 = hS2.getBodyPart(part2); return((p2.Y - p1.Y) > presicion); }
// TRUE: Si parte 1 esta en el mismo valor de x que la parte 2 // Presicion, refiere a datos reales enviados por el dispositivo y aca a valores chicos de presicion mayor es la precision. public override bool cumple(HumanSkeleton hS) { HumanBodyPart p1 = hS.getBodyPart(part1); HumanBodyPart p2 = hS.getBodyPart(part2); return(Math.Abs(p1.X - p2.X) < precision); }
public override bool cumple(HumanSkeleton hS1, HumanSkeleton hS2) { HumanBodyPart p1 = hS1.getBodyPart(part1); HumanBodyPart p2 = hS2.getBodyPart(part2); return(Math.Abs(p1.Z - p2.Z) < presicion); }
public FreeDetectionForm(Principal pM, AbstractMiddle am) : base(pM) { mySkeletonUser1 = new HumanSkeleton(); mySkeletonUser2 = new HumanSkeleton(); myMiddle = am; myMiddle.reset(); myMiddle.addUser(mySkeletonUser1); myMiddle.addUser(mySkeletonUser2); // Render myAvatarUser1 = new Avatar(mySkeletonUser1); myAvatarUser2 = new Avatar(mySkeletonUser2); camara = new Camera(pM.graphics); // Estados myStates = DB4ObjectState.loadStates(Environment.CurrentDirectory + "\\Data\\States\\default.sta"); // Gestos myGestures = DB4ObjectGesture.loadGestures(Environment.CurrentDirectory + "\\Data\\Gestures\\default.ges"); // Crear formulario de edición de gestos formGesture = new WFDetectionGestures(this); formGesture.Show(); // Variables de logueo logBefore1 = ""; logBefore2 = ""; logBefore3 = ""; this.LoadContent(); }
internal void updateToPosition(int p, int user) { if (cursor[user] < myRecorder[user].Count) { HumanSkeleton.copy(myRecorder[user].ElementAt(cursor[user]), skeletons[user]); cursor[user] = p; } }
public HumanRenderer() { InitalizeBones(); skeleton = new HumanSkeleton(this); InitializeTextures(); }
public void undoUpdate(int user) { if (cursor[user] > 0) { cursor[user]--; HumanSkeleton.copy(myRecorder[user].ElementAt(cursor[user]), skeletons[user]); } }
public void update(int user) { if (cursor[user] < myRecorder[user].Count) { HumanSkeleton.copy(myRecorder[user].ElementAt(cursor[user]), skeletons[user]); cursor[user]++; } }
private void update(HumanSkeleton hS) { HumanBodyPart p1 = hS.getBodyPart(part1); HumanBodyPart p2 = hS.getBodyPart(part2); HumanBodyPart p3 = hS.getBodyPart(part3); v1.set(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z); v2.set(p3.X - p2.X, p3.Y - p2.Y, p3.Z - p2.Z); }
public void addUser(HumanSkeleton skeleton, String path) { this.addUser(skeleton); this.myPaths.Add(path); List <HumanSkeleton> animation = new List <HumanSkeleton>(); myRecorder.Add(animation); cursor.Add(0); }
public float getDistance(HumanSkeleton hS1, HumanSkeleton hS2) { HumanBodyPart p1 = hS1.getBodyPart(part1); HumanBodyPart p2 = hS2.getBodyPart(part2); double partialX = Math.Pow(p1.X - p2.X, 2); double partialY = Math.Pow(p1.Y - p2.Y, 2); double partialZ = Math.Pow(p1.Z - p2.Z, 2); return((float)Math.Sqrt(partialX + partialY + partialZ)); }
public override void update() { for (int user = 0; user < skeletons.Count; user++) { HumanSkeleton nuevo = new HumanSkeleton(); nuevo.init();//lo inicializa con las 15 partes del cuerpo HumanSkeleton.copy(skeletons[user], nuevo); myRecorder[user].Add(nuevo); cursor[user] += 1; } }
public override bool cumple(HumanSkeleton hS) { this.update(hS); double angulo = Math.Acos(getCosAngulo()); if (angulo > 0 && angulo < 90) { return(true); } return(false); }
public void addUser(HumanSkeleton skeleton, String path) { try { mySR = new StreamReader(path); this.addUser(skeleton); cursor.Add(0); crearEstructura(); } catch (Exception e) { Console.WriteLine("Problemas al abrir el archivo " + e.Message); } }
public Human(GameObject gameObject, Tracker tracker) { ID = CommonUtils.getNewID(); bodies = new List<SensorBody>(); this.gameObject = gameObject; this.gameObject.name = "Human " + ID; skeleton = this.gameObject.GetComponent<HumanSkeleton>(); skeleton.tracker = tracker; skeleton.ID = ID; skeleton.updateSkeleton(); }
public MenuForm(Principal pM, AbstractMiddle am) : base(pM) { mySkeleton = new HumanSkeleton(); mySkeleton.init(); myMiddle = am; myMiddle.reset(); myMiddle.addUser(mySkeleton); isSelecting = -1; isSelectingBefore = -1; interval1 = new TimeSpan(10000000); interval2 = new TimeSpan(20000000); interval3 = new TimeSpan(30000000); }
public RecordForm(Principal pM, AbstractMiddle am) : base(pM) { mySkeleton = new HumanSkeleton(); pathSelection(); myMiddle = am; myMiddle.reset(); myMiddle.addUser(mySkeleton); // Para iniciar el grabador del HumanSkeleton mySkeletonSave = new SkeletonSaveMiddle(); mySkeletonSave.addUser(mySkeleton, path); saved = false; // Render myAvatar = new Avatar(mySkeleton); camara = new Camera(pM.graphics); this.LoadContent(); }
public override bool cumple(HumanSkeleton hS) { if (index < this.states.Count) { if ((DateTime.Now - this.initGesture) < this.intervalAt(index)) {//está dentro del periodo de tiempo permitido para ese estado if (this.stateAt(index).cumple(hS)) { this.move(); } } else//se terminó el tiempo permitido, entonces se reinicia el gesto. { reset(); } return(false); } else { this.reset(); return(true); } }
public TeacherForm(Principal pM, AbstractMiddle am) : base(pM) { mySkeletonUser1 = new HumanSkeleton(); mySkeletonUser2 = new HumanSkeleton(); mySkeletonTeacher = new HumanSkeleton(); myMiddle = am; myMiddle.reset(); myMiddle.addUser(mySkeletonUser1); myMiddle.addUser(mySkeletonUser2); // Animación: Para simular el inicio del dispositivo desde un archivo. this.loadAnimation(Environment.CurrentDirectory + "\\Data\\Animation\\default.ani"); // Estados this.loadStates(Environment.CurrentDirectory + "\\Data\\States\\default.sta"); // Gestos this.loadGestures(Environment.CurrentDirectory + "\\Data\\Gestures\\default.ges"); // Render myAvatarUser1 = new Avatar(mySkeletonUser1); myAvatarUser2 = new Avatar(mySkeletonUser2); myAvatarTeacher = new Avatar(mySkeletonTeacher); camara = new Camera(pM.graphics); // Crear formulario de edición de gestos formGesture = new WFDetectionGestures(this); formGesture.Show(); // Variables de logueo logBefore1 = ""; logBefore2 = ""; logBefore3 = ""; this.LoadContent(); }
private void crearEstructura() { try { String line; List <HumanSkeleton> animacion = new List <HumanSkeleton>(); while ((line = mySR.ReadLine()) != null) { HumanSkeleton nuevo = new HumanSkeleton(); nuevo.init();//lo inicializa con las 15 partes del cuerpo char[] delimiterChars = { SEPARADOR }; string[] words = line.Split(delimiterChars); for (int i = 0; i < nuevo.getBodyParts().Count * 4; i += 4) { setSkeletonBodyPart(nuevo, words[i], words[i + 1], words[i + 2], words[i + 3]); } animacion.Add(nuevo); } myRecorder.Add(animacion); this.closeConection(); this.setState(this.skeletons.Count - 1, this.DETECTADO); } catch (Exception e) { Console.WriteLine(e.Message); } }
public float getDistance(HumanSkeleton hS) { return(getDistance(hS, hS)); }
public abstract bool cumple(HumanSkeleton hS);
public override bool cumple(HumanSkeleton hS1, HumanSkeleton hS2) { return(getDistance(hS1, hS2) < presicion); }
public override bool cumple(HumanSkeleton hS1, HumanSkeleton hS2) { return(false); }
public void addUser(HumanSkeleton skeleton) { this.skeletons.Add(skeleton); this.skeletonsState.Add(BUSCANDO); }
public Avatar(HumanSkeleton skeleton) { this.esferas = new Hashtable(); this.skeleton = skeleton; translation = Matrix.Identity; }