Examples of VectorXYZ


Examples of org.osm2world.core.math.VectorXYZ

    }
   
    @Override
    public void renderTo(Target<?> target) {
     
      VectorXYZ startLeft = getEleConnectors().getPosXYZ(
          startPos.subtract(cutVector.mult(0.5 * startWidth)));
      VectorXYZ startRight = getEleConnectors().getPosXYZ(
          startPos.add(cutVector.mult(0.5 * startWidth)));
     
      VectorXYZ endLeft = getEleConnectors().getPosXYZ(
          endPos.subtract(cutVector.mult(0.5 * endWidth)));
      VectorXYZ endRight = getEleConnectors().getPosXYZ(
          endPos.add(cutVector.mult(0.5 * endWidth)));
     
      /* determine surface material */
     
      Material surface = getSurfaceForNode(node);
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

        GeometryUtil.equallyDistributePointsAlong(
          stepLength, true, startWithOffset, endWithOffset);
     
      List<VectorXYZ> stepBorderPositions = new ArrayList<VectorXYZ>();
      for (VectorXZ posXZ : stepBorderPositionsXZ) {
        VectorXYZ posXYZ = interpolateElevation(posXZ,
            centerline.get(0),
            centerline.get(centerline.size() - 1));
        stepBorderPositions.add(posXYZ);
      }
     
      /* draw steps */
     
      for (int step = 0; step < stepBorderPositions.size() - 1; step++) {
       
        VectorXYZ frontCenter = stepBorderPositions.get(step);
        VectorXYZ backCenter = stepBorderPositions.get(step+1);
       
        double height = abs(frontCenter.y - backCenter.y);
               
        VectorXYZ center = (frontCenter.add(backCenter)).mult(0.5);
        center = center.subtract(Y_UNIT.mult(0.5 * height));
       
        VectorXZ faceDirection = segment.getDirection();
        if (frontCenter.y < backCenter.y) {
          //invert if upwards
          faceDirection = faceDirection.invert();
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

        GeometryUtil.equallyDistributePointsAlong(
          stepLength, true, startWithOffset, endWithOffset);
     
      List<VectorXYZ> stepBorderPositions = new ArrayList<VectorXYZ>();
      for (VectorXZ posXZ : stepBorderPositionsXZ) {
        VectorXYZ posXYZ = interpolateElevation(posXZ,
            centerline.get(0),
            centerline.get(centerline.size() - 1));
        stepBorderPositions.add(posXYZ);
      }
     
      /* draw steps */
     
      for (int step = 0; step < stepBorderPositions.size() - 1; step++) {
       
        VectorXYZ frontCenter = stepBorderPositions.get(step);
        VectorXYZ backCenter = stepBorderPositions.get(step+1);
       
        double height = abs(frontCenter.y - backCenter.y);
               
        VectorXYZ center = (frontCenter.add(backCenter)).mult(0.5);
        center = center.subtract(Y_UNIT.mult(0.5 * height));
       
        VectorXZ faceDirection = segment.getDirection();
        if (frontCenter.y < backCenter.y) {
          //invert if upwards
          faceDirection = faceDirection.invert();
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

       
      for (int triangle = 0; triangle < vertices.size() / 3; triangle++) {
       
        int i = triangle * 3 + 1;
       
        VectorXYZ vBefore = vertices.get(i-1);
        VectorXYZ vAt = vertices.get(i);
        VectorXYZ vAfter = vertices.get(i+1);
       
        VectorXYZ toBefore = vBefore.subtract(vAt);
        VectorXYZ toAfter = vAfter.subtract(vAt);
       
        normals[i] = toBefore.crossNormalized(toAfter);
       
        normals[i-1] = normals[i];
        normals[i+1] = normals[i];
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

   
    for (int triangle = 0; triangle < vertices.size() - 2; triangle++) {
     
      int i = triangle + 1;
     
      VectorXYZ vBefore = vertices.get( fan ? 0 : (i-1) );
      VectorXYZ vAt = vertices.get(i);
      VectorXYZ vAfter = vertices.get(i+1);
     
      VectorXYZ toBefore = vBefore.subtract(vAt);
      VectorXYZ toAfter = vAfter.subtract(vAt);
     
      if (triangle % 2 == 0 || fan) {
        normals[i+1] = toBefore.crossNormalized(toAfter);
      } else {
        normals[i+1] = toAfter.crossNormalized(toBefore);
      }
     
    }
   
    normals[0] = normals[2];
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

    }
   
    /* calculate sum of relevant normals,
     * normalize it and set the result as normal for the vertex */

    VectorXYZ normal = new VectorXYZ(0, 0, 0);
    for (VectorXYZ addNormal : relevantNormals) {
      normal = normal.add(addNormal);
    }

    return normal.normalize();

  }
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

     
      if (relativePosition < 0 || relativePosition > 1) {
        System.out.println("PROBLEM");
      }
     
      VectorXYZ roadPoint = road.getPointOnCut(start, relativePosition);
     
      return roadPoint.add(0, getHeightAboveRoad(), 0);
     
    }
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

     
      if (relativePosition < 0 || relativePosition > 1) {
        System.out.println("PROBLEM");
      }
     
      VectorXYZ roadPoint = road.getPointOnCut(start, relativePosition);
     
      return roadPoint.add(0, getHeightAboveRoad(), 0);
     
    }
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

     
      double accumulatedLength = forward ? totalLength : 0;
     
      for (int i = 0; i < vs.size(); i++) {
       
        VectorXYZ v = vs.get(i);
       
        // increase accumulated length after every second vector
       
        if (i > 0 && i % 2 == 0) {
         
          double segmentLength = v.xz().distanceTo(vs.get(i-2).xz());
         
          if (forward) {
            accumulatedLength -= segmentLength;
          } else {
            accumulatedLength += segmentLength;
          }
         
        }
       
        // determine width of the lane at that point
       
        double width = (i % 2 == 0)
            ? v.distanceTo(vs.get(i+1))
            : v.distanceTo(vs.get(i-1));
       
        // determine whether this vertex should get the higher or
        // lower t coordinate from the vertex pair
       
        boolean higher = i % 2 == 0;
View Full Code Here

Examples of org.osm2world.core.math.VectorXYZ

     
      double accumulatedLength = forward ? totalLength : 0;
     
      for (int i = 0; i < vs.size(); i++) {
       
        VectorXYZ v = vs.get(i);
       
        // increase accumulated length after every second vector
       
        if (i > 0 && i % 2 == 0) {
         
          double segmentLength = v.xz().distanceTo(vs.get(i-2).xz());
         
          if (forward) {
            accumulatedLength -= segmentLength;
          } else {
            accumulatedLength += segmentLength;
          }
         
        }
       
        // determine width of the lane at that point
       
        double width = (i % 2 == 0)
            ? v.distanceTo(vs.get(i+1))
            : v.distanceTo(vs.get(i-1));
       
        // determine whether this vertex should get the higher or
        // lower t coordinate from the vertex pair
       
        boolean higher = i % 2 == 0;
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.