Modifier and Type | Field and Description |
---|---|
static Vector |
HEIGHTFIELD_HALF_SIZE |
static Vector |
HEIGHTFIELD_SIZE |
static double |
TRACK_WIDTH
Width in meters of the inner (i.e.
|
static double |
UNPASSABLE_HEIGHT
Terrain above this height is unpassable.
|
Constructor and Description |
---|
RacetrackHeightfield(long randomSeed,
Vector center) |
Modifier and Type | Method and Description |
---|---|
void |
drawLandscape(ArenaController arenaController,
javax.media.opengl.GL gl,
java.awt.geom.Rectangle2D.Double visibleArea)
Draws this
Landscape for the given area |
java.awt.image.BufferedImage |
generateHeightfieldImage(int widthInPixel,
int heightInPixel)
generates the height field
|
Vector |
getBoundingBoxMax() |
Vector |
getBoundingBoxMin() |
double |
getHeight(double positionX,
double positionY) |
double |
getHeight(Vector position) |
java.awt.Color |
getHeightfieldImageBorderColor() |
Vector |
getHeightGradient(Vector position)
accesses the heightmap to determine the gradient
|
double |
getLapProgress(Vector position)
Assigns a progress to any point in the landscape.
|
Vector |
getStartAndFinishLineBegin()
The start-and-finish line that this function returns, spans the entire
width of the road (only the asphalt part).
|
Vector |
getStartAndFinishLineEnd()
The start-and-finish line that this function returns, spans the entire
width of the road (only the asphalt part).
|
TerrainType |
getTerrainType(Vector position)
Assigns a terrain type to any point in the landscape.
|
Vector |
getTrackPositionAt(double trackPctRelative)
gives a point inside the track
|
public static final Vector HEIGHTFIELD_HALF_SIZE
public static final Vector HEIGHTFIELD_SIZE
public static final double TRACK_WIDTH
public static final double UNPASSABLE_HEIGHT
TODO transform to SI units [m]
public RacetrackHeightfield(long randomSeed, Vector center)
randomSeed
- center
- - can be null
for randompublic void drawLandscape(ArenaController arenaController, javax.media.opengl.GL gl, java.awt.geom.Rectangle2D.Double visibleArea)
Landscape
Landscape
for the given areadrawLandscape
in interface Landscape
arenaController
- - for drawingvisibleArea
- - area to drawpublic java.awt.image.BufferedImage generateHeightfieldImage(int widthInPixel, int heightInPixel)
Racetrack
generateHeightfieldImage
in interface Racetrack
public Vector getBoundingBoxMax()
getBoundingBoxMax
in interface Racetrack
Racetrack.generateHeightfieldImage(int, int)
.public Vector getBoundingBoxMin()
getBoundingBoxMin
in interface Racetrack
Racetrack.generateHeightfieldImage(int, int)
.public double getHeight(double positionX, double positionY)
public double getHeight(Vector position)
public java.awt.Color getHeightfieldImageBorderColor()
getHeightfieldImageBorderColor
in interface Racetrack
public Vector getHeightGradient(Vector position)
Racetrack
getHeightGradient
in interface Racetrack
public double getLapProgress(Vector position)
Racetrack
getLapProgress
in interface Racetrack
position
- [m]; global axes and coordspublic Vector getStartAndFinishLineBegin()
getStartAndFinishLineBegin
in interface Racetrack
public Vector getStartAndFinishLineEnd()
getStartAndFinishLineEnd
in interface Racetrack
public TerrainType getTerrainType(Vector position)
Landscape
getTerrainType
in interface Landscape
position
- [m]; global axes and coordsTerrainType
public Vector getTrackPositionAt(double trackPctRelative)
Racetrack
getTrackPositionAt
in interface Racetrack
trackPctRelative
- - relative track progress [0;1[