コード例 #1
0
ファイル: ScalarImage.java プロジェクト: JoeyPrink/TEALsim
 public void vec2FieldMagnitude(Field field, AffineTransform ftoi) {
   AffineTransform itof = null;
   try {
     itof = ftoi.createInverse();
   } catch (NoninvertibleTransformException niv) {
     TDebug.println(0, "NoninvertibleTransformException: " + niv);
   }
   Vector3d v = new Vector3d();
   Point2D.Double p = new Point2D.Double();
   for (int j = 0, k = 0; j < height; ++j)
     for (int i = 0; i < width; ++i, ++k) {
       p.x = i;
       p.y = j;
       itof.transform(p, p);
       v = field.get(p.x, p.y, 0.0);
       f[k] = (float) Math.sqrt(v.x * v.x + v.y * v.y);
     }
 }
コード例 #2
0
ファイル: ScalarImage.java プロジェクト: JoeyPrink/TEALsim
 public void vec2FieldZero(Field field, AffineTransform ftoi) {
   AffineTransform itof = null;
   try {
     itof = ftoi.createInverse();
   } catch (NoninvertibleTransformException niv) {
     TDebug.println(0, "NoninvertibleTransformException: " + niv);
   }
   Vector3d v = new Vector3d();
   Point2D.Double p = new Point2D.Double();
   for (int j = 0, k = 0; j < height; ++j)
     for (int i = 0; i < width; ++i, ++k) {
       p.x = i;
       p.y = j;
       itof.transform(p, p);
       v = field.get(p.x, p.y, 0.0);
       if ((v.x == 0.0) && (v.y == 0.0)) f[k] = 1.0f;
       else f[k] = 0.0f;
     }
 }