Example #1
0
 /**
  * See the class documentation
  *
  * @param args - has no purpose
  */
 public static void main(String[] args) {
   boolean cont = true; // Whether or not the user wishes to continue
   while (cont) {
     double[] input = getInput();
     Sphere aSp = new Sphere(input[0]);
     Cylinder aCy = new Cylinder(input[0], input[1]);
     Cone aCo = new Cone(input[0], input[1]);
     System.out.println(
         "The VOLUME of a SPHERE of given specifications is: " + aSp.volume((int) input[2]));
     System.out.println(
         "The SURFACE AREA of a SPHERE of given specifications is: "
             + aSp.surfaceArea(((int) input[2])));
     System.out.println(
         "The VOLUME of a CYLINDER of given specifications is: " + aCy.volume(((int) input[2])));
     System.out.println(
         "The SURFACE AREA of a CYLINDER of given specifications is: "
             + aCy.surfaceArea(((int) input[2])));
     System.out.println(
         "The VOLUME of a CONE of given specifications is: " + aCo.volume(((int) input[2])));
     System.out.println(
         "The SURFACE AREA of a CONE of given specifications is: "
             + aCo.surfaceArea(((int) input[2])));
     try {
       Thread.sleep(1000);
     } catch (InterruptedException e) {
     }
     cont = getContinue();
   }
   sc.close();
 }
Example #2
0
 protected void setConeDetailHint(double hint) {
   for (Renderable renderable : getLayer().getRenderables()) {
     Cone current = (Cone) renderable;
     current.setDetailHint(hint);
   }
   System.out.println("Cone detail hint set to " + hint);
 }
 /**
  * Returns a hierarchical index of a cone.
  *
  * @param index Healpix index
  * @param shape cone
  * @return the pixel numbers as a hierarchical index
  * @throws Exception Healpix Exception
  */
 protected static HealpixMoc computeConeIndex(final HealpixIndex index, final Shape shape)
     throws Exception {
   final HealpixMoc moc = new HealpixMoc();
   final Cone cone = (Cone) shape;
   final RangeSet rangeSet =
       index.queryDiscInclusive(cone.getCenter(), cone.getRadius(), TYPICAL_CHOICE_FACT);
   final RangeSet.ValueIterator valueIter = rangeSet.valueIterator();
   while (valueIter.hasNext()) {
     final long pixNest = valueIter.next();
     moc.add(new MocCell(index.getOrder(), pixNest));
   }
   return moc;
 }
