public YoAppearanceRGBColor(MutableColor color, double transparency) { this.color = new MutableColor(color); awtColor = new Color(this.color.getX(), this.color.getY(), this.color.getZ(), (float) (1.0 - transparency)); setTransparency(transparency); }
public MutableColor(float x, float y, float z) { set(x, y, z); }
public static MutableColor stringToColor(String color) { String[] vecString = color.split("\\s+"); MutableColor color3f = new MutableColor(Float.parseFloat(vecString[0]), Float.parseFloat(vecString[1]), Float.parseFloat(vecString[2])); return color3f; }
public float getGreen() { return color.getY(); }
public float getRed() { return color.getX(); }
public float getBlue() { return color.getZ(); }
private static YoArtifactOval yoArtifactOvalFromMessage(String name, YoVariable<?>[] vars, double[] consts, AppearanceDefinition appearance) { return new YoArtifactOval(name, (YoDouble) vars[0], (YoDouble) vars[1], (YoDouble) vars[2], appearance.getColor().get()); }
public static MutableColor parseColor3f(String color) { try { StringTokenizer s = new StringTokenizer(color, ","); return new MutableColor(new float[] {Float.parseFloat(s.nextToken()), Float.parseFloat(s.nextToken()), Float.parseFloat(s.nextToken())}); } catch (Exception e) { return null; } } }
private static YoArtifactPosition yoArtifactPositionFromMessage(String name, YoVariable<?>[] vars, double[] consts, AppearanceDefinition appearance) { return new YoArtifactPosition(name, (YoDouble) vars[0], (YoDouble) vars[1], YoGraphicPosition.GraphicType.values()[(int) (double) consts[1]], appearance.getColor().get(), consts[0]); }
private static Material convertMaterial(AppearanceDefinition appearance) { float r = appearance.getColor().getX(); float g = appearance.getColor().getY(); float b = appearance.getColor().getZ(); double transparency = appearance.getTransparency(); if (appearance instanceof YoAppearanceRGBColor) { transparency = 1.0 - transparency; } Color color = new Color(r, g, b, transparency); PhongMaterial res = new PhongMaterial(color); res.setSpecularColor(Color.WHITE); return res; }
public YoAppearanceRGBColor(double red, double green, double blue, double transparency) { color = new MutableColor((float) red, (float) green, (float) blue); awtColor = new Color((float) red, (float) green, (float) blue, (float) (1.0 - transparency)); setTransparency(transparency); }
public void set(MutableColor other) { set(other.x, other.y, other.z); }
private static YoArtifactPolygon yoArtifactPolygonFromMessage(String name, YoVariable<?>[] vars, double[] consts, AppearanceDefinition appearance) { ReferenceFrame referenceFrame = ReferenceFrame.getWorldFrame(); int i = 0; YoInteger yoNumVertices = (YoInteger) vars[i++]; ArrayList<YoFramePoint2D> yoFramePoints = new ArrayList<YoFramePoint2D>(); while (i < vars.length) { yoFramePoints.add(new YoFramePoint2D((YoDouble) vars[i++], (YoDouble) vars[i++], referenceFrame)); } YoFrameConvexPolygon2D convexPolygon2d = new YoFrameConvexPolygon2D(yoFramePoints, yoNumVertices, referenceFrame); return new YoArtifactPolygon(name, convexPolygon2d, appearance.getColor().get(), consts[0] > 0); }
public YoAppearanceRGBColor(Color color, double transparency) { this.color = new MutableColor(color); awtColor = new Color(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, (float) (1.0 - transparency)); setTransparency(transparency); }
public MutableColor(Color color) { set(color); }
private static YoArtifactLineSegment2d yoArtifactLineSegment2DFromMessage(String name, YoVariable<?>[] vars, double[] consts, AppearanceDefinition appearance) { YoFrameLineSegment2D segment = new YoFrameLineSegment2D((YoDouble) vars[0], (YoDouble) vars[1], (YoDouble) vars[2], (YoDouble) vars[3], ReferenceFrame.getWorldFrame()); return new YoArtifactLineSegment2d(name, segment, appearance.getColor().get()); }
public void publish(Point3D[] points, MutableColor color, String frameId) { PointCloud2 message = getMessage(); message.getHeader().setFrameId(frameId); message.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis())); message.setHeight(1); message.setWidth(points.length); message.setPointStep(pointType.getPointStep()); int dataLength = pointType.getPointStep() * points.length; message.setRowStep(dataLength); message.setIsBigendian(false); message.setIsDense(true); message.setFields(pointType.getPointField()); ChannelBuffer buffer = new LittleEndianHeapChannelBuffer(dataLength); for(int i=0;i<points.length;i++) { buffer.writeFloat((float)points[i].getX()); buffer.writeFloat((float)points[i].getY()); buffer.writeFloat((float)points[i].getZ()); buffer.writeByte((int)color.getZ()); buffer.writeByte((int)color.getY()); buffer.writeByte((int)color.getX()); buffer.writeByte(0); //dummy; } message.setData(buffer); publish(message); }