## com.bbn.openmap.tools.terrain
Class LOSGenerator

    java.lang.Object
      com.bbn.openmap.tools.terrain.LOSGenerator

public class LOSGenerator
extends java.lang.Object

A Class that can do Line-Of-Sight calculations between two points. Uses the DTEDFrameCache to get elevations.

Field Summary
`protected int` `INVISIBLE`
`protected int` `MAYBEVISIBLE`
`protected int` `VISIBLE`

Constructor Summary
`LOSGenerator()` Not the preferred way to create one of these.
`LOSGenerator(DTEDFrameCache cache)`

Method Summary
`double` `calculateLOSSlope(int startTotalHeight, int endTotalHeight, float arc_dist)` Calculate the slope of a line between two points across a spherical model of the earth.
`double` `calculateLOSSlope(LatLonPoint startLLP, int startTotalHeight, LatLonPoint endLLP, int endObjHeight)` CalculateLOSslope figures out the slope from one point to another.
`DTEDFrameCache` `getDtedCache()`
`boolean` `isLOS(LatLonPoint startLLP, int startObjHeight, LatLonPoint endLLP, int endObjHeight, int numPoints)` Check to see if two points are within line of sight of each other, taking into account their elevations above Mean Sea Level as retrieved by a DTED database, and any other addition height of each object.
`void` `setDtedCache(DTEDFrameCache cache)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INVISIBLE

    protected int INVISIBLE

### VISIBLE

    protected int VISIBLE

### MAYBEVISIBLE

    protected int MAYBEVISIBLE

Constructor Detail

### LOSGenerator

    public LOSGenerator()

  Not the preferred way to create one of these. It's full of defaults.

### LOSGenerator

    public LOSGenerator(DTEDFrameCache cache)

Method Detail

### setDtedCache

    public void setDtedCache(DTEDFrameCache cache)

### getDtedCache

    public DTEDFrameCache getDtedCache()

### isLOS

    public boolean isLOS(LatLonPoint startLLP,
                         int startObjHeight,
                         LatLonPoint endLLP,
                         int endObjHeight,
                         int numPoints)

  Check to see if two points are within line of sight of each other, taking into account their elevations above Mean Sea Level as retrieved by a DTED database, and any other addition height of each object.

  Parameters:
    `startLLP` - location of point 1.
    `startObjHeight` - the elevation of point 1 above the surface, in meters. The surface elevation of the point will be looked up and added to this value.
    `endLLP` - location of point 2.
    `endObjHeight` - the elevation of point 2 above the surface, in meters. The surface elevation of the point will be looked up and added to this value.
    `numPoints` - number of sample points to check between the two end points. Can be dependent on the Projection of the current map, and based on the number of pixels between the projected points. Could also be based on the number of elevation posts between the two points in the DTED database.
  Returns:
    true of their is a line-of-sight path between the two points.

### calculateLOSSlope

    public double calculateLOSSlope(LatLonPoint startLLP,
                                    int startTotalHeight,
                                    LatLonPoint endLLP,
                                    int endObjHeight)

  CalculateLOSslope figures out the slope from one point to another. The arc_dist is in radians, and is the radian arc distance of the point from the center point of the image, on the earth. This slope calculation does take the earth's curvature into account, based on the spherical model. The slope returned is the angle from the end point to the beginning point, relative to the vertical of the end point to the center of the earth - i.e. starting at the axis pointing straight down into the earth, how many radians do you have to angle up until you hit the starting point.

  Parameters:
    `startLLP` - the coordinates of point 1.
    `startTotalHeight` - the total height of point 1, from the Mean Sea Level - so it's the elevation of the point plus altitude above the surface, in meters.
    `endLLP` - the coordinates of point 2.
    `endObjHeight` - the elevation of point 2 above the surface, in meters. The surface elevation of the point will be looked up and added to this value.
  Returns:
    slope of line between the two points, with zero pointing straight down, in radians.

### calculateLOSSlope

    public double calculateLOSSlope(int startTotalHeight,
                                    int endTotalHeight,
                                    float arc_dist)

  Calculate the slope of a line between two points across a spherical model of the earth.

  Parameters:
    `startTotalHeight` - total height of one point, in meters. Should represent elevation of point which is the surface elevation above MSL, and the height above the surface.
    `endTotalHeight` - total height of one the other point, in meters. Should represent elevation of point which is the surface elevation above MSL, and the height above the surface.
    `arc_dist` - the surface angle, in radians, across the spherical model of the earth that separates the two points.

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details