/** * {@inheritDoc} */ @Override public double[] getCoords() { double[] c = new double[3]; coords.get(c); return c; }
protected static boolean classifyCornersIntoEdgeCrossingZPlane(Point3d startCorner, Point3d endCorner) { double[] startArray = new double[3]; double[] endArray = new double[3]; startCorner.get(startArray); double startZ = startArray[2]; endCorner.get(endArray); double endZ = endArray[2]; return (startZ <= 0 && endZ >= 0) || (startZ >= 0 && endZ <= 0); }
public void getMinPoint(double[] minToPack) { minPoint.get(minToPack); }
public void getMaxPoint(double[] maxToPack) { maxPoint.get(maxToPack); }
protected void addPoint(Point3d point) { synchronized (notifier) { point.get(points[index++]); if (index >= indexMax) { index = 0; notifier.notify(); } } }
protected void addPoint(Point3d point) { synchronized (notifier) { if (scans<=0) return; point.get(points[index++]); if (index >= indexMax) { index = 0; scans--; notifier.notify(); } } }
private static OneDimensionalBounds[] computeOuterBounds(LineSegment3d lineSegment) { double[] aVals = new double[3]; lineSegment.getFirstEndpoint().get(aVals); double[] bVals = new double[3]; lineSegment.getSecondEndpoint().get(bVals); OneDimensionalBounds[] ret = new OneDimensionalBounds[3]; for (int i = 0; i < 3; i++) { ret[i] = new OneDimensionalBounds(Math.min(aVals[i], bVals[i]), Math.max(aVals[i], bVals[i])); } return ret; } public LineSegmentSearchVolume(Point2d point1, Point2d point2)
protected List<Point2D.Double> drawLinesBetweenAnyPointsWhichIntersectPlaneWhereZIsZero(Point3d[] corners) { int size = corners.length; double[] thisArray = new double[3]; double[] nextArray = new double[3]; ArrayList<Point3d> intersections = new ArrayList<>(); for (int i = 0; i < size; ++i) { int next = (i == size - 1) ? 0 : i + 1; corners[i].get(thisArray); double thisZ = thisArray[2]; corners[next].get(nextArray); double nextZ = nextArray[2]; if ((thisZ <= 0 && nextZ >= 0) || (thisZ >= 0 && nextZ <= 0)) { Point3d intersection = intersectLineBetweenTwoPointsWithPlaneWhereZIsZero(thisArray, nextArray); intersections.add(intersection); } } return !intersections.isEmpty() ? drawOutlineOnLocalizer(intersections) : null; }
public LineSegmentSearchVolume(LineSegment3d lineSegment) { super(3, computeOuterBounds(lineSegment), null, true); dim = 3; pointA = new double[dim]; pointB = new double[dim]; scale = new double[dim]; lineSegment.getFirstEndpoint().get(pointA); lineSegment.getSecondEndpoint().get(pointB); for (int i=0;i<dim;i++) { scale[i]=1.0/(pointB[i]-pointA[i]); } } private static OneDimensionalBounds[] computeOuterBounds(LineSegment3d lineSegment)
public void PopToOctree(Point3f location) { double[] locationArray = new double[3]; new Point3d(location).get(locationArray); this.put(locationArray, true); }
public static void zz() { Map<String,Point3d> m = new HashMap<String,Point3d>(); m.put("k1", new Point3d(1.0, 1.0, 4.0)); m.put("k2", new Point3d(2.0, 2.0, 2.0)); m.put("k3", new Point3d(1.0, 3.0, 2.0)); m.put("k4", new Point3d(1.0, 3.0, 4.0)); m.put("k5", new Point3d(5.0, 3.0, 2.0)); Set xvals = new HashSet(); Set yvals = new HashSet(); Set zvals = new HashSet(); double[] coords = new double[3]; for (Point3d p : m.values()) { p.get(coords); xvals.add(coords[0]); yvals.add(coords[1]); zvals.add(coords[2]); } System.out.println("# unique x: " + xvals.size() + ": " + xvals); System.out.println("# unique y: " + yvals.size() + ": " + yvals); System.out.println("# unique z: " + zvals.size() + ": " + zvals); }
public double getResolution(double[] location) { timer.startTime(); double distanceSquared = 0; centerInWorldTemp.setIncludingFrame(center); centerInWorldTemp.changeFrame(worldFrame); centerInWorldTemp.getPoint().get(tempCenter); for (int i = 0; i < location.length; i++) { double difference = location[i] - tempCenter[i]; distanceSquared += difference * difference; } if (outerRadiusSquared <= (distanceSquared)) return exteriorResolution; if (innerRadiusSquared >= distanceSquared) return centerResolution; double distance = Math.sqrt(distanceSquared); double resolution = centerResolution + (exteriorResolution - centerResolution) * linearRegion.unScale(distance); timer.endTime(); return resolution; }
this.tlhc = tlhc; tlhcArray = new double[3]; tlhc.get(tlhcArray); this.voxelSpacing = voxelSpacing; voxelSpacingArray = new double[3];
transUser.transform( coord ); coord.get( normal ); Vectors3d.normalizeInPlace( normal ); normals[i] = (float) normal[0];