|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.mesh.Terrain
public class Terrain
Implementation of a 2D grid based heightfield with basic intersection
features and conversion to TriangleMesh
. The terrain is always
located in the XZ plane with the positive Y axis as up vector.
Constructor Summary | |
---|---|
Terrain(int width,
int depth,
float scale)
Constructs a new and initially flat terrain of the given size in the XZ plane, centred around the world origin. |
Method Summary | |
---|---|
int |
getDepth()
|
float |
getHeightAtCell(int x,
int z)
|
float |
getHeightAtPoint(float x,
float z)
Computes the elevation of the terrain at the given 2D world coordinate (based on current terrain scale). |
int |
getWidth()
|
IsectData3D |
intersectAtPoint(float x,
float z)
Computes the 3D position (with elevation) and normal vector at the given 2D location in the terrain. |
Terrain |
setElevation(float[] elevation)
Sets the elevation of all cells to those of the given array values. |
Terrain |
setHeightAtCell(int x,
int z,
float h)
Sets the elevation for a single given grid cell. |
Mesh3D |
toMesh()
|
Mesh3D |
toMesh(float groundLevel)
|
Mesh3D |
toMesh(Mesh3D mesh)
Creates a TriangleMesh instance of the terrain surface or adds
its geometry to an existing mesh. |
Mesh3D |
toMesh(Mesh3D mesh,
float groundLevel)
Creates a TriangleMesh instance of the terrain and constructs
side panels and a bottom plane to form a fully enclosed mesh volume, e.g. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Terrain(int width, int depth, float scale)
width
- depth
- scale
- Method Detail |
---|
public int getDepth()
public float getHeightAtCell(int x, int z)
x
- z
-
public float getHeightAtPoint(float x, float z)
x
- scaled world coord xz
- scaled world coord z
public int getWidth()
public IsectData3D intersectAtPoint(float x, float z)
IsectData3D
instance.
x
- z
-
public Terrain setElevation(float[] elevation)
elevation
- array of height values
public Terrain setHeightAtCell(int x, int z, float h)
x
- z
- h
- new elevation value
public Mesh3D toMesh()
public Mesh3D toMesh(float groundLevel)
public Mesh3D toMesh(Mesh3D mesh)
TriangleMesh
instance of the terrain surface or adds
its geometry to an existing mesh.
mesh
-
public Mesh3D toMesh(Mesh3D mesh, float groundLevel)
TriangleMesh
instance of the terrain and constructs
side panels and a bottom plane to form a fully enclosed mesh volume, e.g.
suitable for CNC fabrication or 3D printing. The bottom plane will be
created at the given ground level (can also be negative) and the sides
are extended downward to that level too.
mesh
- existing mesh or nullgroundLevel
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |