本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.Vector3D.add方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3D.add方法的具体用法?Java Vector3D.add怎么用?Java Vector3D.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.geometry.euclidean.threed.Vector3D
的用法示例。
在下文中一共展示了Vector3D.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fill
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
@Override
public Set<Vector3D> fill(List<Vector3D> vertices) {
Set<Vector3D> result = new HashSet<>();
if (vertices.isEmpty()) return result;
Vector3D pivot = vertices.get(0);
for (int i = 1; i < vertices.size() - 1; ++i) {
Vector3D current = vertices.get(i);
Vector3D next = vertices.get(i + 1);
Vector3D currentToNext = next.subtract(current);
double dist = current.distance(next);
double jump = getJump(pivot, current, next);
for (double j = 0; j <= dist; j += jump) {
Vector3D interpolated = current.add(currentToNext.scalarMultiply(j / dist));
Set<Vector3D> linePoints = algorithm.draw(pivot, interpolated);
result.addAll(linePoints);
}
}
return result;
}
示例2: addTestPoint
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
void addTestPoint(Vector3D rayOrigin, Vector3D rayDir) {
TreeMap<Double, Primitive> hitPrims = scene.getIntersections(rayOrigin, rayDir, false);
if (hitPrims == null) {
return;
}
Iterator<Entry<Double, Primitive>> iter = hitPrims.entrySet().iterator();
while (iter.hasNext()) {
Entry<Double, Primitive> entry = (Entry<Double, Primitive>) iter.next();
double hitDistance = entry.getKey();
Vector3D hitPos = rayOrigin.add(rayDir.scalarMultiply(hitDistance));
if (hitPos.distance(lastAddedTestPoint) >= cfg_gridSizeVTP_m || true) {
vtps.add(hitPos);
lastAddedTestPoint = hitPos;
}
}
}
示例3: draw
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
@Override
public Set<Vector3D> draw(Vector3D from, Vector3D to) {
Set<Vector3D> result = new HashSet<>();
double dist = from.distance(to);
Vector3D between = to.subtract(from);
for (double i = 0; i <= dist; ++i) {
Vector3D interpolated = from.add(between.scalarMultiply(i / dist));
result.add(interpolated);
}
return result;
}
示例4: getIntersection
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public RaySceneIntersection getIntersection(Vector3D rayOrigin, Vector3D rayDir, boolean groundOnly) {
double[] tMinMax = bbox.getRayIntersection(rayOrigin, rayDir);
// if tMinMax == null, it doesn't. In this case, we can abort here:
if (tMinMax == null) {
return null;
}
boolean bruteForce = false;
RaySceneIntersection result = null;
if (!bruteForce) {
KdTreeRaycaster raycaster = new KdTreeRaycaster(kdtree);
result = raycaster.search(rayOrigin, rayDir, tMinMax[0], tMinMax[1], groundOnly);
} else {
double minDist = Double.MAX_VALUE;
for (Primitive p : this.primitives) {
double[] hitDist = p.getRayIntersection(rayOrigin, rayDir);
if ((hitDist[0] >= 0 && hitDist[0] < minDist)) {
minDist = hitDist[0];
result = new RaySceneIntersection();
result.prim = p;
result.point = rayOrigin.add(rayDir.scalarMultiply(minDist));
}
}
}
return result;
}
示例5: capturePoint
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
void capturePoint(Vector3D beamOrigin, Vector3D beamDir, double distance, double intensity, double echo_width, int returnNumber, int pulseReturnNumber, int fullwaveIndex, String hitObjectId) {
// Abort if point distance is below mininum scanner range:
if (distance < detector.cfg_device_rangeMin_m) {
return;
}
// ########## BEGIN Apply gaussian range accuracy error ###########
double precision = this.detector.cfg_device_accuracy_m / 2;
double error = -precision + Math.random() * (precision * 2);
error += boxMullerRandom(0.0, this.detector.cfg_device_accuracy_m / 2);
distance += error;
// ########## END Apply gaussian range accuracy error ###########
// Calculate final recorded point coordinates:
Vector3D pointPos = beamOrigin.add(beamDir.scalarMultiply(distance));
Measurement m = new Measurement();
m.position = pointPos;
m.distance = distance;
m.intensity = intensity;
m.echo_width = echo_width;
m.returnNumber = returnNumber;
m.pulseReturnNumber = pulseReturnNumber;
m.fullwaveIndex = fullwaveIndex;
m.beamOrigin = beamOrigin;
m.beamDirection = beamDir;
m.hitObjectId = hitObjectId;
detector.writeMeasurement(m);
detector.mBuffer.add(m);
}
示例6: search
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; //导入方法依赖的package包/类
public RaySceneIntersection search(Vector3D rayOrigin, Vector3D rayDir, double tmin, double tmax, boolean groundOnly) {
this.rayDirArray = rayDir.toArray();
this.rayOriginArray = rayOrigin.toArray();
this.rayOrigin = rayOrigin;
this.rayDir = rayDir;
this.groundOnly = groundOnly;
this.closestHitDistance = Double.MAX_VALUE;
Primitive prim = this.search_recursive(this.root, tmin, tmax);
// System.out.println("complete!");
if (prim == null) {
// System.out.println("KDtree Miss");
return null;
}
RaySceneIntersection result = new RaySceneIntersection();
result.prim = prim;
result.point = rayOrigin.add(rayDir.scalarMultiply(closestHitDistance));
return result;
}