本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.Vector3D.getNorm方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3D.getNorm方法的具体用法?Java Vector3D.getNorm怎么用?Java Vector3D.getNorm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.geometry.euclidean.threed.Vector3D
的用法示例。
在下文中一共展示了Vector3D.getNorm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
@Override
public void update() {
Vector3D normal_unnormalized = (verts[1].pos.subtract(verts[0].pos)).crossProduct(verts[2].pos.subtract(verts[0].pos));
if (normal_unnormalized.getNorm() > 0) {
this.faceNormal = normal_unnormalized.normalize();
}
}
示例2: getVisiblePoints
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
HashSet<VisiblePoint> getVisiblePoints(Vector3D rayOrigin) {
HashSet<VisiblePoint> result = new HashSet<>();
for (Vector3D testPoint : vtps) {
Vector3D rayDir = testPoint.subtract(rayOrigin);
if (rayDir.getNorm() == 0) {
continue;
}
rayDir = rayDir.normalize();
// Otherwise, check for intersection with a primitive using the kdtree:
RaySceneIntersection intersect = scene.getIntersection(rayOrigin, rayDir, false);
// TODO 4: Try to get true incidence angle
double incidenceAngle = (Math.PI / 4);
double intersectDistance = Double.MAX_VALUE;
if (intersect != null) {
intersectDistance = rayOrigin.distance(intersect.point);
incidenceAngle = intersect.prim.getIncidenceAngle_rad(rayOrigin, rayDir);
}
double testpointRayDistance = Vector3D.crossProduct(rayDir, testPoint.subtract(rayOrigin)).getNorm();
if (testpointRayDistance < cfg_hitTolerance_m && rayOrigin.distance(testPoint) <= intersectDistance + cfg_hitTolerance_m) {
VisiblePoint rsc = new VisiblePoint();
rsc.angle = incidenceAngle;
rsc.pos = testPoint;
result.add(rsc);
}
}
return result;
}