本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.Vector3D.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3D.getX方法的具体用法?Java Vector3D.getX怎么用?Java Vector3D.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.geometry.euclidean.threed.Vector3D
的用法示例。
在下文中一共展示了Vector3D.getX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toCamera
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的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: getSize
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public Vector3D getSize() {
Vector3D min = getMin();
Vector3D max = getMax();
return new Vector3D(max.getX() - min.getX(), max.getY() - min.getY(), max.getZ() - min.getZ());
}
示例3: adapt
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public static Location adapt(Vector3D v, World world) {
return new Location(world, v.getX(), v.getY(), v.getZ());
}
示例4: am2jme_vector
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
Vector3f am2jme_vector(Vector3D vecSim) {
if (vecSim == null)
return null;
return new Vector3f((float) vecSim.getX(), (float) vecSim.getY(), (float) vecSim.getZ());
}
示例5: setPosition
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public void setPosition(Vector3D dest) {
this.x = dest.getX();
this.y = dest.getY();
this.z = dest.getZ();
}
示例6: getRayIntersection
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public double[] getRayIntersection(Vector3D orig, Vector3D dir) {
// See http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-box-intersection
Vector3D invdir = new Vector3D(1.0f / dir.getX(), 1.0f / dir.getY(), 1.0f / dir.getZ());
int[] sign = { 0, 0, 0 };
sign[0] = invdir.getX() < 0 ? 1 : 0;
sign[1] = invdir.getY() < 0 ? 1 : 0;
sign[2] = invdir.getZ() < 0 ? 1 : 0;
double tmin, tmax, tymin, tymax, tzmin, tzmax;
Vector3D[] bounds = { min, max };
tmin = (bounds[sign[0]].getX() - orig.getX()) * invdir.getX();
tmax = (bounds[1 - sign[0]].getX() - orig.getX()) * invdir.getX();
tymin = (bounds[sign[1]].getY() - orig.getY()) * invdir.getY();
tymax = (bounds[1 - sign[1]].getY() - orig.getY()) * invdir.getY();
if (tmin > tymax || tymin > tmax)
return null;
if (tymin > tmin) {
tmin = tymin;
}
if (tymax < tmax) {
tmax = tymax;
}
tzmin = (bounds[sign[2]].getZ() - orig.getZ()) * invdir.getZ();
tzmax = (bounds[1 - sign[2]].getZ() - orig.getZ()) * invdir.getZ();
if (tmin > tzmax || tzmin > tmax)
return null;
if (tzmin > tmin) {
tmin = tzmin;
}
if (tzmax < tmax) {
tmax = tzmax;
}
double[] result = { tmin, tmax };
return result;
}
示例7: getSceneryMesh
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public static graphics.scenery.Mesh getSceneryMesh(Mesh mesh, LogService logService)
{
graphics.scenery.Mesh scMesh;
if (mesh != null) {
int numDimension = 3;
scMesh = new graphics.scenery.Mesh();
List<Facet> facets = mesh.getFacets();
float[] scVertices = new float[facets.size() * 3 * numDimension];
float[] scNormals = new float[facets.size() * 3 * numDimension];
float[] boundingBox = new float[]{Float.POSITIVE_INFINITY,Float.POSITIVE_INFINITY,Float.POSITIVE_INFINITY,
Float.NEGATIVE_INFINITY,Float.NEGATIVE_INFINITY,Float.NEGATIVE_INFINITY};
int count = 0;
List<Vertex> vertices;
for( Facet facet : facets ) {
TriangularFacet tri = (TriangularFacet) facet;
vertices = tri.getVertices();
Vector3D normal = tri.getNormal();
for( Vertex v : vertices ) {
for( int d = 0; d < numDimension; d++ ) {
scVertices[count] = (float) v.getDoublePosition(d);
if( scVertices[count] < boundingBox[d] )// min
boundingBox[d] = scVertices[count];
if( scVertices[count] > boundingBox[d+3] )// min
boundingBox[d+3] = scVertices[count];
if( d == 0 ) scNormals[count] = (float) normal.getX();
else if( d == 1 ) scNormals[count] = (float) normal.getY();
else if( d == 2 ) scNormals[count] = (float) normal.getZ();
count++;
}
}
}
logService.warn( "Converted " + scVertices.length + " vertices and " + scNormals.length + " normals ");
scMesh.setVertices(BufferUtils.BufferUtils.allocateFloatAndPut(scVertices) );
scMesh.setNormals( BufferUtils.BufferUtils.allocateFloatAndPut(scNormals) );
scMesh.setTexcoords(BufferUtils.BufferUtils.allocateFloat(0));
scMesh.setIndices(BufferUtils.BufferUtils.allocateInt(0));
scMesh.recalculateNormals();
scMesh.setBoundingBoxCoords(boundingBox);
scMesh.setDirty(true);
//scMesh.setScale(new GLVector(1f, 1f, 1f));
return scMesh;
}
return null;
}
示例8: getGroundPointAt
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public Vector3D getGroundPointAt(Vector3D point) {
Vector3D origin = new Vector3D(point.getX(), point.getY(), 100000);
Vector3D dir = new Vector3D(0, 0, -1);
RaySceneIntersection intersect = getIntersection(origin, dir, true);
if (intersect == null) {
return null;
}
return intersect.point;
}