public static object Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(object transformFrom)
 {
     WiimoteLib.Proxy.Point target = new WiimoteLib.Proxy.Point();
     WiimoteLib.Point       from   = (WiimoteLib.Point)transformFrom;
     target.X = from.X;
     target.Y = from.Y;
     return(target);
 }
Example #2
0
        private Vector <double> GetUnitVector(WiimoteLib.Point pixelcoords)
        {
            int PIXELS_X = 1024;
            int PIXELS_Y = 768;
            //const double FOV_X = .578; unused

            int    pxFromOriginX = pixelcoords.X - (PIXELS_X / 2);
            int    pxFromOriginY = pixelcoords.Y - (PIXELS_Y / 2);
            double pxFromOriginZ = PIXELS_Z; //PIXELS_X / Math.Tan(FOV_X / 2);
            var    unitVector    = new DenseVector(new double[] { pxFromOriginX, pxFromOriginY, pxFromOriginZ });

            return(unitVector.Normalize(2));
        }
Example #3
0
 public Position(WiimoteLib.Point point, DateTime time)
 {
     this.point = point;
     this.time = time;
 }
Example #4
0
 public Spell addPosition(WiimoteLib.Point pointF, DateTime dateTime)
 {
     return(handleAdd(new Position(pointF, dateTime)));
 }
 public static object Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(object transformFrom)
 {
     WiimoteLib.Point target = new WiimoteLib.Point();
     WiimoteLib.Proxy.Point from = (WiimoteLib.Proxy.Point)transformFrom;
     target.X = from.X;
     target.Y = from.Y;
     return target;
 }
Example #6
0
 public Position(WiimoteLib.Point point, DateTime time)
 {
     this.wiiPoint = point;
     this.point    = new System.Drawing.Point((1023 - point.X) / 4, (760 - point.Y) / 4);
     this.time     = time;
 }
Example #7
0
 public Position(WiimoteLib.Point point, DateTime time)
 {
     wiiPoint = point;
     this.point = new Point((1023 - point.X) / 4, (760 - point.Y) / 4);
     this.time = time;
 }
Example #8
0
        public Spell addPosition(WiimoteLib.Point pointF, DateTime dateTime)
        {
            if (spellNames.Count == 0 && !cloudBitWarningShown)
            {
                cloudBitWarningShown = true;
                MessageBox.Show(
                    "You need to choose the spells and set the cloudBit configurations before casting spells",
                    "Configuration required",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return(null);
            }


            if (spell == null)
            {
                addPosition(new Position(pointF, dateTime));

                if (positions.Count > 10)
                {
                    if (wandIsPaused(positions))
                    {
                        Spell chosen = brain.chooseSpell(positions);
                        if (chosen != null && authorization != null && device != null && spellNames != null)
                        {
                            for (int i = 0; i < spellNames.Count; i++)
                            {
                                if (spellNames[i].Equals(chosen.GetType().Name))
                                {
                                    spell = chosen;
                                    ((CloudBitSpell)spell).setConfigurations(device, authorization, spellVoltages[i], spellDurations[i]);
                                    spell.castSpell();
                                    startSpell = DateTime.Now;
                                }
                            }
                        }

                        /*
                         * strokes = decomposer.determineStrokes(positions);
                         *
                         * // TODO: move to class for choosing which spell was cast
                         * foreach (SpellTrigger trigger in spells)
                         * {
                         *  if (trigger.triggered(strokes))
                         *  {
                         *      spell = trigger;
                         *      trigger.castSpell();
                         *      startSpell = DateTime.Now;
                         *  }
                         * }
                         */
                    }
                }
            }
            else if (!spell.casting())
            {
                spell = null;
                positions.Clear();
                if (strokes != null)
                {
                    strokes.Clear();
                }
            }

            return(spell);
        }
Example #9
0
 public Position(WiimoteLib.Point point, DateTime time)
 {
     this.point = point;
     this.time  = time;
 }