本文整理汇总了Java中org.apache.commons.math3.util.MathArrays.distance方法的典型用法代码示例。如果您正苦于以下问题:Java MathArrays.distance方法的具体用法?Java MathArrays.distance怎么用?Java MathArrays.distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.util.MathArrays
的用法示例。
在下文中一共展示了MathArrays.distance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showAdditionalResults
import org.apache.commons.math3.util.MathArrays; //导入方法依赖的package包/类
private void showAdditionalResults(final SkeletonResult results) {
if (!verbose) {
return;
}
final DefaultGenericTable table = new DefaultGenericTable();
final List<PrimitiveColumn<?, ?>> columns = Arrays.asList(new IntColumn(
"# Skeleton"), new IntColumn("# Branch"), new DoubleColumn(
"Branch length"), new IntColumn("V1 x"), new IntColumn("V1 y"),
new IntColumn("V1 z"), new IntColumn("V2 x"), new IntColumn("V2 y"),
new IntColumn("V2 z"), new DoubleColumn("Euclidean distance"),
new DoubleColumn("running average length"), new DoubleColumn(
"average intensity (inner 3rd)"), new DoubleColumn(
"average intensity"));
final Graph[] graphs = results.getGraph();
for (int i = 0; i < graphs.length; i++) {
final ArrayList<Edge> edges = graphs[i].getEdges();
// Sort into descending order by length
edges.sort((a, b) -> -Double.compare(a.getLength(), b.getLength()));
for (int j = 0; j < edges.size(); j++) {
final Edge edge = edges.get(j);
((IntColumn) columns.get(0)).add((i + 1));
((IntColumn) columns.get(1)).add((j + 1));
((DoubleColumn) columns.get(2)).add((edge.getLength()));
final Point point = edge.getV1().getPoints().get(0);
((IntColumn) columns.get(3)).add((point.x));
((IntColumn) columns.get(4)).add((point.y));
((IntColumn) columns.get(5)).add((point.z));
final Point point2 = edge.getV2().getPoints().get(0);
((IntColumn) columns.get(6)).add((point2.x));
((IntColumn) columns.get(7)).add((point2.y));
((IntColumn) columns.get(8)).add((point2.z));
final double distance = MathArrays.distance(new double[] { point.x,
point.y, point.z }, new double[] { point2.x, point2.y, point2.z });
((DoubleColumn) columns.get(9)).add((distance));
((DoubleColumn) columns.get(10)).add((edge.getLength_ra()));
((DoubleColumn) columns.get(11)).add((edge.getColor3rd()));
((DoubleColumn) columns.get(12)).add((edge.getColor()));
}
}
table.addAll(columns);
if (table.size() > 0) {
verboseTable = table;
}
}
示例2: compute
import org.apache.commons.math3.util.MathArrays; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double compute(double[] a, double[] b)
throws DimensionMismatchException {
return MathArrays.distance(a, b);
}
示例3: distanceFrom
import org.apache.commons.math3.util.MathArrays; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double distanceFrom(final EuclideanDoublePoint p) {
return MathArrays.distance(point, p.getPoint());
}
示例4: distanceFrom
import org.apache.commons.math3.util.MathArrays; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double distanceFrom(final EuclideanIntegerPoint p) {
return MathArrays.distance(point, p.getPoint());
}