Example #4
0
  public static Container createCone() {

    Cone cone = new Cone(2, Size.LARGE);
    cone.setTopping(Topping.NUTS);

    Scoop scoop1 = new Scoop(Flavor.VANILLA, 3.0, Arrays.asList(Topping.NUTS));
    Scoop scoop2 = new Scoop(Flavor.CHOCOLATE, 2.0, Arrays.asList(Topping.EXTRACHOCOLATE));
    Scoop scoop3 =
        new Scoop(Flavor.CHOCOLATE, 1.0, Arrays.asList(Topping.NUTS, Topping.STRAWBERRYJEERRY));

    cone.setBottomScoop(scoop1);
    scoop1.addScoop(scoop2);
    scoop2.addScoop(scoop3);

    return cone;
  }
  private void regenerateParticle(MovingParticle p) {
    // Generate random particle
    float cutOff = (float) Math.random() * cone.getCutOff();
    float angle = (float) Math.random() * 2 * (float) Math.PI;
    float speed = (float) Math.random() * 5f + 1.5f;

    // Particle direction
    Quaternion4f rot =
        cone.getOrientation()
            .clone()
            .multiply(Quaternion4f.fromAxisAngle(0, 0, 1, angle))
            .multiply(Quaternion4f.fromAxisAngle(1, 0, 0, (float) Math.toRadians(cutOff)));

    // Calculate position/speed
    p.position = cone.getPosition().clone();
    p.speed = rot.rotate(new Vector3f(0, 0, speed));
  }
    public void onDrawFrame(GL10 gl) {
      // 清除深度缓冲与颜色缓冲
      GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

      // 保护现场
      MatrixState.pushMatrix();
      MatrixState.translate(0, 0, -10);
      if (drawWhatFlag) {
        cone.drawSelf();
      } else {
        conel.drawSelf();
      }
      MatrixState.popMatrix();
    }
  public static String getLineXY(Cone cone, Cylinder cylinder) {
    double a1 = cylinder.getX();
    double a2 = cone.getX();
    double b1 = cylinder.getY();
    double b2 = cone.getY();
    double c2 = cone.getC();
    double r1 = cylinder.getR();
    double r2 = cone.getR();

    double x, y, z1, z2, s;
    x = 2 * (a2 - a1);
    y = 2 * (b2 - b1);
    z2 = (r2 * r2) / (c2 * c2);
    z1 = 2 * r2 * r2 / c2;
    s = r1 * r1 - r2 * r2 - a1 * a1 + a2 * a2 - b1 * b1 + b2 * b2;

    double xy, xz2, xz1, xs;
    xy = -y / x;
    xz2 = -z2 / x;
    xz1 = z1 / x;
    xs = s / x;

    return formulaToString("x = ", "y", xz2, xz1, xy, xs);
  }
  public static double[][] getTableZX(Cone cone, Cylinder cylinder, int count) {
    double a1 = cylinder.getX();
    double a2 = cone.getX();
    double b1 = cylinder.getY();
    double b2 = cone.getY();
    double c1 = cylinder.getC();
    double c2 = cone.getC();
    double r1 = cylinder.getR();
    double r2 = cone.getR();

    double x, z1, z2, s;
    x = 2 * (a2 - a1);
    z2 = (r2 * r2) / (c2 * c2);
    z1 = 2 * r2 * r2 / c2;
    s = r1 * r1 - r2 * r2 - a1 * a1 + a2 * a2 - b1 * b1 + b2 * b2;

    double xz2, xz1, xs;
    xz2 = -z2 / x;
    xz1 = z1 / x;
    xs = s / x;

    double coneLeftX = a2 + r2;
    double coneRightX = a2 - r2;
    double cylinderLeftX = a1 + r1;
    double cylinderRightX = a1 - r1;

    double leftX = min(coneLeftX, cylinderLeftX);
    double rightX = max(coneRightX, cylinderRightX);

    double z0 = 0;
    double maxZ = 0; // min(c1,c2);

    if (cylinderLeftX >= coneRightX && a2 >= cylinderLeftX) {
      maxZ = equationByTwoPoints(leftX, a2, c2, coneRightX, 0); // r
    }

    if (coneLeftX >= cylinderRightX && cylinderRightX >= a2) {
      maxZ = equationByTwoPoints(rightX, a2, c2, coneLeftX, 0); // l
    }

    if (coneLeftX >= cylinderLeftX && cylinderLeftX >= a2) {
      maxZ = equationByTwoPoints(leftX, a2, c2, coneLeftX, 0); // l
    }

    if (a2 >= cylinderRightX && cylinderRightX >= coneRightX) {
      maxZ = equationByTwoPoints(rightX, a2, c2, coneRightX, 0); // r
    }

    if (coneLeftX >= cylinderLeftX
        && cylinderLeftX >= a2
        && a2 > cylinderRightX
        && cylinderRightX > coneRightX) {

      z0 = equationByTwoPoints(rightX, a2, c2, coneRightX, 0); // r
      maxZ = equationByTwoPoints(leftX, a2, c2, coneLeftX, 0); // l
      maxZ -= z0;
    }

    if (a2 >= cylinderLeftX
        && a2 >= cylinderRightX
        && cylinderLeftX >= coneRightX
        && cylinderRightX >= coneRightX) {
      z0 = equationByTwoPoints(rightX, a2, c2, coneRightX, 0); // r
      maxZ = equationByTwoPoints(leftX, a2, c2, coneRightX, 0); // r
      maxZ -= z0;
    }

    if (coneLeftX >= cylinderLeftX
        && coneLeftX >= cylinderRightX
        && cylinderLeftX >= a2
        && cylinderRightX >= a2) {
      z0 = equationByTwoPoints(leftX, a2, c2, coneLeftX, 0); // l
      maxZ = equationByTwoPoints(rightX, a2, c2, coneLeftX, 0); // l
      maxZ -= z0;
    }

    double dZ = maxZ / count;
    double z = z0;

    double[][] result = new double[count + 1][2];

    for (int i = 0; i < count + 1; i++) {
      double x1 = xz2 * z * z + xz1 * z + xs;
      result[i][0] = z;
      result[i][1] = x1;
      z += dZ;
    }

    return result;
  }
