org.opensha.commons.geo
Class LocationVector

java.lang.Object
  extended by org.opensha.commons.geo.LocationVector

public class LocationVector
extends Object

This class encapsulates information describing a vector between two Locations. This vector is defined by the azimuth (bearing) from a point p1 to a point p2, and also by the horizontal and vertical separation between the points. Note that a LocationVector from point A to point B is not the complement of that from point B to A. Although the horizontal and vertical components will be the same, the azimuth will likely change by some value other than 180°.

Note: Although a LocationVector will function in any reference frame, the convention in seismology and that adopted in OpenSHA is for depth to be positive down.

Version:
$Id: LocationVector.java 9760 2012-12-05 18:32:55Z pmpowers $
Author:
Peter Powers, Sid Hellman, Steven W. Rock

Constructor Summary
LocationVector()
          Initializes a new LocationVector with azimuth and horizontal and vertical components all initialized to 0.
LocationVector(double azimuth, double horizontal, double vertical)
          Initializes a new LocationVector with the supplied values.
 
Method Summary
 boolean equals(Object obj)
           
 double getAzimuth()
          Returns the azimuth of this LocationVector in decimal degrees.
 double getAzimuthRad()
          Returns the azimuth of this LocationVector in radians.
 double getHorzDistance()
          Gets the horizontal component of this LocationVector.
 double getPlunge()
          Returns the angle (in decimal degrees) between this vector and the horizontal based on the current internal vertical and horizontal separation values.
 double getVertDistance()
          Gets the vertical component of this LocationVector.
 void reverse()
          Reverses the azimuth (to 'back-azimuth') and flips the sign of the vertical component of this LocationVector.
 void set(double azimuth, double horizontal, double vertical)
          Sets this LocationVector's internal fields to the supplied values.
 void setAzimuth(double azimuth)
          Sets the azimuth of this LocationVector.
 void setHorzDistance(double horizontal)
          Sets the horizontal component of this LocationVector.
 void setVertDistance(double vertical)
          Sets the vertical component of this LocationVector.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocationVector

public LocationVector()
Initializes a new LocationVector with azimuth and horizontal and vertical components all initialized to 0.


LocationVector

public LocationVector(double azimuth,
                      double horizontal,
                      double vertical)
Initializes a new LocationVector with the supplied values. Note that azimuth is expected in decimal degrees.

Parameters:
azimuth - value to set in decimal degrees
horizontal - component value to set
vertical - component value to set
Method Detail

set

public void set(double azimuth,
                double horizontal,
                double vertical)
Sets this LocationVector's internal fields to the supplied values. Note that azimuth is expected in decimal degrees.

Parameters:
azimuth - value to set in decimal degrees
horizontal - component value to set
vertical - component value to set

reverse

public void reverse()
Reverses the azimuth (to 'back-azimuth') and flips the sign of the vertical component of this LocationVector.


getAzimuth

public double getAzimuth()
Returns the azimuth of this LocationVector in decimal degrees.

Returns:
the azimuth value in decimal degrees
See Also:
getAzimuthRad()

getAzimuthRad

public double getAzimuthRad()
Returns the azimuth of this LocationVector in radians.

Returns:
the azimuth value in radians
See Also:
getAzimuth()

setAzimuth

public void setAzimuth(double azimuth)
Sets the azimuth of this LocationVector.

Parameters:
azimuth - value to set in decimal degrees

getPlunge

public double getPlunge()
Returns the angle (in decimal degrees) between this vector and the horizontal based on the current internal vertical and horizontal separation values. This method is intended for use at relatively short separations ( e.g. <eq; 200km) as it degrades at large distances where curvature is not considered. Note that positive angles are down, negative angles are up.

Returns:
the plunge of this vector

getVertDistance

public double getVertDistance()
Gets the vertical component of this LocationVector.

Returns:
the vertical component value in km

setVertDistance

public void setVertDistance(double vertical)
Sets the vertical component of this LocationVector.

Parameters:
vertical - component value to set in km

getHorzDistance

public double getHorzDistance()
Gets the horizontal component of this LocationVector.

Returns:
the horizontal component value in km

setHorzDistance

public void setHorzDistance(double horizontal)
Sets the horizontal component of this LocationVector.

Parameters:
horizontal - component value to set in km

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object