Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 2.5D and 3D #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.pdb
bin/
obj/
.vs/
Help/
TestResults/
*.userprefs
Expand Down Expand Up @@ -42,4 +43,4 @@ TestResults/
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
Thumbs.db
40 changes: 27 additions & 13 deletions TUIO/TuioBlob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ public class TuioBlob : TuioContainer
* <summary>
* Defines the ROTATING state.</summary>
*/
public static readonly int TUIO_ROTATING = 5;
public static readonly int TUIO_ROTATING = 4;
/**
* <summary>
* Defines the RESIZED state.</summary>
*/
public static readonly int TUIO_RESIZED = 7;
#endregion

#region Constructors
Expand All @@ -101,8 +106,8 @@ public class TuioBlob : TuioContainer
* <param name="h">the height to assign</param>
* <param name="f">the area to assign</param>
*/
public TuioBlob(TuioTime ttime, long si, int bi, float xp, float yp, float a, float w, float h, float f)
: base(ttime, si, xp, yp)
public TuioBlob(TuioTime ttime, long si, int bi, float xp, float yp, float a, float w, float h, float f)
: base(ttime, si, xp, yp, 0)
{
blob_id = bi;
angle = a;
Expand All @@ -128,7 +133,7 @@ public TuioBlob(TuioTime ttime, long si, int bi, float xp, float yp, float a, fl
* <param name="f">the area to assign</param>
*/
public TuioBlob(long si, int bi, float xp, float yp, float a, float w, float h, float f)
: base(si, xp, yp)
: base(si, xp, yp, 0)
{
blob_id = bi;
angle = a;
Expand Down Expand Up @@ -182,14 +187,17 @@ public TuioBlob(TuioBlob tblb)
*/
public void update(TuioTime ttime, float xp, float yp, float a, float w, float h, float f, float xs, float ys, float rs, float ma, float ra)
{
base.update(ttime, xp, yp, xs, ys, ma);
base.update(ttime, xp, yp, 0, xs, ys, 0, ma);
angle = a;
width = w;
float dw = width - w;
float dh = height - h;
width = w;
height = h;
area = f;
rotation_speed = rs;
rotation_accel = ra;
if ((rotation_accel != 0) && (state != TUIO_STOPPED)) state = TUIO_ROTATING;
if (dw != 0 || dh != 0) state = TUIO_RESIZED;
}

/**
Expand All @@ -212,14 +220,17 @@ public void update(TuioTime ttime, float xp, float yp, float a, float w, float h
*/
public void update(float xp, float yp, float a, float w, float h, float f, float xs, float ys, float rs, float ma, float ra)
{
base.update(xp, yp, xs, ys, ma);
base.update(xp, yp, 0, xs, ys, 0, ma);
angle = a;
width = w;
float dw = width - w;
float dh = height - h;
width = w;
height = h;
area = f;
rotation_speed = rs;
rotation_accel = ra;
if ((rotation_accel != 0) && (state != TUIO_STOPPED)) state = TUIO_ROTATING;
if (dw != 0 || dh != 0) state = TUIO_RESIZED;
}

/**
Expand All @@ -239,9 +250,11 @@ public void update(float xp, float yp, float a, float w, float h, float f, float
public void update(TuioTime ttime, float xp, float yp, float a,float w, float h, float f)
{
TuioPoint lastPoint = path.Last.Value;
base.update(ttime, xp, yp);
base.update(ttime, xp, yp, 0);

width = w;
float dw = width - w;
float dh = height - h;
width = w;
height = h;
area = f;

Expand All @@ -254,10 +267,11 @@ public void update(TuioTime ttime, float xp, float yp, float a,float w, float h,
float da = (angle - last_angle) / (2.0f * (float)Math.PI);
if (da > 0.75f) da -= 1.0f;
else if (da < -0.75f) da += 1.0f;

angle = a;
rotation_speed = da / dt;
rotation_accel = (rotation_speed - last_rotation_speed) / dt;
if ((rotation_accel != 0) && (state != TUIO_STOPPED)) state = TUIO_ROTATING;
if (dw != 0 || dh != 0) state = TUIO_RESIZED;
}

/**
Expand All @@ -277,7 +291,7 @@ public void update(TuioBlob tblb)
area = tblb.Area;
rotation_speed = tblb.RotationSpeed;
rotation_accel = tblb.RotationAccel;
if ((rotation_accel != 0) && (state != TUIO_STOPPED)) state = TUIO_ROTATING;
state = tblb.state;
}

/**
Expand All @@ -287,7 +301,7 @@ public void update(TuioBlob tblb)
*/
public new void stop(TuioTime ttime)
{
update(ttime, this.xpos, this.ypos, this.angle, this.width, this.height, this.area);
update(ttime, this.xpos, this.ypos, this.angle, this.width, this.height, this.area);
}
#endregion

Expand Down
Loading