Пример #1
0
  public void test() {
    MeshStore store = new MeshStore();
    Mesh3D box = Mesh3D.box(100, 25, 35);

    // Geant4Basic  shape = new Geant4Basic("","box",20,20,80);
    // MeshView mesh = Geant4Mesh.makeMeshBox(shape);
    // box.translateXYZ(40.0, 0.0, 120.0);
    box.rotateZ(Math.toRadians(30.0));
    MeshView mesh = box.getMeshView();
    mesh.setMaterial(store.getMaterials().get(2));
    this.root.getChildren().add(mesh);
  }
Пример #2
0
  /**
   * Main program for tests
   *
   * @param args
   */
  public static void main(String[] args) {
    Mesh3D box = Mesh3D.box(10, 20, 60);

    Line3D lineX = box.getLineX();
    Line3D lineY = box.getLineY();
    Line3D lineZ = box.getLineZ();
    lineX.show();
    lineY.show();
    lineZ.show();
    box.translateXYZ(100, 0.0, 0.0);
    box.show();
    Line3D line = new Line3D();
    List<Point3D> intersects = new ArrayList<Point3D>();

    for (int p = 0; p < 100; p++) {
      double r = 600;
      double theta = Math.toRadians(90.0); // Math.toRadians(Math.random()*180.0);
      double phi = Math.toRadians(Math.random() * 360.0 - 180.0);
      line.set(
          0.0,
          0.0,
          0.0,
          Math.sin(theta) * Math.cos(phi) * r,
          Math.sin(theta) * Math.sin(phi) * r,
          Math.cos(theta) * r);
      intersects.clear();
      box.intersectionRay(line, intersects);
      System.out.println(
          "theta/phi = "
              + Math.toDegrees(theta)
              + "  "
              + Math.toDegrees(phi)
              + " intersects = "
              + intersects.size());
    }
  }