本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.Vector3D.angle方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3D.angle方法的具体用法?Java Vector3D.angle怎么用?Java Vector3D.angle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.geometry.euclidean.threed.Vector3D
的用法示例。
在下文中一共展示了Vector3D.angle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFollowingEdge
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
/** Get the edge that should naturally follow another one.
* @param previous edge to be continued
* @return other edge, starting where the previous one ends (they
* have not been connected yet)
* @exception MathIllegalStateException if there is not a single other edge
*/
private Edge getFollowingEdge(final Edge previous)
throws MathIllegalStateException {
// get the candidate nodes
final S2Point point = previous.getEnd().getLocation();
final List<BSPTree<Sphere2D>> candidates = root.getCloseCuts(point, tolerance);
// the following edge we are looking for must start from one of the candidates nodes
double closest = tolerance;
Edge following = null;
for (final BSPTree<Sphere2D> node : candidates) {
for (final Edge edge : nodeToEdgesList.get(node)) {
if (edge != previous && edge.getStart().getIncoming() == null) {
final Vector3D edgeStart = edge.getStart().getLocation().getVector();
final double gap = Vector3D.angle(point.getVector(), edgeStart);
if (gap <= closest) {
closest = gap;
following = edge;
}
}
}
}
if (following == null) {
final Vector3D previousStart = previous.getStart().getLocation().getVector();
if (Vector3D.angle(point.getVector(), previousStart) <= tolerance) {
// the edge connects back to itself
return previous;
}
// this should never happen
throw new MathIllegalStateException(LocalizedFormats.OUTLINE_BOUNDARY_LOOP_OPEN);
}
return following;
}
示例2: run
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
@Override
public ScenePart run() {
materials.putAll(MaterialsFileReader.loadMaterials("sceneparts/assumeMaterialsFilter.mtl"));
Vector3D up = new Vector3D(0, 0, 1);
for (Primitive prim : primsIn.mPrimitives) {
if (prim.getClass() == Triangle.class) {
Triangle tri = (Triangle) prim;
double elevation = tri.getCentroid().getZ();
double angle = Vector3D.angle(up, tri.getFaceNormal()) * 180 / Math.PI;
// ######### BEGIN Make landcover assumptions based on terrain elevation, slope, angle to sun etc. ##########
double snowline_var = 0;
double snowline = 0;
double timberline = 0;
double timber_min_slope = 0;
double rock_min_slope = 0;
try {
snowline = (double) params.get("snowline");
snowline_var = (double) params.get("snowline_var");
timberline = (double) params.get("timberline");
timber_min_slope = (double) params.get("timber_min_slope");
rock_min_slope = (double) params.get("rock_min_slope");
} catch (Exception e) {
System.out.println(e.getMessage());
}
// Initialize everything with grass:
String materialName = "grass";
tri.setAllVertexColors(new Color4f(0.3f, 0.8f, 0.3f, 1f));
// Forest:
if (angle > timber_min_slope && elevation < timberline) {
materialName = "forest";
tri.setAllVertexColors(new Color4f(0.1f, 0.3f, 0.1f, 1f));
}
// Snow:
double sunAngle = Vector3D.angle(sunDir.negate(), tri.getFaceNormal());
double temperature = snowline - elevation - snowline_var * sunAngle;
if (temperature < 0) {
materialName = "snow";
tri.setAllVertexColors(new Color4f(1, 1, 1, 1));
}
// Rock:
if (angle > rock_min_slope) {
materialName = "rock";
tri.setAllVertexColors(new Color4f(0.6f, 0.6f, 0.6f, 1));
}
// ######### END Make landcover assumptions based on terrain elevation, slope, angle to sun etc. ##########
tri.material = getMaterial(materialName);
}
}
return primsIn;
}
示例3: initLegManual
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
@Override
public void initLegManual() {
// ########## BEGIN Set Platform Orientation towards destination #############
try {
Double angle = Vector3D.angle(cached_vectorToTarget_xy, cached_dir_current_xy);
float stepSize = 0.025f;
float heading_rad = 0;
while (angle > stepSize) {
heading_rad += angle;
Rotation r = new Rotation(Directions.up, heading_rad);
this.setAttitude(r);
angle = Vector3D.angle(cached_vectorToTarget_xy, cached_dir_current_xy);
}
System.out.println("Updated orientation");
} catch (Exception e) {
}
// ########## END Set Platform Orientation towards destination #############
}
示例4: getOffset
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
/** Get the offset (oriented distance) of a direction.
* <p>The offset is defined as the angular distance between the
* circle center and the direction minus the circle radius. It
* is therefore 0 on the circle, positive for directions outside of
* the cone delimited by the circle, and negative inside the cone.</p>
* @param direction direction to check
* @return offset of the direction
* @see #getOffset(Point)
*/
public double getOffset(final Vector3D direction) {
return Vector3D.angle(pole, direction) - 0.5 * FastMath.PI;
}
示例5: S2Point
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
/** Simple constructor.
* Build a vector from its underlying 3D vector
* @param vector 3D vector
* @exception MathArithmeticException if vector norm is zero
*/
public S2Point(final Vector3D vector) throws MathArithmeticException {
this(FastMath.atan2(vector.getY(), vector.getX()), Vector3D.angle(Vector3D.PLUS_K, vector),
vector.normalize());
}
示例6: distance
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
/** Compute the distance (angular separation) between two points.
* @param p1 first vector
* @param p2 second vector
* @return the angular separation between p1 and p2
*/
public static double distance(S2Point p1, S2Point p2) {
return Vector3D.angle(p1.vector, p2.vector);
}