Example #9
0
  public void plot(AbstractDrawer draw, Color c) {
    if (!visible) return;

    int cor = 0;
    for (int j = 0; j < z.length; j++) {
      if (j < z.length / 2) {
        color = new Color(0, j * (255 / (z.length / 2)), 255);
        cor = j;
      } else {
        color = new Color(255, cor * (255 / (z.length / 2)), 0);
        cor = (cor == 0) ? cor : cor - 1;
      }

      Cone _cone = new Cone(k, color);
      double h = height - j * 0.1;
      double r = ratio * (h / height); // semelhança de triangulos

      for (int i = 0; i < k + 1; i++) {
        _cone.setCone(i, r * Math.cos(i * theta), r * Math.sin(i * theta), z[j]);
      }
      listCone.add(j, _cone);
    }
    // Para saber se a visão do gráfico é superior, basta saber se screenCoord[1] <= 333. Do
    // contrário, estamos vendo o gráfico por baixo.
    int[] screenCoord = draw.project(new double[] {-1, -1, -1});

    if (screenCoord[1] <= 333) {
      for (int i = 1; i < listCone.size(); i++) {
        for (int j = 1; j < k + 1; j++) {
          draw.setColor(listCone.get(i).getColor());
          draw.fillPolygon(
              1.0f,
              new double[] {
                listCone.get(i).getX(j), listCone.get(i).getY(j), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i).getX(j - 1), listCone.get(i).getY(j - 1), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i - 1).getX(j - 1),
                listCone.get(i - 1).getY(j - 1),
                listCone.get(i - 1).getZ(j - 1)
              },
              new double[] {
                listCone.get(i - 1).getX(j),
                listCone.get(i - 1).getY(j),
                listCone.get(i - 1).getZ(j - 1)
              });

          draw.setColor(new Color(0, 0, 0));
          draw.drawPolygon(
              new double[] {
                listCone.get(i).getX(j), listCone.get(i).getY(j), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i).getX(j - 1), listCone.get(i).getY(j - 1), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i - 1).getX(j - 1),
                listCone.get(i - 1).getY(j - 1),
                listCone.get(i - 1).getZ(j - 1)
              },
              new double[] {
                listCone.get(i - 1).getX(j),
                listCone.get(i - 1).getY(j),
                listCone.get(i - 1).getZ(j - 1)
              });
        }
      }

    } else {
      for (int i = listCone.size() - 1; i > 0; i--) {
        for (int j = 1; j < k + 1; j++) {
          draw.setColor(listCone.get(i).getColor());
          draw.fillPolygon(
              1.0f,
              new double[] {
                listCone.get(i).getX(j), listCone.get(i).getY(j), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i).getX(j - 1), listCone.get(i).getY(j - 1), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i - 1).getX(j - 1),
                listCone.get(i - 1).getY(j - 1),
                listCone.get(i - 1).getZ(j - 1)
              },
              new double[] {
                listCone.get(i - 1).getX(j),
                listCone.get(i - 1).getY(j),
                listCone.get(i - 1).getZ(j - 1)
              });

          draw.setColor(new Color(0, 0, 0));
          draw.drawPolygon(
              new double[] {
                listCone.get(i).getX(j), listCone.get(i).getY(j), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i).getX(j - 1), listCone.get(i).getY(j - 1), listCone.get(i).getZ(j)
              },
              new double[] {
                listCone.get(i - 1).getX(j - 1),
                listCone.get(i - 1).getY(j - 1),
                listCone.get(i - 1).getZ(j - 1)
              },
              new double[] {
                listCone.get(i - 1).getX(j),
                listCone.get(i - 1).getY(j),
                listCone.get(i - 1).getZ(j - 1)
              });
        }
      }
    }
    listCone.clear();
  }
