Package worldBuilder

Class TerrainEngine


  • public class TerrainEngine
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TerrainEngine​(Map map)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean abort()
      revert maps to last committed values
      boolean commit()
      make this heightMap official
      boolean exaggerate​(boolean[] selected, double zMultiple)
      exaggerate/compress delta Z for all points in a box
      boolean raise​(boolean[] selected, double deltaZ)
      raise or lower all points in a box
      boolean ridge​(double x0, double y0, double x1, double y1, double height, double r1, double r2, int shape1, int shape2)
      lay out a potentially asymmetric mountain/pit or ridge/valley
      boolean ridge​(double x0, double y0, double x1, double y1, double height, double radius, int shape)
      lay out a symmetric mountain/pit or ridge/valley
      boolean setIncoming​(MeshPoint p, double flux)
      set the incoming river flux for the specified MeshPoint
      boolean slope​(int axis, double inclination)
      impose a slope on the entire map
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TerrainEngine

        public TerrainEngine​(Map map)
    • Method Detail

      • slope

        public boolean slope​(int axis,
                             double inclination)
        impose a slope on the entire map
        Parameters:
        axis - (degrees: -180 - 180)
        inclination - (dy/dx)
      • raise

        public boolean raise​(boolean[] selected,
                             double deltaZ)
        raise or lower all points in a box
        Parameters:
        selected - ... per point selected/not booleans
        deltaZ - amount to add to each MeshPoint
      • exaggerate

        public boolean exaggerate​(boolean[] selected,
                                  double zMultiple)
        exaggerate/compress delta Z for all points in a box
        Parameters:
        selected - ... per point selected/not booleans
        deltaZ - amount to add to each MeshPoint
      • ridge

        public boolean ridge​(double x0,
                             double y0,
                             double x1,
                             double y1,
                             double height,
                             double radius,
                             int shape)
        lay out a symmetric mountain/pit or ridge/valley
        Parameters:
        x0 - one end x (map coordinate)
        y0 - one end y (map coordinate)
        x1 - other end x (map coordinate)
        y1 - other end y (map coordinate)
        height - height/depth (z units)
        radius - width/2 (x/y units)
        shape - from Parameters.CONICAL-CYLINDRICAL
        Returns:
        boolean (were any points relocated)
      • ridge

        public boolean ridge​(double x0,
                             double y0,
                             double x1,
                             double y1,
                             double height,
                             double r1,
                             double r2,
                             int shape1,
                             int shape2)
        lay out a potentially asymmetric mountain/pit or ridge/valley
        Parameters:
        x0 - one end x (map coordinate)
        y0 - one end y (map coordinate)
        x1 - other end x (map coordinate)
        y1 - other end y (map coordinate)
        height - height/depth (z units)
        r1 - top/right width/2 (x/y units)
        r2 - bot/left width/2 (x/y units)
        shape1 - top/right profile (from Parameters.CONICAL-CYLINDRICAL)
        shape2 - bot/left profile
        Returns:
        boolean (were any points relocated) NOTE A: MeshPoint.distanceLine() behaves badly when the line is of zero length or the point is beyond one of its end-points. Radius out from an end-point works out-side the end-points, but yields incorrectly small values for points between the two end-points. Thus it is important that we be able to distinguish these two cases so we can use the most appropriate distance formula. A point is in the end region if it is within R of an end-point, and beyond the separation distance from the other end-point. That separation distance ranges between sep and sqrt(sep^2 + radius^2) ... depending on how far away from the center line the point is. I am currently using the larger number for the test, but this means that distanceLine is being used in regions where it yields incorrect values ... resulting in radius inaccuracies outside the end-points.
      • setIncoming

        public boolean setIncoming​(MeshPoint p,
                                   double flux)
        set the incoming river flux for the specified MeshPoint
        Parameters:
        MeshPointoint - to be updated
        flux - for this MeshPoint
      • commit

        public boolean commit()
        make this heightMap official
      • abort

        public boolean abort()
        revert maps to last committed values