move files back to src/main
This commit is contained in:
33
src/main/java/wiiusej/values/Acceleration.java
Normal file
33
src/main/java/wiiusej/values/Acceleration.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package wiiusej.values;
|
||||
|
||||
public class Acceleration {
|
||||
protected double x;
|
||||
protected double y;
|
||||
protected double z;
|
||||
|
||||
public Acceleration(double x, double y, double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double[] toArray() {
|
||||
return new double[] {getX(), getY(), getZ()};
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Acceleration : (" + x + ", " + y + ", " + z + ")";
|
||||
}
|
||||
}
|
||||
31
src/main/java/wiiusej/values/Calibration.java
Normal file
31
src/main/java/wiiusej/values/Calibration.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package wiiusej.values;
|
||||
|
||||
public class Calibration {
|
||||
protected RawAcceleration zeroAcceleration;
|
||||
protected RawAcceleration gAcceleration;
|
||||
protected RawAcceleration differenceAcceleration;
|
||||
|
||||
public Calibration(RawAcceleration zeroAcceleration, RawAcceleration gAcceleration) {
|
||||
this.zeroAcceleration = zeroAcceleration;
|
||||
this.gAcceleration = gAcceleration;
|
||||
differenceAcceleration = new RawAcceleration(
|
||||
(short) (gAcceleration.getX() - zeroAcceleration.getX()),
|
||||
(short) (gAcceleration.getY() - zeroAcceleration.getY()),
|
||||
(short) (gAcceleration.getZ() - zeroAcceleration.getZ()));
|
||||
}
|
||||
|
||||
public RawAcceleration getZeroAcceleration() {
|
||||
return zeroAcceleration;
|
||||
}
|
||||
|
||||
public RawAcceleration getGAcceleration() {
|
||||
return gAcceleration;
|
||||
}
|
||||
|
||||
public Acceleration getAcceleration(RawAcceleration rawAcceleration) {
|
||||
return new Acceleration(
|
||||
(rawAcceleration.getX() - zeroAcceleration.getX()) / (double) differenceAcceleration.getX(),
|
||||
(rawAcceleration.getY() - zeroAcceleration.getY()) / (double) differenceAcceleration.getY(),
|
||||
(rawAcceleration.getZ() - zeroAcceleration.getZ()) / (double) differenceAcceleration.getZ());
|
||||
}
|
||||
}
|
||||
83
src/main/java/wiiusej/values/GForce.java
Normal file
83
src/main/java/wiiusej/values/GForce.java
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* This file is part of WiiuseJ.
|
||||
*
|
||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WiiuseJ is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package wiiusej.values;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Represents gravity force on each axis.
|
||||
*
|
||||
* @author guiguito
|
||||
*/
|
||||
public class GForce implements Serializable {
|
||||
protected static final long serialVersionUID = 1L;
|
||||
|
||||
private float x;
|
||||
private float y;
|
||||
private float z;
|
||||
|
||||
/**
|
||||
* Default constructor;
|
||||
*/
|
||||
public GForce() {
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with gravity force on each axis.
|
||||
*
|
||||
* @param xx
|
||||
* x value
|
||||
* @param yy
|
||||
* x value
|
||||
* @param zz
|
||||
* x value
|
||||
*/
|
||||
public GForce(float xx, float yy, float zz) {
|
||||
x = xx;
|
||||
y = yy;
|
||||
z = zz;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the x
|
||||
*/
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the y
|
||||
*/
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the z
|
||||
*/
|
||||
public float getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Gravity force : (" + x + ", " + y + "," + z + ")";
|
||||
}
|
||||
}
|
||||
106
src/main/java/wiiusej/values/IRSource.java
Normal file
106
src/main/java/wiiusej/values/IRSource.java
Normal file
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* This file is part of WiiuseJ.
|
||||
*
|
||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WiiuseJ is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package wiiusej.values;
|
||||
|
||||
/**
|
||||
* Class used for IR sources.
|
||||
*
|
||||
* @author guiguito
|
||||
*/
|
||||
public class IRSource {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private short rx;
|
||||
private short ry;
|
||||
private short size;
|
||||
|
||||
/**
|
||||
* Build an IR source with all details.
|
||||
*
|
||||
* @param xx
|
||||
* xx interpolated coordinates.
|
||||
* @param yy
|
||||
* yy interpolated coordinates.
|
||||
* @param rxx
|
||||
* raw X coordinate (0-1023).
|
||||
* @param ryy
|
||||
* raw Y coordinate (0-1023).
|
||||
* @param si
|
||||
* size of the IR dot (0-15).
|
||||
*/
|
||||
public IRSource(int xx, int yy, short rxx, short ryy, short si) {
|
||||
x = xx;
|
||||
y = yy;
|
||||
rx = rxx;
|
||||
ry = ryy;
|
||||
size = si;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return x interpolated coordinates.
|
||||
*
|
||||
* @return the x
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return y interpolated coordinates.
|
||||
*
|
||||
* @return the y
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return raw X coordinate (0-1023).
|
||||
*
|
||||
* @return the rx
|
||||
*/
|
||||
public short getRx() {
|
||||
return rx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return raw Y coordinate (0-1023).
|
||||
*
|
||||
* @return the ry
|
||||
*/
|
||||
public short getRy() {
|
||||
return ry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return size of the IR dot (0-15).
|
||||
*
|
||||
* @return the size
|
||||
*/
|
||||
public short getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Interpolated coordinates (" + x + "," + y
|
||||
+ "), Raw coordinates(" + rx + "," + ry + "), source size : "
|
||||
+ size + ")";
|
||||
}
|
||||
|
||||
}
|
||||
120
src/main/java/wiiusej/values/Orientation.java
Normal file
120
src/main/java/wiiusej/values/Orientation.java
Normal file
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* This file is part of WiiuseJ.
|
||||
*
|
||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WiiuseJ is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package wiiusej.values;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Class that represents the orientation of the wiimote.
|
||||
*
|
||||
* @author guiguito
|
||||
*/
|
||||
public class Orientation implements Serializable {
|
||||
protected static final long serialVersionUID = 1L;
|
||||
|
||||
private float roll;
|
||||
private float pitch;
|
||||
private float yaw;
|
||||
private float a_roll;
|
||||
private float a_pitch;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public Orientation() {
|
||||
roll = 0;
|
||||
pitch = 0;
|
||||
yaw = 0;
|
||||
a_roll = 0;
|
||||
a_pitch = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contructor with raw, pitch , yaw.
|
||||
*
|
||||
* @param r
|
||||
* roll (can be smoothed)
|
||||
* @param p
|
||||
* pitch (can be smoothed)
|
||||
* @param y
|
||||
* yaw
|
||||
* @param ar
|
||||
* absolute roll
|
||||
* @param ap
|
||||
* absolute pitch
|
||||
*/
|
||||
public Orientation(float r, float p, float y, float ar, float ap) {
|
||||
roll = r;
|
||||
pitch = p;
|
||||
yaw = y;
|
||||
a_roll = ar;
|
||||
a_pitch = ap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the roll (can be smoothed).
|
||||
*
|
||||
* @return the roll
|
||||
*/
|
||||
public float getRoll() {
|
||||
return roll;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pitch (can be smoothed).
|
||||
*
|
||||
* @return the pitch
|
||||
*/
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the yaw.
|
||||
*
|
||||
* @return the yaw
|
||||
*/
|
||||
public float getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get absolute roll (can not be smoothed).
|
||||
*
|
||||
* @return the a_roll
|
||||
*/
|
||||
public float getARoll() {
|
||||
return a_roll;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get absolute pitch (can not be smoothed).
|
||||
*
|
||||
* @return the a_pitch
|
||||
*/
|
||||
public float getAPitch() {
|
||||
return a_pitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Orientation : (roll: " + roll + ", pitch: " + pitch + ", yaw: "
|
||||
+ yaw + ", absolute roll: " + a_roll + ", absolute pitch: "
|
||||
+ a_pitch + ")";
|
||||
}
|
||||
|
||||
}
|
||||
84
src/main/java/wiiusej/values/RawAcceleration.java
Normal file
84
src/main/java/wiiusej/values/RawAcceleration.java
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* This file is part of WiiuseJ.
|
||||
*
|
||||
* WiiuseJ is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WiiuseJ is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WiiuseJ. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package wiiusej.values;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Represents raw acceleration on each axis.
|
||||
*
|
||||
* @author guiguito
|
||||
*/
|
||||
public class RawAcceleration implements Serializable {
|
||||
protected static final long serialVersionUID = 1L;
|
||||
|
||||
private short x;
|
||||
private short y;
|
||||
private short z;
|
||||
|
||||
/**
|
||||
* Default constructor;
|
||||
*/
|
||||
public RawAcceleration() {
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with raw acceleration on each axis.
|
||||
*
|
||||
* @param xx
|
||||
* x value
|
||||
* @param yy
|
||||
* x value
|
||||
* @param zz
|
||||
* x value
|
||||
*/
|
||||
public RawAcceleration(short xx, short yy, short zz) {
|
||||
x = xx;
|
||||
y = yy;
|
||||
z = zz;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the x
|
||||
*/
|
||||
public short getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the y
|
||||
*/
|
||||
public short getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the z
|
||||
*/
|
||||
public short getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Raw acceleration : (" + x + ", " + y + ", " + z + ")";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user