Package org.osm2world.core.math

Examples of org.osm2world.core.math.VectorXZ


  }
 
  @Test
  public void testInsertVertexInPolygonOutline() {
   
    VectorXZ point = new VectorXZ(0.55f, 0.55f);
   
    List<VectorXZ> newOutline = new LinkedList<VectorXZ>(outlineA);
   
    EarClippingTriangulationUtil.insertVertexInPolygonOutline(newOutline, point);
   
View Full Code Here


   
    while (itr1.hasNext()) {
   
      TriangleXYZ triangle = itr1.next();
      VectorXYZ normal = triangle.getNormal();
      VectorXZ tex1 = itr2.next();
      VectorXZ tex2 = itr2.next();
      VectorXZ tex3 = itr2.next();
   
      append(INDENT);
   
      if (depth > 0) {
     
View Full Code Here

   
    @Override
    public void renderTo(Target<?> target) {
     
      double directionAngle = parseDirection(node.getTags(), PI);
      VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);
     
      Material roofMaterial = null;
      Material poleMaterial = null;
      Type type = null;
     
View Full Code Here

   
    @Override
    public void renderTo(Target<?> target) {
     
      double directionAngle = parseDirection(node.getTags(), PI);
      VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);
     
      Material machineMaterial = null;
      Material poleMaterial = STEEL;
      Type type = null;
     
      if (node.getTags().contains("vending", "bicycle_tube") && node.getTags().containsAny("operator", asList("Continental", "continental"))){
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, Color.ORANGE );
      } else if(node.getTags().contains("vending", "bicycle_tube")){
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, Color.BLUE );
      } else if(node.getTags().contains("vending", "cigarettes")){
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, new Color(0.8f, 0.73f, 0.5f));
      } else if(node.getTags().contains("vending", "condoms")){
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, new Color(0.39f, 0.15f, 0.11f) );
      }
     
      // get Type of vending machine
      if(isInWall(node)){
        type = Type.WALL;
      } else {
        type =  Type.PILLAR;
      }
     
      // default dimensions will differ depending on the post box type
      float height = 0f;
     
      switch(type) {
        case WALL:
         
          break;
        case PILLAR:
          height = parseHeight(node.getTags(), 1.8f);
         
          target.drawBox(poleMaterial,
              getBase().add(new VectorXYZ(0,0, -0.05).rotateY(faceVector.angle())),
              faceVector, height-0.3, 0.1, 0.1);
          target.drawBox(machineMaterial,
              getBase().addY(height-1).add(new VectorXYZ(0,0, 0.1 ).rotateY(directionAngle)),
              faceVector, 1, 1, 0.2);
         
View Full Code Here

      avgX += node.getPos().x / nodeCount; // need to divide before
                          // numbers get too large
      avgZ += node.getPos().z / nodeCount;
    }

    return new VectorXZ(avgX, avgZ);

  }
View Full Code Here

   
    @Override
    public void renderTo(Target<?> target) {
     
      double directionAngle = parseDirection(node.getTags(), PI);
      VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);
     
      Material boxMaterial = null;
      Material poleMaterial = null;
      Type type = null;
     
     
      // post boxes differ widely in appearance, hence we draw them only for known operators or brands
      if (node.getTags().containsAny(asList("operator", "brand"), asList("Deutsche Post AG", "Deutsche Post"))) {
        boxMaterial = POSTBOX_DEUTSCHEPOST;
        poleMaterial = STEEL;
        type = Type.WALL;
      } else if (node.getTags().contains("operator", "Royal Mail")) {
        boxMaterial = POSTBOX_ROYALMAIL;
        type = Type.PILLAR;
      } else {
        //no rendering, unknown operator or brand for post box //TODO log info
        return;
      }
     
      assert (type != Type.WALL || poleMaterial != null) : "post box of type wall requires a pole material";
     
      // default dimensions will differ depending on the post box type
      float height = 0f;
      float width = 0f;
     
      switch(type) {
        case WALL:
          height = parseHeight(node.getTags(), 0.8f);
          width = parseWidth(node.getTags(), 0.3f);
         
          target.drawBox(poleMaterial,
            getBase(),
            faceVector, height, 0.08, 0.08);
         
          target.drawBox(boxMaterial,
            getBase().add(faceVector.mult(width/2 - 0.08/2)).addY(height),
            faceVector, width, width, width);
          break;
        case PILLAR:
          height = parseHeight(node.getTags(), 2f);
          width = parseWidth(node.getTags(), 0.5f);
View Full Code Here

       
        Material poleMaterial = STEEL;
       
        double directionAngle = parseDirection(node.getTags(), PI);
       
        VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);
       
        target.drawColumn(poleMaterial, null,
          getBase(),
          height-signHeight, 0.05, 0.05, true, true);
        /* draw sign */
 
View Full Code Here

   * moves pos and lookAt forward in the map plane
   * @param step  units to move forward
   */
  public void moveMapForward(double step) {
    VectorXYZ d = getViewDirection();
    VectorXZ md = new VectorXZ(d.x, d.z).normalize();
    move(md.x * step, 0, md.z * step);
  }
 
View Full Code Here

   *
   * @param step  units to move right, negative units move to the left
   */
  public void moveMapRight(double step) {
    VectorXYZ right = getRight();
    VectorXZ md = new VectorXZ(right.x, right.z).normalize();
    move(md.x * step, 0, md.z * step);
  }
 
View Full Code Here

      double directionAngle = parseDirection(node.getTags(), PI);
     
      Material boxMaterial = POSTBOX_DEUTSCHEPOST;
      Material otherMaterial = STEEL;
     
      VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);
      VectorXZ rightVector = faceVector.rightNormal();
     
      // shape depends on type
      if (node.getTags().contains("type", "Rondell")) {
       
        float height = parseHeight(node.getTags(), 2.2f);
        float width = parseWidth(node.getTags(), 3f);
        float rondelWidth  = width * 2/3;
        float boxWidth     = width * 1/3;
        float roofOverhang = 0.3f;
       
        /* draw rondel */
        target.drawColumn(boxMaterial, null,
          getBase().add(rightVector.mult(-rondelWidth/2)),
          height,  rondelWidth/2, rondelWidth/2, false, true);
        /* draw box */
        target.drawBox(boxMaterial,
          getBase().add(rightVector.mult(boxWidth/2)).add(faceVector.mult(-boxWidth/2)),
          faceVector, height, boxWidth, boxWidth);
        /* draw roof */
        target.drawColumn(otherMaterial, null,
          getBase().addY(height),
          0.1, rondelWidth/2 + roofOverhang/2, rondelWidth/2 + roofOverhang/2, true, true);
View Full Code Here

TOP

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

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.