Example #1
0
 public void mousecoord(Atom[] args) {
   mousecoord = new float[] {args[0].toFloat(), args[1].toFloat(), args[2].toFloat()};
   double r =
       Math.sqrt(
           (args[0].toFloat() * args[0].toFloat()) + (args[1].toFloat() * args[1].toFloat()));
   double d = Math.atan2(args[1].toFloat(), args[0].toFloat());
 }
Example #2
0
    public boolean stopdrag(float[] mc) {
      double r = Math.sqrt((mc[0] * mc[0]) + (mc[1] * mc[1]));
      double d = Math.atan2(mc[1], mc[0]);

      polar[0] = (Math.round(d * 100.00)) / 100.00;
      polar[1] = r;

      return r > 0.8;
    }
Example #3
0
  private float[] perpendicularVector(float[] point1, float[] point2) {

    float[] ofv = {0, 0, 0};

    float x = point2[0] - point1[0];
    float y = point2[1] - point1[1];
    float z = point2[2] - point1[2];

    float c = (float) Math.sqrt(x * x + y * y + z * z);
    ofv[0] = -y / c;
    ofv[1] = x / c;
    ofv[2] = z / c;

    return ofv;
  }
Example #4
0
    SeqNode(float _x, float _y, float _z, float _size, String _name) {
      coords = new float[] {_x, _y, _z};

      double r = Math.sqrt((_x * _x) + (_y * _y));
      double d = Math.atan2(_y, _x);

      polar = new double[] {d, r};
      polar[0] = (Math.round(d * 100.00)) / 100.00;

      size = _size;
      hover = false;
      triggered = false;
      selected = false;
      name = _name;
    }
Example #5
0
    private boolean detectHit(float[] mc) {

      if ((mc[0] < 0 && coords[0] < 0)
          || (mc[0] > 0 && coords[0] > 0) && (mc[1] < 0 && coords[1] < 0)
          || (mc[1] > 0 && coords[1] > 0) && (mc[2] < 0 && coords[2] < 0)
          || (mc[2] > 0 && coords[2] > 0)) {

        double dx = Math.pow((mc[0] + 100) - (coords[0] + 100), 2);
        double dy = Math.pow((mc[1] + 100) - (coords[1] + 100), 2);
        double dz = Math.pow((mc[2] + 100) - (coords[2] + 100), 2);
        double vLength = Math.sqrt(dx + dy + dz);

        if ((vLength) < (size + 0.05)) {
          return true;
        }
      }

      return false;
    }
Example #6
0
 public void resize(float[] mc) {
   double dx = Math.pow((mc[0] + 100) - (coords[0] + 100), 2);
   double dy = Math.pow((mc[1] + 100) - (coords[1] + 100), 2);
   double dz = Math.pow((mc[2] + 100) - (coords[2] + 100), 2);
   size = Math.sqrt(dx + dy + dz);
 }