|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.geometry.euclidean.threed.SphericalCoordinates
public class SphericalCoordinates
This class provides conversions related to spherical coordinates.
The conventions used here are the mathematical ones, i.e. spherical coordinates are related to Cartesian coordinates as follows:
r is the radius, θ is the azimuthal angle in the x-y plane and Φ is the polar (co-latitude) angle. These conventions are different from the conventions used in physics (and in particular in spherical harmonics) where the meanings of θ and Φ are reversed.
This class provides conversion of coordinates and also of gradient and Hessian between spherical and Cartesian coordinates.
Nested Class Summary | |
---|---|
private static class |
SphericalCoordinates.DataTransferObject
Internal class used only for serialization. |
Field Summary | |
---|---|
private double[][] |
jacobian
Jacobian of (r, θ &Phi). |
private double |
phi
Polar angle (co-latitude) Φ. |
private double[][] |
phiHessian
Hessian of polar (co-latitude) angle Φ. |
private double |
r
Radius. |
private double[][] |
rHessian
Hessian of radius. |
private static long |
serialVersionUID
Serializable UID. |
private double |
theta
Azimuthal angle in the x-y plane θ. |
private double[][] |
thetaHessian
Hessian of azimuthal angle in the x-y plane θ. |
private Vector3D |
v
Cartesian coordinates. |
Constructor Summary | |
---|---|
SphericalCoordinates(double r,
double theta,
double phi)
Build a spherical coordinates transformer from spherical coordinates. |
|
SphericalCoordinates(Vector3D v)
Build a spherical coordinates transformer from Cartesian coordinates. |
Method Summary | |
---|---|
private void |
computeHessians()
Lazy evaluation of Hessians. |
private void |
computeJacobian()
Lazy evaluation of (r, θ, φ) Jacobian. |
Vector3D |
getCartesian()
Get the Cartesian coordinates. |
double |
getPhi()
Get the polar (co-latitude) angle. |
double |
getR()
Get the radius. |
double |
getTheta()
Get the azimuthal angle in x-y plane. |
double[] |
toCartesianGradient(double[] sGradient)
Convert a gradient with respect to spherical coordinates into a gradient with respect to Cartesian coordinates. |
double[][] |
toCartesianHessian(double[][] sHessian,
double[] sGradient)
Convert a Hessian with respect to spherical coordinates into a Hessian with respect to Cartesian coordinates. |
private Object |
writeReplace()
Replace the instance with a data transfer object for serialization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private final Vector3D v
private final double r
private final double theta
private final double phi
private double[][] jacobian
private double[][] rHessian
private double[][] thetaHessian
private double[][] phiHessian
Constructor Detail |
---|
public SphericalCoordinates(Vector3D v)
v
- Cartesian coordinatespublic SphericalCoordinates(double r, double theta, double phi)
r
- radiustheta
- azimuthal angle in x-y planephi
- polar (co-latitude) angleMethod Detail |
---|
public Vector3D getCartesian()
public double getR()
getTheta()
,
getPhi()
public double getTheta()
getR()
,
getPhi()
public double getPhi()
getR()
,
getTheta()
public double[] toCartesianGradient(double[] sGradient)
sGradient
- gradient with respect to spherical coordinates
{df/dr, df/dθ, df/dΦ}
public double[][] toCartesianHessian(double[][] sHessian, double[] sGradient)
As Hessian are always symmetric, we use only the lower left part of the provided spherical Hessian, so the upper part may not be initialized. However, we still do fill up the complete array we create, with guaranteed symmetry.
sHessian
- Hessian with respect to spherical coordinates
{{d2f/dr2, d2f/drdθ, d2f/drdΦ},
{d2f/drdθ, d2f/dθ2, d2f/dθdΦ},
{d2f/drdΦ, d2f/dθdΦ, d2f/dΦ2}sGradient
- gradient with respect to spherical coordinates
{df/dr, df/dθ, df/dΦ}
private void computeJacobian()
private void computeHessians()
private Object writeReplace()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |