本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.RotationConvention类的典型用法代码示例。如果您正苦于以下问题:Java RotationConvention类的具体用法?Java RotationConvention怎么用?Java RotationConvention使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RotationConvention类属于org.apache.commons.math3.geometry.euclidean.threed包,在下文中一共展示了RotationConvention类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toCamera
import org.apache.commons.math3.geometry.euclidean.threed.RotationConvention; //导入依赖的package包/类
/**
* Transform this horizontal coordinate to the camera frame for the given pointing position and focal length.
*
* @param pointingPosition Pointing of the telescope
* @param focalLength focalLength of the telescope
* @return coordinate transformed into the camera frame
*/
public CameraCoordinate toCamera(HorizontalCoordinate pointingPosition, double focalLength) {
double paz = pointingPosition.getAzimuthRad();
double pzd = pointingPosition.getZenithRad();
double saz = this.getAzimuthRad();
double szd = this.getZenithRad();
Vector3D vec = new Vector3D(Math.sin(szd) * Math.cos(saz), Math.sin(szd) * Math.sin(saz), Math.cos(szd));
Rotation rotZAz = new Rotation(new Vector3D(0.0, 0.0, 1.0), -paz, RotationConvention.VECTOR_OPERATOR);
Rotation rotYZd = new Rotation(new Vector3D(0.0, 1.0, 0.0), -pzd, RotationConvention.VECTOR_OPERATOR);
Vector3D rotVec = rotYZd.applyTo(rotZAz.applyTo(vec));
double x = rotVec.getX();
double y = rotVec.getY();
double z = rotVec.getZ();
CameraCoordinate cameraCoordinate = new CameraCoordinate(x * (focalLength) / z, y * (focalLength) / z);
return cameraCoordinate;
}
示例2: createRegularPolygonVertices
import org.apache.commons.math3.geometry.euclidean.threed.RotationConvention; //导入依赖的package包/类
/** Build the vertices representing a regular polygon.
* @param center center of the polygon (the center is in the inside half)
* @param meridian point defining the reference meridian for first polygon vertex
* @param outsideRadius distance of the vertices to the center
* @param n number of sides of the polygon
* @return vertices array
*/
private static S2Point[] createRegularPolygonVertices(final Vector3D center, final Vector3D meridian,
final double outsideRadius, final int n) {
final S2Point[] array = new S2Point[n];
final Rotation r0 = new Rotation(Vector3D.crossProduct(center, meridian),
outsideRadius, RotationConvention.VECTOR_OPERATOR);
array[0] = new S2Point(r0.applyTo(center));
final Rotation r = new Rotation(center, MathUtils.TWO_PI / n, RotationConvention.VECTOR_OPERATOR);
for (int i = 1; i < n; ++i) {
array[i] = new S2Point(r.applyTo(array[i - 1].getVector()));
}
return array;
}
示例3: toHorizontal
import org.apache.commons.math3.geometry.euclidean.threed.RotationConvention; //导入依赖的package包/类
/**
* Transform this CameraCoordinate from camera frame to telescope (horizontal coordinates) frame
* for the given PointingPosition.
*
* @param pointingPosition the telescope's pointing position
* @param focalLength the focal length of the telescope
* @return the camera coordinate transformed into the horizontal coordinate frame
*/
public HorizontalCoordinate toHorizontal(HorizontalCoordinate pointingPosition, double focalLength) {
double paz = pointingPosition.getAzimuthRad();
double pzd = pointingPosition.getZenithRad();
double z = 1 / Math.sqrt(1 + Math.pow(xMM / focalLength, 2.0) + Math.pow(yMM / focalLength, 2.0));
double x = xMM * z / focalLength;
double y = yMM * z / focalLength;
Vector3D vec = new Vector3D(x, y, z);
Rotation rotZAz = new Rotation(new Vector3D(0.0, 0.0, 1.0), -paz, RotationConvention.VECTOR_OPERATOR);
Rotation rotYZd = new Rotation(new Vector3D(0.0, 1.0, 0.0), -pzd, RotationConvention.VECTOR_OPERATOR);
Vector3D rotVec = rotZAz.applyInverseTo(rotYZd.applyInverseTo(vec));
double zenith = Math.acos(rotVec.getZ());
double azimuth = Math.atan2(rotVec.getY(), rotVec.getX());
return HorizontalCoordinate.fromRad(zenith, azimuth);
}