sidnet.core.misc
Class Location2D

java.lang.Object
  extended by sidnet.core.misc.Location2D

public class Location2D
extends java.lang.Object


Constructor Summary
Location2D(double xpos, double ypos)
          Creates a new instance of Location
Location2D(Location2D fromLocation, LocationContext fromLocationContext, LocationContext toLocationContext)
           
 
Method Summary
static double angleDeg(Location2D p1, Location2D p2, Location2D p3)
          Returns the angle [in degrees -180 : + 180] made in between [p1-p2] & [p2-p3] segments
static double angleRad(Location2D p1, Location2D p2, Location2D p3)
          Returns the angle [in radians] made in between [p1-p2] & [p2-p3] segments
static Location2D convertTo(Location2D loc, LocationContext sourceLocationContext, LocationContext targetLocationContext)
          Converts the indicated location according to the target locationContext
 Location2D convertTo(LocationContext sourceLocationContext, LocationContext targetLocationContext)
          Converts the current location according to the target locationContext
 double distanceTo(Location2D toLocation)
          Calculates the distance between the current Location2D and the specified Location2D
 double getX()
          getter method.
 double getY()
          getter method.
 double norm()
          Returns euclidean distance from origin
 void setX(double x)
          setter method.
 void setY(double y)
          setter method.
static double slope(Location2D p1, Location2D p2)
          Returns the slope of the line segment [p1-p2]
 NCS_Location2D toNCS(LocationContext locationContext)
          Converts the current represented locations to NCS (Normalized Coordinate System)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Location2D

public Location2D(double xpos,
                  double ypos)
Creates a new instance of Location


Location2D

public Location2D(Location2D fromLocation,
                  LocationContext fromLocationContext,
                  LocationContext toLocationContext)
Method Detail

setX

public void setX(double x)
setter method. Sets the X-coordinate


setY

public void setY(double y)
setter method. Sets the Y-coordinate


getX

public double getX()
getter method. Gets the X-coordinate


getY

public double getY()
getter method. gets the Y-coordinate


toNCS

public NCS_Location2D toNCS(LocationContext locationContext)
Converts the current represented locations to NCS (Normalized Coordinate System)

Parameters:
LocationContext - the locationContext based on which the NCS can be obtained

convertTo

public static Location2D convertTo(Location2D loc,
                                   LocationContext sourceLocationContext,
                                   LocationContext targetLocationContext)
Converts the indicated location according to the target locationContext


convertTo

public Location2D convertTo(LocationContext sourceLocationContext,
                            LocationContext targetLocationContext)
Converts the current location according to the target locationContext


distanceTo

public double distanceTo(Location2D toLocation)
Calculates the distance between the current Location2D and the specified Location2D


angleRad

public static double angleRad(Location2D p1,
                              Location2D p2,
                              Location2D p3)
Returns the angle [in radians] made in between [p1-p2] & [p2-p3] segments


angleDeg

public static double angleDeg(Location2D p1,
                              Location2D p2,
                              Location2D p3)
Returns the angle [in degrees -180 : + 180] made in between [p1-p2] & [p2-p3] segments


slope

public static double slope(Location2D p1,
                           Location2D p2)
Returns the slope of the line segment [p1-p2]


norm

public double norm()
Returns euclidean distance from origin