Example #10
0
    public AppFrame() {
      // Add detail hint slider panel
      this.getControlPanel().add(makeDetailHintControlPanel(), BorderLayout.SOUTH);

      RenderableLayer layer = new RenderableLayer();

      // Create and set an attribute bundle.
      ShapeAttributes attrs = new BasicShapeAttributes();
      attrs.setInteriorMaterial(Material.YELLOW);
      attrs.setInteriorOpacity(0.7);
      attrs.setEnableLighting(true);
      attrs.setOutlineMaterial(Material.RED);
      attrs.setOutlineWidth(2d);
      attrs.setDrawInterior(true);
      attrs.setDrawOutline(false);

      // Create and set an attribute bundle.
      ShapeAttributes attrs2 = new BasicShapeAttributes();
      attrs2.setInteriorMaterial(Material.PINK);
      attrs2.setInteriorOpacity(1);
      attrs2.setEnableLighting(true);
      attrs2.setOutlineMaterial(Material.WHITE);
      attrs2.setOutlineWidth(2d);
      attrs2.setDrawOutline(false);

      // ********* sample  Cones  *******************

      // Cone with equal axes, ABSOLUTE altitude mode
      Cone cone3 = new Cone(Position.fromDegrees(40, -120, 80000), 100000, 50000);
      cone3.setAltitudeMode(WorldWind.ABSOLUTE);
      cone3.setAttributes(attrs);
      cone3.setVisible(true);
      cone3.setValue(AVKey.DISPLAY_NAME, "Cone with equal axes, ABSOLUTE altitude mode");
      layer.addRenderable(cone3);

      // Cone with equal axes, RELATIVE_TO_GROUND
      Cone cone4 = new Cone(Position.fromDegrees(37.5, -115, 50000), 50000, 50000, 50000);
      cone4.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone4.setAttributes(attrs);
      cone4.setVisible(true);
      cone4.setValue(AVKey.DISPLAY_NAME, "Cone with equal axes, RELATIVE_TO_GROUND altitude mode");
      layer.addRenderable(cone4);

      // Cone with equal axes, CLAMP_TO_GROUND
      Cone cone5 = new Cone(Position.fromDegrees(35, -110, 50000), 50000, 50000, 50000);
      cone5.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
      cone5.setAttributes(attrs);
      cone5.setVisible(true);
      cone5.setValue(AVKey.DISPLAY_NAME, "Cone with equal axes, CLAMP_TO_GROUND altitude mode");
      layer.addRenderable(cone5);

      // Cone with a texture, using Cone(position, height, radius) constructor
      Cone cone9 = new Cone(Position.fromDegrees(0, -90, 600000), 1200000, 600000);
      cone9.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone9.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      cone9.setAttributes(attrs);
      cone9.setVisible(true);
      cone9.setValue(AVKey.DISPLAY_NAME, "Cone with a texture");
      layer.addRenderable(cone9);

      // Scaled Cone with default orientation
      Cone cone = new Cone(Position.ZERO, 1000000, 500000, 100000);
      cone.setAltitudeMode(WorldWind.ABSOLUTE);
      cone.setAttributes(attrs);
      cone.setVisible(true);
      cone.setValue(AVKey.DISPLAY_NAME, "Scaled Cone with default orientation");
      layer.addRenderable(cone);

      // Scaled Cone with a pre-set orientation
      Cone cone2 =
          new Cone(
              Position.fromDegrees(0, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      cone2.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone2.setAttributes(attrs2);
      cone2.setValue(AVKey.DISPLAY_NAME, "Scaled Cone with a pre-set orientation");
      cone2.setVisible(true);

      layer.addRenderable(cone2);

      // Scaled Cone with a pre-set orientation
      Cone cone6 =
          new Cone(
              Position.fromDegrees(30, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      cone6.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone6.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      cone6.setAttributes(attrs2);
      cone6.setValue(AVKey.DISPLAY_NAME, "Scaled Cone with a pre-set orientation");
      cone6.setVisible(true);
      layer.addRenderable(cone6);

      // Scaled Cone with a pre-set orientation
      Cone cone7 =
          new Cone(
              Position.fromDegrees(60, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      cone7.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone7.setAttributes(attrs2);
      cone7.setVisible(true);
      cone7.setValue(AVKey.DISPLAY_NAME, "Scaled Cone with a pre-set orientation");
      layer.addRenderable(cone7);

      // Scaled, oriented Cone in 3rd "quadrant" (-X, -Y, -Z)
      Cone cone8 =
          new Cone(
              Position.fromDegrees(-45, -180, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      cone8.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone8.setAttributes(attrs2);
      cone8.setVisible(true);
      cone8.setValue(
          AVKey.DISPLAY_NAME, "Scaled, oriented Cone in the 3rd 'quadrant' (-X, -Y, -Z)");
      layer.addRenderable(cone8);

      // Add the layer to the model.
      insertBeforeCompass(getWwd(), layer);
    }
Example #11
0
    protected void makeShapes() {
      RenderableLayer layer = new RenderableLayer();
      layer.setName("Rigid Shapes");

      // Create and set an attribute bundle.
      ShapeAttributes attrs = new BasicShapeAttributes();
      attrs.setInteriorMaterial(Material.YELLOW);
      attrs.setInteriorOpacity(0.7);
      attrs.setEnableLighting(true);
      attrs.setOutlineMaterial(Material.RED);
      attrs.setOutlineWidth(2d);
      attrs.setDrawInterior(true);
      attrs.setDrawOutline(false);

      // Create and set a second attribute bundle.
      ShapeAttributes attrs2 = new BasicShapeAttributes();
      attrs2.setInteriorMaterial(Material.PINK);
      attrs2.setInteriorOpacity(1);
      attrs2.setEnableLighting(true);
      attrs2.setOutlineMaterial(Material.WHITE);
      attrs2.setOutlineWidth(2d);
      attrs2.setDrawOutline(false);

      // Pyramid with equal axes, ABSOLUTE altitude mode.
      Pyramid pyramid = new Pyramid(Position.fromDegrees(40, -120, 220000), 200000, 200000, 200000);
      pyramid.setAltitudeMode(WorldWind.ABSOLUTE);
      pyramid.setAttributes(attrs);
      pyramid.setValue(AVKey.DISPLAY_NAME, "Pyramid with equal axes, ABSOLUTE altitude mode");
      layer.addRenderable(pyramid);

      // Cone with equal axes, RELATIVE_TO_GROUND.
      Cone cone = new Cone(Position.fromDegrees(37.5, -115, 200000), 200000, 200000, 200000);
      cone.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cone.setAttributes(attrs);
      cone.setValue(AVKey.DISPLAY_NAME, "Cone with equal axes, RELATIVE_TO_GROUND altitude mode");
      layer.addRenderable(cone);

      // Wedge with equal axes, CLAMP_TO_GROUND.
      Wedge wedge =
          new Wedge(
              Position.fromDegrees(35, -110, 200000),
              Angle.fromDegrees(225),
              200000,
              200000,
              200000);
      wedge.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
      wedge.setAttributes(attrs);
      wedge.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, CLAMP_TO_GROUND altitude mode");
      layer.addRenderable(wedge);

      // Box with a texture.
      Box box = new Box(Position.fromDegrees(0, -90, 600000), 600000, 600000, 600000);
      box.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ArrayList<Object> imageSources = new ArrayList<Object>();
      imageSources.add("images/32x32-icon-nasa.png");
      imageSources.add(null);
      imageSources.add("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      imageSources.add(null);
      imageSources.add("images/64x64-crosshair.png");
      imageSources.add(null);
      box.setImageSources(imageSources);
      box.setAttributes(attrs);
      box.setValue(AVKey.DISPLAY_NAME, "Box with a texture");
      layer.addRenderable(box);

      // Sphere with a texture.
      Ellipsoid sphere =
          new Ellipsoid(Position.fromDegrees(0, -110, 600000), 600000, 600000, 600000);
      sphere.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      sphere.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      sphere.setAttributes(attrs);
      sphere.setValue(AVKey.DISPLAY_NAME, "Sphere with a texture");
      layer.addRenderable(sphere);

      // Cylinder with a texture.
      Cylinder cylinder =
          new Cylinder(Position.fromDegrees(0, -130, 600000), 600000, 600000, 600000);
      cylinder.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      cylinder.setImageSources(
          "gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      cylinder.setAttributes(attrs);
      cylinder.setValue(AVKey.DISPLAY_NAME, "Cylinder with a texture");
      layer.addRenderable(cylinder);

      // Cylinder with default orientation.
      cylinder = new Cylinder(Position.ZERO, 600000, 500000, 300000);
      cylinder.setAltitudeMode(WorldWind.ABSOLUTE);
      cylinder.setAttributes(attrs);
      cylinder.setValue(AVKey.DISPLAY_NAME, "Cylinder with default orientation");
      layer.addRenderable(cylinder);

      // Ellipsoid with a pre-set orientation.
      Ellipsoid ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(0, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation");
      layer.addRenderable(ellipsoid);

      // Ellipsoid with a pre-set orientation.
      ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(30, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setImageSources(
          "gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png");
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation");
      layer.addRenderable(ellipsoid);

      // Ellipsoid with a pre-set orientation.
      ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(60, 30, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation");
      layer.addRenderable(ellipsoid);

      // Ellipsoid oriented in 3rd "quadrant" (-X, -Y, -Z).
      ellipsoid =
          new Ellipsoid(
              Position.fromDegrees(-45, -180, 750000),
              1000000,
              500000,
              100000,
              Angle.fromDegrees(90),
              Angle.fromDegrees(45),
              Angle.fromDegrees(30));
      ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
      ellipsoid.setAttributes(attrs2);
      ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid oriented in 3rd \"quadrant\" (-X, -Y, -Z)");
      layer.addRenderable(ellipsoid);

      // Add the layer to the model and update the layer panel.
      insertBeforePlacenames(getWwd(), layer);
    }