newData[i * stride + posIdx + 2] = Float.floatToIntBits( pos.getZ() + 0.5f );
public void setScan(Point3f[] scan) { this.scan = new float[scan.length * 3]; int index = 0; for (Point3f scanPoint : scan) { this.scan[index++] = scanPoint.getX(); this.scan[index++] = scanPoint.getY(); this.scan[index++] = scanPoint.getZ(); } }
public void publish(Point3f point3f) { publish(point3f.getX(), point3f.getY(), point3f.getZ()); } }
public boolean isInside(Point3f point3f) { return isInside(point3f.getX(), point3f.getY(), point3f.getZ()); }
/** * Transform the Point3f point by this transform and place result back in * point. * * @param point */ public final void transform(Point3f point) { float x = (float) (mat00 * point.getX() + mat01 * point.getY() + mat02 * point.getZ() + mat03); float y = (float) (mat10 * point.getX() + mat11 * point.getY() + mat12 * point.getZ() + mat13); point.setZ((float) (mat20 * point.getX() + mat21 * point.getY() + mat22 * point.getZ() + mat23)); point.setX(x); point.setY(y); }
public static void assertPoint3fEquals(String message, Point3f expected, Point3f actual, double delta) { assertEquals(message + " [X component]",expected.getX(), actual.getX(),delta); assertEquals(message + " [Y component]",expected.getY(), actual.getY(),delta); assertEquals(message + " [Z component]", expected.getZ(), actual.getZ(), delta); }
public Node generatePointCloudGraph(Point3f[] pointCloud, Collection<ColorRGBA> colorsRGBA) throws Exception { if (colorsRGBA == null) throw new Exception("point cloud colors must not be null!"); if (pointCloud.length != colorsRGBA.size()) throw new Exception("There should be a color value for each point, if colors are used!"); FloatBuffer pointBuffer = BufferUtils.createFloatBuffer(3 * pointCloud.length); for(Point3f point : pointCloud) { pointBuffer.put(point.getX()); pointBuffer.put(point.getY()); pointBuffer.put(point.getZ()); } pointBuffer.rewind(); FloatBuffer colorBuffer = BufferUtils.createFloatBuffer(4 * colorsRGBA.size()); for (ColorRGBA colorRGBA : colorsRGBA) { colorBuffer.put(colorRGBA.getColorArray()); } colorBuffer.rewind(); return generatePointCloudGraph(pointBuffer, colorBuffer); } }
public static Point3f generateRandomPoint3f(Random random, Point3f min, Point3f max) { float x = generateRandomFloatInRange(random, min.getX(), max.getX()); float y = generateRandomFloatInRange(random, min.getY(), max.getY()); float z = generateRandomFloatInRange(random, min.getZ(), max.getZ()); return new Point3f(x, y, z); }
public Node generatePointCloudGraph(Point3f[] pointCoordinates3d, ColorRGBA[] colorsRGBA) { Vector3f[] vectorArray = new Vector3f[pointCoordinates3d.length]; for (int i = 0; i < pointCoordinates3d.length; i++) { vectorArray[i] = new Vector3f(pointCoordinates3d[i].getX(), pointCoordinates3d[i].getY(), pointCoordinates3d[i].getZ()); } return generatePointCloudGraph(vectorArray, colorsRGBA); }
/** * Transform the Point3f pointIn by this transform and place result in * pointOut. * * @param point */ public final void transform(Point3f pointIn, Point3f pointOut) { if (pointIn != pointOut) { pointOut.setX((float) (mat00 * pointIn.getX() + mat01 * pointIn.getY() + mat02 * pointIn.getZ() + mat03)); pointOut.setY((float) (mat10 * pointIn.getX() + mat11 * pointIn.getY() + mat12 * pointIn.getZ() + mat13)); pointOut.setZ((float) (mat20 * pointIn.getX() + mat21 * pointIn.getY() + mat22 * pointIn.getZ() + mat23)); } else { transform(pointIn); } }
/** * @param v * @param xOffset * @param yOffset */ protected void offsetVertex(V v, float xOffset, float yOffset, float zOffset) { Point3f c = getCoordinates(v); c.set(c.getX()+xOffset, c.getY()+yOffset, c.getZ()+zOffset); setLocation(v, c); }
(float)(xyd.getX()+Math.max(-5, Math.min(5, vd.dx))), (float)(xyd.getY()+Math.max(-5, Math.min(5, vd.dy))), (float)(xyd.getZ()+Math.max(-5, Math.min(5, vd.dz)))); xyd.set(-radius, xyd.getY(), xyd.getZ());// setX(0); } else if (xyd.getX() > radius) { xyd.set(radius, xyd.getY(), xyd.getZ()); //setX(width); xyd.set(xyd.getX(),-radius, xyd.getZ());//setY(0); } else if (xyd.getY() > radius) { xyd.set(xyd.getX(), radius, xyd.getZ()); //setY(height); if (xyd.getZ() < -radius) { } else if (xyd.getZ() > radius) {
/** * Multiply a 3x3 matrix by a 3x1 vector. Since result is stored in vector, the matrix must be 3x3. * @param matrix * @param point */ public static void mult(DenseMatrix64F matrix, Point3f point) { if (matrix.numCols != 3 || matrix.numRows != 3) { throw new RuntimeException("Improperly sized matrices."); } double x = point.getX(); double y = point.getY(); double z = point.getZ(); point.setX((float) (matrix.get(0, 0) * x + matrix.get(0, 1) * y + matrix.get(0, 2) * z)); point.setY((float) (matrix.get(1, 0) * x + matrix.get(1, 1) * y + matrix.get(1, 2) * z)); point.setZ((float) (matrix.get(2, 0) * x + matrix.get(2, 1) * y + matrix.get(2, 2) * z)); }
public void stateChanged(ChangeEvent e) { for(V v : vertexMap.keySet()) { Point3f p = VisualizationViewer.this.layout.transform(v); Vector3f pv = new Vector3f(p.getX(), p.getY(), p.getZ()); Transform3D tx = new Transform3D(); tx.setTranslation(pv); vertexMap.get(v).setTransform(tx); } for(E edge : graph.getEdges()) { Pair<V> endpoints = graph.getEndpoints(edge); V start = endpoints.getFirst(); V end = endpoints.getSecond(); EdgeGroup eg = edgeMap.get(edge); eg.setEndpoints(layout.transform(start), layout.transform(end)); } }});
if (nearest != null) CollisionResult collRes = new CollisionResult(geom, new com.jme3.math.Vector3f(nearest.getX(), nearest.getY(), nearest.getZ()), origin.distance(nearest), 0); collRes.setContactNormal(new com.jme3.math.Vector3f(0, 0, 1)); results.addCollision(collRes);