Esempio n. 1
0
  private boolean isClickValid_radar(
      float x, float y, float marX, float marY, float rotation, float barheight) {

    // if the marker is not active (i.e. not shown in AR view) we don't have to check it for clicks
    if (!isActive()) return false;
    float margin = 50;
    // TODO adapt the following to the variable radius!
    pPt.x = marX;
    pPt.y = marY;
    Log.d("fClick2", "orig :x:" + pPt.x + ", y:" + pPt.y);
    // pPt.rotate(Math.toRadians(-(currentAngle + 90)));
    pPt.rotate2(Math.toRadians((rotation)), rx, ry);
    Log.d(
        "fClick2",
        "changed r :" + rotation + ", x:" + pPt.x + ", y:" + pPt.y + ", rx= " + rx + ",ry= " + ry);
    Log.d("fClick2", "changed :x:" + pPt.x + ", y:" + pPt.y);

    pPt.y += barheight;

    float objX = pPt.x - margin;
    float objY = pPt.y - margin;
    float objW = pPt.x + margin;
    float objH = pPt.y + margin;
    // Log.d("Click","x:"+x+", y:"+y+", getX:"+txtLab.getX()+", getY:"+txtLab.getY());
    // Log.d("MixView","pPt.x:"+pPt.x+", pPt.y:"+pPt.y+", objX:"+objX+", objY:"+objY+",
    // objW:"+objW+", objH:"+objH);
    // Log.d("MixView","pPt.x:"+pPt.x+", pPt.y:"+pPt.y+", objX:"+objX+objW+", objY:"+objY+objH);

    if (x > objX && x < objW && y > objY && y < objH) {
      Log.d("fClick2", "Valid");
      return true;
    } else {
      return false;
    }
  }
Esempio n. 2
0
  private boolean isClickValid(float x, float y) {
    float currentAngle = MixUtils.getAngle(cMarker.x, cMarker.y, signMarker.x, signMarker.y);
    // if the marker is not active (i.e. not shown in AR view) we don't have to check it for clicks
    if (!isActive()) return false;

    // TODO adapt the following to the variable radius!
    pPt.x = x - signMarker.x;
    pPt.y = y - signMarker.y;
    pPt.rotate(Math.toRadians(-(currentAngle + 90)));
    pPt.x += txtLab.getX();
    pPt.y += txtLab.getY();

    float objX = txtLab.getX() - txtLab.getWidth() / 2;
    float objY = txtLab.getY() - txtLab.getHeight() / 2;
    float objW = txtLab.getWidth();
    float objH = txtLab.getHeight();

    if (pPt.x > objX && pPt.x < objX + objW && pPt.y > objY && pPt.y < objY + objH) {
      return true;
    } else {
      return false;
    }
  }