edu.d.umn.geometry
Class LODSegment

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Group
              extended by javax.media.j3d.TransformGroup
                  extended by edu.d.umn.geometry.LODSegment

public class LODSegment
extends javax.media.j3d.TransformGroup

LOD segment is based on a TransformGroup. Each LODSegment is actually comprised of three ElevationSegments, each created with a different resolution. Switch and DistanceLOD objects are used to determine which of the three to render (based on how far away it is from the viewing platform). This speeds up rendering and allows real-time fly throughs of the scene.


Field Summary
 
Fields inherited from class javax.media.j3d.TransformGroup
ALLOW_TRANSFORM_READ, ALLOW_TRANSFORM_WRITE
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
LODSegment(int[][] elevations, int startRow, int startColumn, int stopRow, int stopColumn, int minEl, int maxEl, float exageration, float minX, float maxX, float minZ, float maxZ, float modelWidth, float modelLength)
          Constructor is for creating the series of objects that allow level of detail based on distance displays.
 
Method Summary
 void changeExageration(float oldAmount, float newAmount)
          Loops through the ElevationSegments and calls their changeExageration method.
 float getElevationAt(float x, float z)
          Fetches the elevation at a particular location on the terrain map given the x,z coordinates.
 ElevationSegment getSegment(int i)
          retrieves an elevation segment object
 void recalcNormals()
          Recalculates the normal values so that the lighting effects change when the elevation exageration change.
 void setColor(java.awt.Color color)
           
 void setTexture(javax.media.j3d.Texture2D tex)
          Loops through the ElevationSegments and calls their setTexture method.
 void stitchRight(LODSegment other)
          stitch right of this segment to left of other segment, stitching consists of averaging the normals on the common boundary vertices between segments.
 void stitchTop(LODSegment other)
          stitch top of this segment to bottom of other segment, stitching consists of averaging the normals on the common boundary vertices between segments.
 
Methods inherited from class javax.media.j3d.TransformGroup
cloneNode, getTransform, setTransform
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, insertChild, moveTo, numChildren, removeAllChildren, removeChild, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LODSegment

public LODSegment(int[][] elevations,
                  int startRow,
                  int startColumn,
                  int stopRow,
                  int stopColumn,
                  int minEl,
                  int maxEl,
                  float exageration,
                  float minX,
                  float maxX,
                  float minZ,
                  float maxZ,
                  float modelWidth,
                  float modelLength)
Constructor is for creating the series of objects that allow level of detail based on distance displays.

Parameters:
modelWidth - The width of the ElevationModel to which this segment belongs.
modelLength - The length of the ElevationModel to which this segment belongs.
elevations - two dimensional array of terrain elevation data in meters
startRow - first row of data to use from elevations
startColumn - first column of data to use from elevations
stopRow - last row of data to use from elevations
stopColumn - last column of data to use from elevations
minEl - minimum elevation in elevations
maxEl - maximum elevation in elevations
exageration - amount to exagerate(multiply) elevations by
minX - starting x coordinate in meters
maxX - stopping x coordinate in meters
minZ - starting z coordinate in meters
maxZ - stopping z coordinate in meters
Method Detail

getSegment

public ElevationSegment getSegment(int i)
retrieves an elevation segment object

Parameters:
i - index of the segment desired
Returns:
reference to the ith ElevationSegment object

stitchRight

public void stitchRight(LODSegment other)
stitch right of this segment to left of other segment, stitching consists of averaging the normals on the common boundary vertices between segments. That is, since adjacent segments have the same vertices in common (the left side of one is the same as the right side of the other), then these normals should be the same as well to prevent visible seams.

Parameters:
other - reference to the segment to the right of this one

stitchTop

public void stitchTop(LODSegment other)
stitch top of this segment to bottom of other segment, stitching consists of averaging the normals on the common boundary vertices between segments. That is, since adjacent segments have the same vertices in common (the top of one is the same as the bottom of the other), then these normals should be the same as well to prevent visible seams.

Parameters:
other - reference to the segment to the right of this one

getElevationAt

public float getElevationAt(float x,
                            float z)
Fetches the elevation at a particular location on the terrain map given the x,z coordinates. X,Z coordinates represent the distance in meters from the center of the terrain image

Parameters:
x - x coordinate
z - z coordinate
Returns:
the elevation (y coordinate) in meters (adjusted for exageration)

setTexture

public void setTexture(javax.media.j3d.Texture2D tex)
Loops through the ElevationSegments and calls their setTexture method.

Parameters:
tex - The new texture to apply.

changeExageration

public void changeExageration(float oldAmount,
                              float newAmount)
Loops through the ElevationSegments and calls their changeExageration method.

Parameters:
oldAmount - The old exageration value. Used to reset to natural exageration.
newAmount - The desired exageration amount.

recalcNormals

public void recalcNormals()
Recalculates the normal values so that the lighting effects change when the elevation exageration change.


setColor

public void setColor(java.awt.Color color)