getX() public method

public getX ( ) : float
return float
示例#1
0
 /**
  * This constructor takes a TuioPoint argument and sets its coordinate attributes
  * to the coordinates of the provided TuioPoint and its time stamp to the current session time.
  *
  * @param	tpoint	the TuioPoint to assign
  */
 public TuioPoint(TuioPoint tpoint)
 {
     xpos        = tpoint.getX();
     ypos        = tpoint.getY();
     currentTime = TuioTime.getSessionTime();
     startTime   = new TuioTime(currentTime);
 }
        /**
         * Takes a TuioTime argument and assigns it along with the provided
         * X and Y coordinate to the private TuioContainer attributes.
         * The speed and accleration values are calculated accordingly.
         *
         * @param	ttime	the TuioTime to assign
         * @param	xp	the X coordinate to assign
         * @param	yp	the Y coordinate to assign
         */
        public new void update(TuioTime ttime, float xp, float yp)
        {
            TuioPoint lastPoint = path[path.Count - 1];

            base.update(ttime, xp, yp);

            TuioTime diffTime          = currentTime - lastPoint.getTuioTime();
            float    dt                = diffTime.getTotalMilliseconds() / 1000.0f;
            float    dx                = this.xpos - lastPoint.getX();
            float    dy                = this.ypos - lastPoint.getY();
            float    dist              = (float)Math.Sqrt(dx * dx + dy * dy);
            float    last_motion_speed = this.motion_speed;

            this.x_speed      = dx / dt;
            this.y_speed      = dy / dt;
            this.motion_speed = dist / dt;
            this.motion_accel = (motion_speed - last_motion_speed) / dt;

            path.Add(new TuioPoint(currentTime, xpos, ypos));
            if (motion_accel > 0)
            {
                state = TUIO_ACCELERATING;
            }
            else if (motion_accel < 0)
            {
                state = TUIO_DECELERATING;
            }
            else
            {
                state = TUIO_STOPPED;
            }
        }
示例#3
0
        public float getAngle(TuioPoint tuioPoint)
        {
            float side = tuioPoint.getX()-xpos;
            float height = tuioPoint.getY()-ypos;
            float distance = tuioPoint.getDistance(xpos,ypos);

            float angle = (float)(Math.Asin(side/distance)+Math.PI/2);
            if (height<0) angle = 2.0f*(float)Math.PI-angle;

            return angle;
        }
示例#4
0
 /**
  * Returns the angle to the provided TuioPoint
  *
  * @param	tpoint	the distant TuioPoint
  * @return	the angle to the provided TuioPoint
  */
 public float getAngle(TuioPoint tpoint)
 {
     return(getAngle(tpoint.getX(), tpoint.getY()));
 }
示例#5
0
 /**
  * Returns the distance to the provided TuioPoint
  *
  * @param	tpoint	the distant TuioPoint
  * @return	the distance to the provided TuioPoint
  */
 public float getDistance(TuioPoint tpoint)
 {
     return(getDistance(tpoint.getX(), tpoint.getY()));
 }
示例#6
0
 /**
  * Takes a TuioPoint argument and updates its coordinate attributes
  * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
  *
  * @param	tpoint	the TuioPoint to assign
  */
 public void update(TuioPoint tpoint)
 {
     xpos = tpoint.getX();
     ypos = tpoint.getY();
 }
示例#7
0
 public float getDistance(TuioPoint pt)
 {
     float dx = xpos-pt.getX();
     float dy = ypos-pt.getY();
     return (float)Math.Sqrt(dx*dx+dy*dy);
 }
示例#8
0
 public TuioPoint(TuioPoint p)
 {
     this.xpos = p.getX();
     this.ypos = p.getY();
     timestamp = TUIO_UNDEFINED;
 }
示例#9
0
 /**
  * Takes a TuioPoint argument and updates its coordinate attributes
  * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
  *
  * @param	tpoint	the TuioPoint to assign
  */
 public void update(TuioPoint tpoint)
 {
     xpos = tpoint.getX();
     ypos = tpoint.getY();
 }
示例#10
0
 /**
  * This constructor takes a TuioPoint argument and sets its coordinate attributes
  * to the coordinates of the provided TuioPoint and its time stamp to the current session time.
  *
  * @param	tpoint	the TuioPoint to assign
  */
 public TuioPoint(TuioPoint tpoint)
 {
     xpos = tpoint.getX();
     ypos = tpoint.getY();
     currentTime = TuioTime.getSessionTime();
 }
示例#11
0
 /**
  * Returns the distance to the provided TuioPoint
  *
  * @param	tpoint	the distant TuioPoint
  * @return	the distance to the provided TuioPoint
  */
 public float getDistance(TuioPoint tpoint)
 {
     return getDistance(tpoint.getX(),tpoint.getY());
 }
示例#12
0
 /**
  * Returns the angle to the provided TuioPoint
  *
  * @param	tpoint	the distant TuioPoint
  * @return	the angle to the provided TuioPoint
  */
 public float getAngle(TuioPoint tpoint)
 {
     return getAngle(tpoint.getX(),tpoint.getY());
 }
示例#13
0
 public TuioPoint(TuioPoint p)
 {
     this.xpos = p.getX();
     this.ypos = p.getY();
 }
示例#14
0
 public void update(TuioPoint p)
 {
     this.xpos = p.getX();
     this.ypos = p.getY();
 }
        /**
         * Takes a TuioTime argument and assigns it along with the provided
         * X and Y coordinate to the private TuioContainer attributes.
         * The speed and accleration values are calculated accordingly.
         *
         * @param	ttime	the TuioTime to assign
         * @param	xp	the X coordinate to assign
         * @param	yp	the Y coordinate to assign
         */
        public new void update(TuioTime ttime, float xp, float yp)
        {
            lastPoint = path[path.Count - 1];
            if (path.Count > 1)
                lastLastPoint = path[path.Count - 2];

            base.update(ttime, xp, yp);

            TuioTime diffTime = currentTime - lastPoint.getTuioTime();
            float dt = diffTime.getTotalMilliseconds() / 1000.0f;
            float dx = this.xpos - lastPoint.getX();
            float dy = this.ypos - lastPoint.getY();
            float dist = (float)Math.Sqrt(dx * dx + dy * dy);
            float last_motion_speed = this.motion_speed;

            this.x_speed = dx / dt;
            this.y_speed = dy / dt;
            this.motion_speed = dist / dt;
            this.motion_accel = (motion_speed - last_motion_speed) / dt;

            lock (pathSync)
            {
                path.Add(new TuioPoint(currentTime, xpos, ypos));
            }
            if (motion_accel > 0) state = TUIO_ACCELERATING;
            else if (motion_accel < 0) state = TUIO_DECELERATING;
            else state = TUIO_STOPPED;
            this.trimPath();
        }