public Node generatePointCloudGraph(Point3DReadOnly[] 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(Point3DReadOnly point : pointCloud) { pointBuffer.put(point.getX32()); pointBuffer.put(point.getY32()); pointBuffer.put(point.getZ32()); } pointBuffer.rewind(); FloatBuffer colorBuffer = BufferUtils.createFloatBuffer(4 * colorsRGBA.size()); for (ColorRGBA colorRGBA : colorsRGBA) { colorBuffer.put(colorRGBA.getColorArray()); } colorBuffer.rewind(); return generatePointCloudGraph(pointBuffer, colorBuffer); }
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 Node generatePointCloudGraph(Point3DReadOnly[] pointCloud, ColorRGBA[] colorsRGBA) throws Exception { if (colorsRGBA == null) throw new Exception("point cloud colors must not be null!"); if (pointCloud.length != colorsRGBA.length) throw new Exception("There should be a color value for each point, if colors are used!"); FloatBuffer pointBuffer = BufferUtils.createFloatBuffer(3 * pointCloud.length); for(Point3DReadOnly point : pointCloud) { pointBuffer.put(point.getX32()); pointBuffer.put(point.getY32()); pointBuffer.put(point.getZ32()); } pointBuffer.rewind(); FloatBuffer colorBuffer = BufferUtils.createFloatBuffer(4 * colorsRGBA.length); for (ColorRGBA colorRGBA : colorsRGBA) { colorBuffer.put(colorRGBA.getColorArray()); } colorBuffer.rewind(); return generatePointCloudGraph(pointBuffer, colorBuffer); } }
for (int i = 0; i < capacity; i++) colorBuffer.put(color.getColorArray());