public JavaFXPlanarRegionsViewer() { TextureColorPalette2D colorPalette = new TextureColorPalette2D(); colorPalette.setHueBrightnessBased(0.9); meshBuilder = new JavaFXMultiColorMeshBuilder(colorPalette); renderer = new AnimationTimer() { @Override public void handle(long now) { render(); } }; }
/** * Creates a color palette with the brightness constant and set to {@code 1.0}. The two other components have a resolution of {@value #DEFAULT_RESOLUTION}. */ public TextureColorPalette2D() { setHueSaturationBased(1.0); }
/** * Changes this color palette to allow variation in saturation and brightness. The two other components have a resolution of {@value #DEFAULT_RESOLUTION}. * @param hueConstant the new constant value for the hue component. */ public void setSaturationBrightnessBased(double hueConstant) { setSaturationBrightnessBased(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION, hueConstant); }
/** * Creates an empty mesh builder using the default texture color palette. */ public JavaFXMultiColorMeshBuilder() { colorPalette = new TextureColorPalette2D(); }
/** * Changes this color palette to allow variation in hue and brightness. The two other components have a resolution of {@value #DEFAULT_RESOLUTION}. * @param saturationConstant the new constant value for the saturation component. */ public void setHueBrightnessBased(double saturationConstant) { setHueBrightnessBased(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION, saturationConstant); }
/** * Changes this color palette to allow variation in hue and saturation. * @param hueResolution the new resolution to use for the hue component. * @param saturationResolution the new resolution to use for the saturation component. * @param brightnessConstant the new constant value for the brightness component. */ public void setHueSaturationBased(int hueResolution, int saturationResolution, double brightnessConstant) { MathTools.checkGreaterThanOrEquals(hueResolution, 1); MathTools.checkGreaterThanOrEquals(saturationResolution, 1); MathTools.checkIntervalContains(brightnessConstant, 0.0, 1.0); this.hueResolution = hueResolution; this.saturationResolution = saturationResolution; this.brightnessResolution = -1; this.hueConstant = Double.NaN; this.saturationConstant = Double.NaN; this.brightnessConstant = brightnessConstant; updateColorPalette(); }
private void updateColorPalette() { int width = hueResolution != -1 ? hueResolution : saturationResolution; int height = brightnessResolution != -1 ? brightnessResolution : saturationResolution; WritableImage image = new WritableImage(width, height); PixelWriter pw = image.getPixelWriter(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { pw.setColor(x, y, getColorAtLocation(x, y)); } } if (PRINT_PALETTE) { // save for testing purposes try { ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", new File("palette.png")); } catch (IOException ex) { } } colorPalette = image; }
/** * Creates an empty mesh builder using the default texture color palette. */ public JavaFXMultiColorMeshBuilder() { colorPalette = new TextureColorPalette2D(); }
/** * Changes this color palette to allow variation in hue and brightness. The two other components have a resolution of {@value #DEFAULT_RESOLUTION}. * @param saturationConstant the new constant value for the saturation component. */ public void setHueBrightnessBased(double saturationConstant) { setHueBrightnessBased(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION, saturationConstant); }
/** * Changes this color palette to allow variation in hue and saturation. * @param hueResolution the new resolution to use for the hue component. * @param brightnessResolution the new resolution to use for the brightness component. * @param saturationConstant the new constant value for the saturation component. */ public void setHueBrightnessBased(int hueResolution, int brightnessResolution, double saturationConstant) { MathTools.checkIfGreaterOrEqual(hueResolution, 1); MathTools.checkIfGreaterOrEqual(brightnessResolution, 1); MathTools.checkIfInRange(saturationConstant, 0.0, 1.0); this.hueResolution = hueResolution; this.saturationResolution = -1; this.brightnessResolution = brightnessResolution; this.hueConstant = Double.NaN; this.saturationConstant = saturationConstant; this.brightnessConstant = Double.NaN; updateColorPalette(); }
private void updateColorPalette() { int width = hueResolution != -1 ? hueResolution : saturationResolution; int height = brightnessResolution != -1 ? brightnessResolution : saturationResolution; WritableImage image = new WritableImage(width, height); PixelWriter pw = image.getPixelWriter(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { pw.setColor(x, y, getColorAtLocation(x, y)); } } if (PRINT_PALETTE) { // save for testing purposes try { ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", new File("palette.png")); } catch (IOException ex) { } } colorPalette = image; }
public PlanarRegionsMeshBuilder(REAUIMessager uiMessager) { this.uiMessager = uiMessager; enable = uiMessager.createInput(REAModuleAPI.OcTreeEnable, false); clear = uiMessager.createInput(REAModuleAPI.PlanarRegionsPolygonizerClear, false); clearOcTree = uiMessager.createInput(REAModuleAPI.OcTreeClear, false); planarRegionsListMessage = uiMessager.createInput(REAModuleAPI.PlanarRegionsState); TextureColorPalette2D colorPalette = new TextureColorPalette2D(); colorPalette.setHueBrightnessBased(0.9); meshBuilder = new JavaFXMultiColorMeshBuilder(colorPalette); }
JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorPalette2D());
/** * Changes this color palette to allow variation in saturation and brightness. * @param saturationResolution the new resolution to use for the saturation component. * @param brightnessResolution the new resolution to use for the brightness component. * @param hueConstant the new constant value for the hue component. */ public void setSaturationBrightnessBased(int saturationResolution, int brightnessResolution, double hueConstant) { MathTools.checkGreaterThanOrEquals(saturationResolution, 1); MathTools.checkGreaterThanOrEquals(brightnessResolution, 1); MathTools.checkIntervalContains(hueConstant, 0.0, 1.0); this.hueResolution = -1; this.saturationResolution = saturationResolution; this.brightnessResolution = brightnessResolution; this.hueConstant = hueConstant; this.saturationConstant = Double.NaN; this.brightnessConstant = Double.NaN; updateColorPalette(); }
/** * Changes this color palette to allow variation in hue and saturation component. * @param brightnessConstant the new constant value for the brightness component. */ public void setHueSaturationBased(double brightnessConstant) { setHueSaturationBased(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION, brightnessConstant); }
/** * Changes this color palette to allow variation in saturation and brightness. The two other components have a resolution of {@value #DEFAULT_RESOLUTION}. * @param hueConstant the new constant value for the hue component. */ public void setSaturationBrightnessBased(double hueConstant) { setSaturationBrightnessBased(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION, hueConstant); }
public NodeCheckerRenderer(Messager messager) { nodeCheckerEnabled = messager.createInput(EnableNodeChecking, false); planarRegionsReference = messager.createInput(PlanarRegionDataTopic); footPositionReference = messager.createInput(NodeCheckingPosition); footOrientationReference = messager.createInput(NodeCheckingOrientation, new Quaternion()); initialSupportSideReference = messager.createInput(InitialSupportSideTopic, RobotSide.LEFT); TextureColorPalette2D colorPalette = new TextureColorPalette2D(); colorPalette.setHueBrightnessBased(0.9); meshBuilder = new JavaFXMultiColorMeshBuilder(colorPalette); }
/** * Changes this color palette to allow variation in hue and saturation. * @param hueResolution the new resolution to use for the hue component. * @param saturationResolution the new resolution to use for the saturation component. * @param brightnessConstant the new constant value for the brightness component. */ public void setHueSaturationBased(int hueResolution, int saturationResolution, double brightnessConstant) { MathTools.checkIfGreaterOrEqual(hueResolution, 1); MathTools.checkIfGreaterOrEqual(saturationResolution, 1); MathTools.checkIfInRange(brightnessConstant, 0.0, 1.0); this.hueResolution = hueResolution; this.saturationResolution = saturationResolution; this.brightnessResolution = -1; this.hueConstant = Double.NaN; this.saturationConstant = Double.NaN; this.brightnessConstant = brightnessConstant; updateColorPalette(); }
/** * Changes this color palette to allow variation in hue and saturation component. * @param brightnessConstant the new constant value for the brightness component. */ public void setHueSaturationBased(double brightnessConstant) { setHueSaturationBased(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION, brightnessConstant); }
/** * Changes this color palette to allow variation in saturation and brightness. * @param saturationResolution the new resolution to use for the saturation component. * @param brightnessResolution the new resolution to use for the brightness component. * @param hueConstant the new constant value for the hue component. */ public void setSaturationBrightnessBased(int saturationResolution, int brightnessResolution, double hueConstant) { MathTools.checkIfGreaterOrEqual(saturationResolution, 1); MathTools.checkIfGreaterOrEqual(brightnessResolution, 1); MathTools.checkIfInRange(hueConstant, 0.0, 1.0); this.hueResolution = -1; this.saturationResolution = saturationResolution; this.brightnessResolution = brightnessResolution; this.hueConstant = hueConstant; this.saturationConstant = Double.NaN; this.brightnessConstant = Double.NaN; updateColorPalette(); }