Package org.osm2world.core.math

Examples of org.osm2world.core.math.VectorXYZ


        setup();
      }
     
      for (int i = 0; i < startPos.size(); i++) {

        VectorXYZ start = startPos.get(i);
        VectorXYZ end = endPos.get(i);
       
        double lenToEnd = end.distanceToXZ(start);
        double heightDiff = end.y - start.y;

        double stepSize = lenToEnd / INTERPOLATION_STEPS;
        VectorXZ dir = end.xz().subtract(start.xz()).normalize();
       
        List<VectorXYZ> path = new ArrayList<VectorXYZ>();
        for (int x = 0; x <= INTERPOLATION_STEPS; x++) {
          double ratio = x / INTERPOLATION_STEPS;
         
View Full Code Here


    // TODO we're missing the ceramics to hold the power lines

    @Override
    public void renderTo(Target<?> target) {

      VectorXYZ base = getBase().addY(-0.5);
      double height = parseHeight(node.getTags(), 14);

      Material material = Materials.getSurfaceMaterial(node.getTags().getValue("material"));
      if (material == null) {
        material = Materials.getSurfaceMaterial(node.getTags().getValue("surface"), Materials.STEEL);
      }
     
      // draw base column
      target.drawColumn(material, null, base, height, 0.5, 0.25, true, true);
     
      // draw cross "column"
      target.drawBox(material, base.add(0, height, 0), config.direction, 0.25, 5, 0.25);
   
      // draw pieces holding the power lines
      base = base.add(0, height + 0.25, 0);
      target.drawColumn(Materials.CONCRETE, null, base.add(config.direction.rightNormal().mult(2)), 0.5, 0.1, 0.1, true, true);
      target.drawColumn(Materials.CONCRETE, null, base.add(config.direction.rightNormal().mult(-2)), 0.5, 0.1, 0.1, true, true);
      if (config.cables >= 3) {
        target.drawColumn(Materials.CONCRETE, null, base, 0.5, 0.1, 0.1, true, true);
      }
      if (config.cables >= 5) {
        target.drawColumn(Materials.CONCRETE, null, base.add(config.direction.rightNormal().mult(1.5)), -0.5, 0.1, 0.1, true, true);
        target.drawColumn(Materials.CONCRETE, null, base.add(config.direction.rightNormal().mult(-1.5)), -0.5, 0.1, 0.1, true, true);
      }
    }
View Full Code Here

     
      /* draw circumcircles around most recently added point */
           
      if (!points.isEmpty()) {
     
        VectorXYZ p = points.get(points.size() - 1);
             
        g.setColor(Color.GREEN);
       
        for (DelaunayTriangle t : triangulation.getIncidentTriangles(p)) {
 
          VectorXZ center = t.getCircumcircleCenter();
          double radius = t.p0.distanceToXZ(center);
       
          draw(g, center);
          drawCircle(g, center, radius);
                   
        }
       
      }
             
      /* draw triangles */
     
      g.setColor(Color.RED);
     
      for (DelaunayTriangle triangle : triangulation.getTriangles()) {
        draw(g, triangle.asTriangleXZ());
      }
           
      /* draw points */
     
      g.setColor(Color.BLACK);
     
      for (VectorXYZ p : points) {
        draw(g, p.xz());
      }
     
      /* draw click data */
     
      if (probePos != null) {
View Full Code Here

  }
 
  private static void drawVectorAt(JOGLTarget target,
      Color color, VectorXZ vector, MapNode start) {
   
    VectorXYZ startV = start.getPos().xyz(0);
    VectorXYZ endV = startV.add(vector);
   
    drawArrow(target, color, 0.3f * (float)vector.length(), startV, endV);
   
  }
View Full Code Here

            Math.min(1.0f, 2.0f / depth), 0.0f);
       
        if (innerNode.splitAlongX) {
         
          target.drawLineStrip(lineColor, 1,
              new VectorXYZ(innerNode.splitValue, 0, minZ),
              new VectorXYZ(innerNode.splitValue, 0, maxZ));
         
          renderNodeTo(innerNode.lowerChild, target,
              minX, innerNode.splitValue,
              minZ, maxZ,
              depth + 1);

          renderNodeTo(innerNode.upperChild, target,
              innerNode.splitValue, maxX,
              minZ, maxZ,
              depth + 1);
         
        } else {
         
          target.drawLineStrip(lineColor, 1,
              new VectorXYZ(minX, 0, innerNode.splitValue),
              new VectorXYZ(maxX, 0, innerNode.splitValue));
         
          renderNodeTo(innerNode.lowerChild, target,
              minX, maxX,
              minZ, innerNode.splitValue,
              depth + 1);
View Full Code Here

          FLAT_NORMALS_COLOR : SMOOTH_NORMALS_COLOR;
     
      for (Primitive primitive : primitiveBuffer.getPrimitives(material)) {
       
        for (int i = 0; i < primitive.vertices.size(); i++) {
          VectorXYZ v = primitive.vertices.get(i);
          VectorXYZ n = primitive.normals.get(i);
          if (n != null) {
            drawArrow(target, color, 0.3f, v, v.add(n));
          }
        }
       
View Full Code Here

      for (int z = (int)floor(bound.minZ / LINE_DIST); z < (int)ceil(bound.maxZ / LINE_DIST); z++) {
       
        Color colorX = (z == 0 && x >= 0) ? RED : WHITE;
        int widthX = (z == 0) ? 3 : 1;
        target.drawLineStrip(colorX, widthX,
            new VectorXYZ(x * LINE_DIST, 0, z * LINE_DIST),
            new VectorXYZ((x+1) * LINE_DIST, 0, z * LINE_DIST));

        Color colorZ = (x == 0 && z >= 0) ? BLUE : WHITE;
        int widthZ = (x == 0) ? 3 : 1;
        target.drawLineStrip(colorZ, widthZ,
            new VectorXYZ(x * LINE_DIST, 0, z * LINE_DIST),
            new VectorXYZ(x * LINE_DIST, 0, (z+1) * LINE_DIST));
       
      }
    }
   
    target.drawLineStrip(GREEN, 3,
        VectorXYZ.NULL_VECTOR, new VectorXYZ(0, LINE_DIST, 0));
   
  }
View Full Code Here

  }

  protected static final void drawBoxAround(JOGLTarget target,
      VectorXYZ center, Color color, float halfWidth) {
    drawBox(target, color,
      new VectorXYZ(center.x - halfWidth,
        center.y,
        center.z - halfWidth),
      new VectorXYZ(center.x - halfWidth,
        center.y,
        center.z + halfWidth),
      new VectorXYZ(center.x + halfWidth,
        center.y,
        center.z + halfWidth),
      new VectorXYZ(center.x + halfWidth,
        center.y,
        center.z - halfWidth));
  }
