Examples of VectorXZ


Examples of org.osm2world.core.math.VectorXZ

     
      super(area);
     
      /* check whether a pin has been explicitly mapped */
     
      VectorXZ explicitPinPosition = null;
     
      for (MapOverlap<?, ?> overlap : area.getOverlaps()) {
       
        MapElement other = overlap.getOther(area);
       
        if (other.getTags().contains("golf","pin")
            && other instanceof MapNode) {
         
          explicitPinPosition = ((MapNode)other).getPos();
         
          break;
         
        }
       
      }
     
      /* place an implicit pin if none has been mapped */
     
      if (explicitPinPosition != null) {
       
        pinPosition = explicitPinPosition;
       
      } else {
       
        pinPosition = area.getOuterPolygon().getCenter();
       
      }
       
      /* create circle around the hole */
       
      List<VectorXZ> holeRing = new ArrayList<VectorXZ>(HOLE_CIRCLE_VERTICES);
     
      for (int i = 0; i < HOLE_CIRCLE_VERTICES; i++) {
        VectorXZ direction = fromAngle(2 * PI * ((double)i / HOLE_CIRCLE_VERTICES));
        VectorXZ vertex = pinPosition.add(direction.mult(HOLE_RADIUS));
        holeRing.add(vertex);
      }
     
      holeRing.add(holeRing.get(0));
     
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

      double posZ = box.minZ;
     
      while (posZ + upVector.z < box.maxZ) {
       
        LineSegmentXZ rowLine = new LineSegmentXZ(
             new VectorXZ(box.minX - 10, posZ),
             new VectorXZ(box.maxX + 10, posZ));
       
        // calculate start and end points (maybe more than one each)
       
        List<VectorXZ> intersections =
            area.getPolygon().intersectionPositions(rowLine);
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

      boolean addToLowerChild = false;
      boolean addToUpperChild = false;
     
      for (MapNode node : getMapNodes(element)) {
       
        VectorXZ pos = node.getPos();
       
        if (splitAlongX) {
       
          addToLowerChild |= pos.x <= splitValue;
          addToUpperChild |= pos.x >= splitValue;
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

      boolean addToLowerChild = false;
      boolean addToUpperChild = false;
     
      for (MapNode node : getMapNodes(element)) {
       
        VectorXZ pos = node.getPos();
       
        if (splitAlongX) {
         
          addToLowerChild |= pos.x <= splitValue;
          addToUpperChild |= pos.x >= splitValue;
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

  @Override
  public void actionPerformed(ActionEvent e) {

    MapData mapData = data.getConversionResults().getMapData();

    VectorXZ camLookAt = mapData.getCenter();

    renderOptions.camera = new Camera();
    renderOptions.camera.setCamera(camLookAt.x, 1000, camLookAt.z-1000,
                                       camLookAt.x, 0, camLookAt.z);
   
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

    //calculate t so that intersection is at pointA+t*directionA
    //TODO: why this formula?
    double t = (amcZ*directionB.x - amcX*directionB.z)*denom;

    return new VectorXZ(
        pointA.x + t * directionA.x,
        pointA.z + t * directionA.z);
       
  }
 
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

    //calculate s so that intersection is at pointB1+t*q
    double s = (amcz*vx - amcx*vz)*denom;
    if( s < 0 || s > 1 ) { return null; }
   
    return new VectorXZ(
        pointA1.x + t * vx,
        pointA1.z + t * vz);
   
  }
 
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

   * of the line segment; the interpolated point for a parameter
   * of 0.25 would be 1/4 of the distance between pos1 and pos2
   * away from pos1.
   */
  public static VectorXZ interpolateBetween(VectorXZ pos1, VectorXZ pos2, double influenceRatioPos2) {
    return new VectorXZ(
        pos1.x * (1-influenceRatioPos2) + pos2.x * influenceRatioPos2,
        pos1.z * (1-influenceRatioPos2) + pos2.z * influenceRatioPos2);
  }
 
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

    if (numSegments == 0) {
      return new ArrayList<VectorXZ>(0);
    }
           
    double pointDistance = lineLength / numSegments;
    VectorXZ pointDiff = lineEnd.subtract(lineStart).normalize().mult(pointDistance);
       
    int numPoints = pointsAtStartAndEnd ? numSegments + 1 : numSegments;
    List<VectorXZ> result = new ArrayList<VectorXZ>(numPoints);
   
    /* create the points, starting with the first and basing each on the previous */
   
    VectorXZ mostRecentPoint = pointsAtStartAndEnd ?
        lineStart :
        lineStart.add(pointDiff.mult(0.5f));
   
    result.add(mostRecentPoint);

    for (int point = 1; point < numPoints; point ++) {
     
      mostRecentPoint = mostRecentPoint.add(pointDiff);
      result.add(mostRecentPoint);
           
    }
   
    return result;
View Full Code Here

Examples of org.osm2world.core.math.VectorXZ

        for (int i = 0; i < POINTS_PER_BOX; ++i) {
         
          double x = box.minX + boxSize * rand.nextDouble();
          double z = box.minZ + boxSize * rand.nextDouble();
         
          VectorXZ v = new VectorXZ(x, z);
         
          if (polygonWithHolesXZ.contains(v)) {
           
            //TODO: check minimumDistance
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.