removal of junk and changes made by luca
This commit is contained in:
@@ -64,7 +64,9 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
Exercise exercise = new Exercise(EMuscleGroup.ARMS, "Bicep Curls", "Oefening voor de biceps.", gesturePathBuilder.build(), gesturePathBuilder.build());
|
Exercise exercise = new Exercise(EMuscleGroup.ARMS, "Bicep Curls", "Oefening voor de biceps.", gesturePathBuilder.build(), gesturePathBuilder.build());
|
||||||
|
|
||||||
personalMotionPreviewElement.initialize(exercise);
|
personalMotionPreviewElement.initialize(exercise);
|
||||||
|
personalMotionPreviewElement.provideQiContext(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -42,13 +42,12 @@ public class PersonalMotionPreviewElement extends View {
|
|||||||
private final Paint targetPaint = new Paint();
|
private final Paint targetPaint = new Paint();
|
||||||
private final Paint backgroundColor = new Paint();
|
private final Paint backgroundColor = new Paint();
|
||||||
|
|
||||||
private Matrix4f modelMatrix = new Matrix4f(); // The model view matrix for the 3D to 2D transformation.
|
|
||||||
private Matrix4f viewMatrix = new Matrix4f(); // The view matrix for the 3D to 2D transformation.
|
private Matrix4f viewMatrix = new Matrix4f(); // The view matrix for the 3D to 2D transformation.
|
||||||
private Matrix4f projectionMatrix = new Matrix4f(); // The projection matrix for the 3D to 2D transformation.
|
private Matrix4f projectionMatrix = new Matrix4f(); // The projection matrix for the 3D to 2D transformation.
|
||||||
private final Vector4f objectPosition = new Vector4f(0, 0, 0, 1); // The location of the object in 3D space.
|
private final Vector4f objectPosition = new Vector4f(0, 0, 0, 1); // The location of the object in 3D space.
|
||||||
private ConcurrentLinkedQueue<Vector2f> vectors = new ConcurrentLinkedQueue<>();
|
private ConcurrentLinkedQueue<Vector2f> vectors = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
private Vector2f[] axisVectors;
|
private Vector2f[] axisVectors = new Vector2f[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +172,7 @@ public class PersonalMotionPreviewElement extends View {
|
|||||||
private Vector2f projectVertex(Vector3f point, int virtualWidth, int virtualHeight) {
|
private Vector2f projectVertex(Vector3f point, int virtualWidth, int virtualHeight) {
|
||||||
viewMatrix
|
viewMatrix
|
||||||
.identity()
|
.identity()
|
||||||
.lookAt(new Vector3f(0, 0, -5), new Vector3f(0, 0, 0), new Vector3f(0, 1, 0));
|
.lookAt(new Vector3f(0, 0, -2), new Vector3f(0, 0, 0), new Vector3f(0, 1, 0));
|
||||||
|
|
||||||
// Transform the projection matrix to a perspective projection matrix
|
// Transform the projection matrix to a perspective projection matrix
|
||||||
// Perspective transformation conserves the depth of the object
|
// Perspective transformation conserves the depth of the object
|
||||||
@@ -184,8 +183,7 @@ public class PersonalMotionPreviewElement extends View {
|
|||||||
// Convert world coordinates to screen-space using MVP matrix
|
// Convert world coordinates to screen-space using MVP matrix
|
||||||
Vector4f screenCoordinates = new Vector4f(point, 1.0f)
|
Vector4f screenCoordinates = new Vector4f(point, 1.0f)
|
||||||
.mul(this.projectionMatrix)
|
.mul(this.projectionMatrix)
|
||||||
.mul(this.viewMatrix)
|
.mul(this.viewMatrix);
|
||||||
.mul(this.modelMatrix);
|
|
||||||
|
|
||||||
// Normalize screen coordinates from (-1, 1) to (0, virtualWidth) and (0, virtualHeight)
|
// Normalize screen coordinates from (-1, 1) to (0, virtualWidth) and (0, virtualHeight)
|
||||||
float normalizedX = (screenCoordinates.x / screenCoordinates.w + 1.0f) * 0.5f * virtualWidth;
|
float normalizedX = (screenCoordinates.x / screenCoordinates.w + 1.0f) * 0.5f * virtualWidth;
|
||||||
@@ -199,8 +197,8 @@ public class PersonalMotionPreviewElement extends View {
|
|||||||
public void onDraw(Canvas canvas) {
|
public void onDraw(Canvas canvas) {
|
||||||
canvas.drawRect(0, 0, getWidth(), getHeight(), backgroundColor);
|
canvas.drawRect(0, 0, getWidth(), getHeight(), backgroundColor);
|
||||||
this.setBackgroundColor(0xFF000000); // Black
|
this.setBackgroundColor(0xFF000000); // Black
|
||||||
if (this.exercise == null)
|
/*if (this.exercise == null)
|
||||||
return;
|
return;*/
|
||||||
|
|
||||||
for (int i = 0, startX, endX, startY, endY; i < axisVectors.length/2; i++)
|
for (int i = 0, startX, endX, startY, endY; i < axisVectors.length/2; i++)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user