View Full Code Here

   
    target.drawLineStrip(color, 1, vs);
   
    /* draw head */
   
    VectorXYZ lastV = VectorXYZ.xyz(vs[vs.length-1]);
    VectorXYZ slastV = VectorXYZ.xyz(vs[vs.length-2]);
   
    VectorXYZ endDir = lastV.subtract(slastV).normalize();
    VectorXYZ headStart = lastV.subtract(endDir.mult(headLength));
   
    VectorXZ endDirXZ = endDir.xz();
    if (endDirXZ.lengthSquared() < 0.01) { //(almost) vertical vector
      endDirXZ = VectorXZ.X_UNIT;
    } else {
      endDirXZ = endDirXZ.normalize();
    }
    VectorXZ endNormalXZ = endDirXZ.rightNormal();
   
   
    ImmutableMaterial colorMaterial =
        new ImmutableMaterial(Lighting.FLAT, color);
   
    target.drawTriangleStrip(colorMaterial, asList(
        lastV,
        headStart.subtract(endDirXZ.mult(headLength/2)),
        headStart.add(endDirXZ.mult(headLength/2))),
        null);
   
    target.drawTriangleStrip(colorMaterial, asList(
        lastV,
        headStart.subtract(endNormalXZ.mult(headLength/2)),
        headStart.add(endNormalXZ.mult(headLength/2))),
        null);
   
  }
View Full Code Here

          base2.getPosXYZ());
     
      double dist1 = base1.pos.distanceTo(upper.pos);
      double dist2 = base2.pos.distanceTo(upper.pos);
     
      VectorXYZ base = interpolateBetween(
          base1.getPosXYZ(),
          base2.getPosXYZ(),
          dist1 / (dist1 + dist2));
     
      target.drawLineStrip(MIN_VDIST_COLOR, 2,
          base,
          upper.getPosXYZ());
     
      drawArrow(target, MIN_VDIST_COLOR,
          (float) (distance / 2),
          base,
          base.addY(distance));
     
    }
View Full Code Here

TOP

Related Classes of org.osm2world.core.math.VectorXYZ

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.