Java Code Examples for java.awt.geom.Arc2D#setArcByCenter()
The following examples show how to use
java.awt.geom.Arc2D#setArcByCenter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestImageGenerator.java From orbit-image-analysis with GNU General Public License v3.0 | 6 votes |
public TestImageGenerator(double[][] matrix, double[] gain, String[] channelNames, int width, int height) { this.matrix = matrix; this.gain = gain; this.channelNames = channelNames; this.rand = new Random(); this.sizeC = channelNames.length; this.width = width; this.height = height; this.concentrations = new List[sizeC]; this.signals = new double[sizeC][numCells]; // generate concentrations for (int s=0; s<sizeC; s++) { concentrations[s] = new ArrayList<>(numCells); for (int i=0; i<numCells; i++) { int x = rand.nextInt((int)(width-cellRadius)); int y = rand.nextInt((int)(height-cellRadius)); Arc2D p = new Arc2D.Double(Arc2D.CHORD); p.setArcByCenter(x, y, cellRadius, 0d, 360d, Arc2D.CHORD); concentrations[s].add(p); double density = (rand.nextGaussian() * 100d) + 100; signals[s][i] = density; } } }
Example 2
Source File: PieGraph.java From disthene-reader with MIT License | 6 votes |
private void drawSlices(List<Slice> slices) { double theta = 90; double halfX = (xMax - xMin) / 2.0; double halfY = (yMax - yMin) / 2.0; x0 = xMin + halfX; y0 = yMin + halfY; radius = Math.min(halfX, halfY) * 0.95; for (Slice slice : slices) { if (slice.getPercent() == null) continue; double phi = theta - 360 * slice.getPercent(); Arc2D pie = new Arc2D.Double(); pie.setArcByCenter(x0, y0, radius, theta, phi - theta, Arc2D.PIE); g2d.setPaint(slice.getColor()); g2d.fill(pie); slice.setMidAngle((90-theta) + (theta - phi) / 2); theta = phi; } }