本文整理了Java中javafx.scene.paint.Color.getHue()
方法的一些代码示例,展示了Color.getHue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Color.getHue()
方法的具体详情如下:
包路径:javafx.scene.paint.Color
类名称:Color
方法名:getHue
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
(int) (newColor.getBlue() * 255));
String hsb = String.format("hsl(%d, %d%%, %d%%)",
(int) (newColor.getHue()),
(int) (newColor.getSaturation() * 100),
(int) (newColor.getBrightness() * 100));
代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit
@Override
public float[] getTextureLocation(Color color)
{
float x;
if (hueResolution != -1)
x = (float) (color.getHue() / 360.0);
else if (saturationResolution != -1)
x = (float) color.getSaturation();
else
x = (float) color.getBrightness();
float y = 0.5f;
return new float[] {x, y};
}
代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit
@Override
public float[] getTextureLocation(Color color)
{
float x;
if (hueResolution != -1)
x = (float) (color.getHue() / 360.0);
else if (saturationResolution != -1)
x = (float) color.getSaturation();
else
x = (float) color.getBrightness();
float y = 0.5f;
return new float[] {x, y};
}
代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit
@Override
public float[] getTextureLocation(Color color)
{
float x = (float) (hueResolution != -1 ? color.getHue() / 360.0 : color.getSaturation());
float y = (float) (brightnessResolution != -1 ? color.getBrightness() : color.getSaturation());
return new float[] {x, y};
}
代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit
@Override
public float[] getTextureLocation(Color color)
{
float x = (float) (hueResolution != -1 ? color.getHue() / 360.0 : color.getSaturation());
float y = (float) (brightnessResolution != -1 ? color.getBrightness() : color.getSaturation());
return new float[] {x, y};
}
代码示例来源:origin: edu.utah.bmi.nlp/nlp-core
public static int[] getRandomBeautifulColors() {
String colorString=Integer.toHexString((int)Math.floor(Math.random()*16777215));
if(colorString.length()==5) {
colorString = "0" + colorString;
// System.out.println(colorString);
}
Color color = Color.valueOf(colorString);
if(color.getSaturation()>0.78){
color=Color.hsb(color.getHue(),0.78,color.getBrightness());
}
if(color.getBrightness()<0.43){
color=Color.hsb(color.getHue(),color.getSaturation(),0.43);
}
// System.out.println(color.getRed());
// System.out.println(color.getGreen());
// System.out.println(color.getBlue());
int red = (int) (color.getRed() * 255);
int green = (int) (color.getGreen() * 255);
int blue = (int) (color.getBlue() * 255);
return new int[]{red, green, blue};
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
private Node createConvexPolygonGraphics(PlanarRegion data)
{
List<ConvexPolygon2D> convexPolygons = new ArrayList<>();
for (int i = 0; i < data.getNumberOfConvexPolygons(); i++)
convexPolygons.add(data.getConvexPolygon(i));
JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(64));
int regionId = data.getRegionId();
RigidBodyTransform rigidBodyTransform = new RigidBodyTransform();
data.getTransformToWorld(rigidBodyTransform);
Color regionColor = OcTreeMeshBuilder.getRegionColor(regionId);
for (int i = 0; i < convexPolygons.size(); i++)
{
ConvexPolygon2D convexPolygon = convexPolygons.get(i);
Color color = Color.hsb(regionColor.getHue(), 0.9, 0.5 + 0.5 * ((double) i / (double) convexPolygons.size()));
meshBuilder.addPolygon(rigidBodyTransform, convexPolygon, color);
}
MeshView meshView = new MeshView(meshBuilder.generateMesh());
meshView.setMaterial(meshBuilder.generateMaterial());
return meshView;
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
private Node createConvexDecompositionGraphics(PlanarRegionSegmentationRawData rawData,
ConcaveHullFactoryResult concaveHullFactoryResult)
{
ConcaveHullCollection concaveHullCollection = concaveHullFactoryResult.getConcaveHullCollection();
double depthThreshold = polygonizerParameters.getDepthThreshold();
List<ConvexPolygon2D> convexPolygons = new ArrayList<>();
ConcaveHullDecomposition.recursiveApproximateDecomposition(concaveHullCollection, depthThreshold, convexPolygons);
JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(64));
int regionId = rawData.getRegionId();
RigidBodyTransform rigidBodyTransform = rawData.getTransformFromLocalToWorld();
Color regionColor = OcTreeMeshBuilder.getRegionColor(regionId);
for (int i = 0; i < convexPolygons.size(); i++)
{
ConvexPolygon2D convexPolygon = convexPolygons.get(i);
Color color = Color.hsb(regionColor.getHue(), 0.9, 0.5 + 0.5 * ((double) i / (double) convexPolygons.size()));
meshBuilder.addPolygon(rigidBodyTransform, convexPolygon, color);
}
MeshView meshView = new MeshView(meshBuilder.generateMesh());
meshView.setMaterial(meshBuilder.generateMaterial());
return meshView;
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
private Node createConcaveHullGraphics(PlanarRegion data)
{
int regionId = data.getRegionId();
JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(16));
RigidBodyTransform transform = new RigidBodyTransform();
data.getTransformToWorld(transform);
Point2D[] concaveHullVerticesLocal = data.getConcaveHull();
Color regionColor = OcTreeMeshBuilder.getRegionColor(regionId);
List<Point3D> concaveHullVertices = Arrays.stream(concaveHullVerticesLocal).map(Point3D::new).map(p -> {
transform.transform(p);
return p;
}).collect(Collectors.toList());
for (int vertexIndex = 0; vertexIndex < concaveHullVertices.size(); vertexIndex++)
{
Point3D vertex = concaveHullVertices.get(vertexIndex);
Point3D nextVertex = ListWrappingIndexTools.getNext(vertexIndex, concaveHullVertices);
Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), regionColor.getBrightness());
meshBuilder.addLine(vertex, nextVertex, 0.0015, lineColor);
}
MeshView meshView = new MeshView(meshBuilder.generateMesh());
meshView.setMaterial(meshBuilder.generateMaterial());
meshView.setMouseTransparent(true);
return meshView;
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
private Node createPriorityQueueGraphics(PlanarRegionSegmentationRawData rawData, ConcaveHullFactoryResult concaveHullFactoryResult)
{
JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(512));
Point3D planeOrigin = rawData.getOrigin();
Quaternion planeOrientation = rawData.getOrientation();
Color regionColor = OcTreeMeshBuilder.getRegionColor(rawData.getRegionId());
for (ConcaveHullVariables intermediateVariables : concaveHullFactoryResult.getIntermediateVariables())
{
PriorityQueue<Pair<QuadEdge, QuadEdgeTriangle>> queue = intermediateVariables.getSortedByLengthQueue();
for (Pair<QuadEdge, QuadEdgeTriangle> edgeAndTriangle : queue)
{
QuadEdge edge = edgeAndTriangle.getLeft();
Point3D dest = PolygonizerTools.toPointInWorld(edge.dest().getX(), edge.dest().getY(), planeOrigin, planeOrientation);
Point3D orig = PolygonizerTools.toPointInWorld(edge.orig().getX(), edge.orig().getY(), planeOrigin, planeOrientation);
boolean isEdgeTooLong = dest.distance(orig) > parameters.getEdgeLengthThreshold();
Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), isEdgeTooLong ? 0.25 : regionColor.getBrightness());
meshBuilder.addLine(dest, orig, 0.0015, lineColor);
QuadEdgeTriangle triangle = edgeAndTriangle.getRight();
List<Point2D> triangleVerticesLocal = Arrays.stream(triangle.getVertices()).map(v -> new Point2D(v.getX(), v.getY())).collect(Collectors.toList());
List<Point3D> triangleVerticesWorld = PolygonizerTools.toPointsInWorld(triangleVerticesLocal, planeOrigin, planeOrientation);
double hue = 360.0 * random.nextDouble();
double saturation = 0.8 * random.nextDouble() + 0.1;
double brightness = 0.9;
meshBuilder.addPolyon(triangleVerticesWorld, Color.hsb(hue, saturation, brightness));
}
}
MeshView trianglesMeshView = new MeshView(meshBuilder.generateMesh());
trianglesMeshView.setMaterial(meshBuilder.generateMaterial());
return trianglesMeshView;
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
Point3D nextVertex = ListWrappingIndexTools.getNext(vertexIndex, concaveHullVertices);
boolean isEdgeTooLong = vertex.distance(nextVertex) > parameters.getEdgeLengthThreshold();
Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), isEdgeTooLong ? 0.25 : regionColor.getBrightness());
meshBuilder.addLine(vertex, nextVertex, 0.0015, lineColor);
代码示例来源:origin: us.ihmc/robot-environment-awareness
private Pair<Mesh, Material> generateMeshAndMaterial(PlanarRegionsListMessage newMessage)
{
meshBuilder.clear();
double lineWidth = 0.01;
RigidBodyTransform transformToWorld = new RigidBodyTransform();
PlanarRegionsList planarRegionsList = PlanarRegionMessageConverter.convertToPlanarRegionsList(newMessage);
for (int regionIndex = 0; regionIndex < planarRegionsList.getNumberOfPlanarRegions(); regionIndex++)
{
PlanarRegion planarRegion = planarRegionsList.getPlanarRegion(regionIndex);
int regionId = planarRegion.getRegionId();
Color regionColor = getRegionColor(regionId);
planarRegion.getTransformToWorld(transformToWorld);
meshBuilder.addMultiLine(transformToWorld, planarRegion.getConcaveHull(), lineWidth, regionColor, true);
for (int polygonIndex = 0; polygonIndex < planarRegion.getNumberOfConvexPolygons(); polygonIndex++)
{
ConvexPolygon2D convexPolygon2d = planarRegion.getConvexPolygon(polygonIndex);
regionColor = Color.hsb(regionColor.getHue(), 0.9, 0.5 + 0.5 * ((double) polygonIndex / (double) planarRegion.getNumberOfConvexPolygons()));
meshBuilder.addPolygon(transformToWorld, convexPolygon2d, regionColor);
}
}
Material material = meshBuilder.generateMaterial();
Mesh mesh = meshBuilder.generateMesh();
return new Pair<>(mesh, material);
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
private Pair<Mesh, Material> generateMeshAndMaterial(PlanarRegionsListMessage newMessage)
{
meshBuilder.clear();
double lineWidth = 0.01;
RigidBodyTransform transformToWorld = new RigidBodyTransform();
PlanarRegionsList planarRegionsList = PlanarRegionMessageConverter.convertToPlanarRegionsList(newMessage);
for (int regionIndex = 0; regionIndex < planarRegionsList.getNumberOfPlanarRegions(); regionIndex++)
{
PlanarRegion planarRegion = planarRegionsList.getPlanarRegion(regionIndex);
int regionId = planarRegion.getRegionId();
Color regionColor = getRegionColor(regionId);
planarRegion.getTransformToWorld(transformToWorld);
meshBuilder.addMultiLine(transformToWorld, planarRegion.getConcaveHull(), lineWidth, regionColor, true);
for (int polygonIndex = 0; polygonIndex < planarRegion.getNumberOfConvexPolygons(); polygonIndex++)
{
ConvexPolygon2D convexPolygon2d = planarRegion.getConvexPolygon(polygonIndex);
regionColor = Color.hsb(regionColor.getHue(), 0.9, 0.5 + 0.5 * ((double) polygonIndex / (double) planarRegion.getNumberOfConvexPolygons()));
meshBuilder.addPolygon(transformToWorld, convexPolygon2d, regionColor);
}
}
Material material = meshBuilder.generateMaterial();
Mesh mesh = meshBuilder.generateMesh();
return new Pair<>(mesh, material);
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-visualizers
private void processFootMesh(FootstepNode node, FootstepNodeSnapData snapData, boolean valid)
{
meshBuilder.clear();
RigidBodyTransform planarTransformToWorld = new RigidBodyTransform();
FootstepNodeTools.getNodeTransform(node, planarTransformToWorld);
RigidBodyTransform snappedTransformToWorld = new RigidBodyTransform();
ConvexPolygon2D foothold = snapData.getCroppedFoothold();
FootstepNodeTools.getSnappedNodeTransform(node, snapData.getSnapTransform(), snappedTransformToWorld);
snappedTransformToWorld.appendTranslation(0.0, 0.0, 0.01);
planarTransformToWorld.setTranslationZ(snappedTransformToWorld.getTranslationZ() + 0.1);
Color regionColor = valid ? Color.GREEN : Color.RED;
regionColor = Color.hsb(regionColor.getHue(), 0.9, 1.0);
Point2D[] vertices = new Point2D[foothold.getNumberOfVertices()];
for (int j = 0; j < vertices.length; j++)
{
vertices[j] = new Point2D(foothold.getVertex(j));
}
meshBuilder.addMultiLine(snappedTransformToWorld, vertices, 0.01, regionColor, true);
meshBuilder.addPolygon(snappedTransformToWorld, foothold, regionColor);
// TODO add mesh of planar footstep
meshView.setOpacity(0.9);
meshView.setMesh(meshBuilder.generateMesh());
meshView.setMaterial(meshBuilder.generateMaterial());
}
代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers
private Node createBorderEdgesGraphics(PlanarRegionSegmentationRawData rawData, ConcaveHullFactoryResult concaveHullFactoryResult)
{
int regionId = rawData.getRegionId();
JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(16));
Point3D planeOrigin = rawData.getOrigin();
Quaternion planeOrientation = rawData.getOrientation();
Color regionColor = OcTreeMeshBuilder.getRegionColor(regionId);
for (ConcaveHullVariables intermediateVariables : concaveHullFactoryResult.getIntermediateVariables())
{
Set<QuadEdge> borderEdges = intermediateVariables.getBorderEdges();
for (QuadEdge edge : borderEdges)
{
Point3D dest = PolygonizerTools.toPointInWorld(edge.dest().getX(), edge.dest().getY(), planeOrigin, planeOrientation);
Point3D orig = PolygonizerTools.toPointInWorld(edge.orig().getX(), edge.orig().getY(), planeOrigin, planeOrientation);
boolean isEdgeTooLong = dest.distance(orig) > parameters.getEdgeLengthThreshold();
Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), isEdgeTooLong ? 0.25 : regionColor.getBrightness());
meshBuilder.addLine(dest, orig, 0.0015, lineColor);
}
}
MeshView meshView = new MeshView(meshBuilder.generateMesh());
meshView.setMaterial(meshBuilder.generateMaterial());
meshView.setMouseTransparent(true);
return meshView;
}
代码示例来源:origin: com.jfoenix/jfoenix
(int) (newColor.getBlue() * 255));
String hsb = String.format("hsl(%d, %d%%, %d%%)",
(int) (newColor.getHue()),
(int) (newColor.getSaturation() * 100),
(int) (newColor.getBrightness() * 100));
内容来源于网络,如有侵权,请联系作者删除!