当前位置: 首页>>代码示例>>Java>>正文


Java Vector3D.getY方法代码示例

本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.Vector3D.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3D.getY方法的具体用法?Java Vector3D.getY怎么用?Java Vector3D.getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.geometry.euclidean.threed.Vector3D的用法示例。


在下文中一共展示了Vector3D.getY方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:30,代码来源:HorizontalCoordinate.java

示例2: processScanLine

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
private Set<Vector3D> processScanLine(double y, Vector3D pa, Vector3D pb, Vector3D pc, Vector3D pd) {
    Set<Vector3D> result = new HashSet<>();

    double gradient1 = pa.getY() != pb.getY() ? (y - pa.getY()) / (pb.getY() - pa.getY()) : 1;
    double gradient2 = pc.getY() != pd.getY() ? (y - pc.getY()) / (pd.getY() - pc.getY()) : 1;

    double sx = interpolate(pa.getX(), pb.getX(), gradient1);
    double ex = interpolate(pc.getX(), pd.getX(), gradient2);

    double z1 = interpolate(pa.getZ(), pb.getZ(), gradient1);
    double z2 = interpolate(pc.getZ(), pd.getZ(), gradient2);

    for (double x = sx; x < ex; x += JUMP) {
        double gradient = (x - sx) / (ex - sx);
        double z = interpolate(z1, z2, gradient);

        Vector3D location = new Vector3D((int)x, (int)y, (int)z);

        result.add(location);
    }

    return result;
}
 
开发者ID:plushmonkey,项目名称:modelviewer,代码行数:24,代码来源:StandardTriangleRasterizer.java

示例3: fill

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
@Override
public Set<Vector3D> fill(List<Vector3D> vertices) {
    Vector3D[] points = new Vector3D[] { vertices.get(0), vertices.get(1), vertices.get(2) };

    Arrays.sort(points, (Vector3D v1, Vector3D v2) -> {
        double r = v1.getY() - v2.getY();
        if (r < 0) return -1;
        if (r == 0) return 0;
        return 1;
    });

    Vector3D p1 = points[0];
    Vector3D p2 = points[1];
    Vector3D p3 = points[2];

    Set<Vector3D> result = new HashSet<>();

    if (lineSide2D(p2, p1, p3) > 0) {
        for (double y = p1.getY(); y <= p3.getY(); y += JUMP) {
            if (y < p2.getY()) {
                result.addAll(processScanLine(y, p1, p3, p1, p2));
            } else {
                result.addAll(processScanLine(y, p1, p3, p2, p3));
            }
        }
    } else {
        for (double y = p1.getY(); y <= p3.getY(); y += JUMP) {
            if (y < p2.getY()) {
                result.addAll(processScanLine(y, p1, p2, p1, p3));
            } else {
                result.addAll(processScanLine(y, p2, p3, p1, p3));
            }
        }
    }

    return result;
}
 
开发者ID:plushmonkey,项目名称:modelviewer,代码行数:38,代码来源:StandardTriangleRasterizer.java

示例4: 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());
}
 
开发者ID:plushmonkey,项目名称:modelviewer,代码行数:7,代码来源:Model.java

示例5: 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());
}
 
开发者ID:plushmonkey,项目名称:modelviewer,代码行数:4,代码来源:BukkitAdapter.java

示例6: 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());
	}
 
开发者ID:GIScience,项目名称:helios,代码行数:7,代码来源:BaseAppState.java

示例7: 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();
}
 
开发者ID:GIScience,项目名称:helios,代码行数:6,代码来源:PlatformSettings.java

示例8: 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;
	}
 
开发者ID:GIScience,项目名称:helios,代码行数:51,代码来源:AABB.java

示例9: 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;
}
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:56,代码来源:MeshConverter.java

示例10: 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;
	}
 
开发者ID:GIScience,项目名称:helios,代码行数:14,代码来源:Scene.java


注:本文中的org.apache.commons.math3.geometry.euclidean.threed.Vector3D.getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。