Package gaiasky.util.gaia.utils
Class Place
- java.lang.Object
-
- gaiasky.util.gaia.utils.Place
-
public class Place extends java.lang.Object
Specifies a celestial position
-
-
Field Summary
Fields Modifier and Type Field Description protected double
alpha
protected double
delta
protected Vector3d
dirICRS
protected boolean
haveAngles
-
Constructor Summary
Constructors Constructor Description Place()
Default constructor.Place(double rightAscension, double declination)
Constructs a Place at given (alpha, delta)Place(Place p)
Duplicates a PlacePlace(Vector3d r)
Constructs a Place at the position given by a vector (need not be a unit vector)Place(java.util.Random rnd)
Constructs a Place at a random position
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
calcAngles()
Internal conversion from direction to (alpha, delta)double
getAlpha()
Returns the right ascension [rad] of the Placedouble
getAngleTo(Place p)
Calculates the angle between this Place and another Placedouble
getDelta()
Returns the declination [rad] of the PlaceVector3d
getDirection()
Returns the unit vector of the PlacePlace
moveToRandom(java.util.Random rnd)
Moves the current Place to a random positionPlace
moveToRandom(java.util.Random rnd, Place centre, double radius)
Moves the current Place to a random position within a certain radius of a given Place.Place
setAngles(double rightAscension, double declination)
Sets the position of the Place to given (alpha, delta)Place
setDirection(Vector3d r)
Sets the position of the Place to that of a given vector (need not be a unit vector)java.lang.String
toString()
-
-
-
Field Detail
-
dirICRS
protected Vector3d dirICRS
-
haveAngles
protected boolean haveAngles
-
alpha
protected double alpha
-
delta
protected double delta
-
-
Constructor Detail
-
Place
public Place()
Default constructor. Puts the Place at (alpha, delta ) = (0, 0)
-
Place
public Place(Vector3d r)
Constructs a Place at the position given by a vector (need not be a unit vector)- Parameters:
r
- vector
-
Place
public Place(double rightAscension, double declination)
Constructs a Place at given (alpha, delta)- Parameters:
rightAscension
-declination
-
-
Place
public Place(java.util.Random rnd)
Constructs a Place at a random position- Parameters:
rnd
- Random number generator
-
Place
public Place(Place p)
Duplicates a Place- Parameters:
p
-
-
-
Method Detail
-
getDirection
public Vector3d getDirection()
Returns the unit vector of the Place- Returns:
- vector
-
getAlpha
public double getAlpha()
Returns the right ascension [rad] of the Place- Returns:
- The right ascension in radians
-
getDelta
public double getDelta()
Returns the declination [rad] of the Place- Returns:
- The declination in radians
-
setAngles
public Place setAngles(double rightAscension, double declination)
Sets the position of the Place to given (alpha, delta)- Parameters:
rightAscension
-declination
-
-
setDirection
public Place setDirection(Vector3d r)
Sets the position of the Place to that of a given vector (need not be a unit vector)- Parameters:
r
- vector
-
getAngleTo
public double getAngleTo(Place p)
Calculates the angle between this Place and another Place- Parameters:
p
- the other Place- Returns:
- angle between them [rad]
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
moveToRandom
public Place moveToRandom(java.util.Random rnd)
Moves the current Place to a random position
-
moveToRandom
public Place moveToRandom(java.util.Random rnd, Place centre, double radius)
Moves the current Place to a random position within a certain radius of a given Place.
-
calcAngles
protected void calcAngles()
Internal conversion from direction to (alpha, delta)
-
-