java2D rysowanie kół i ich fragmentow

0

chcę sobie narysować diagram kołowy w Java 2D. Mam pytanie, jak się zabrać za rysowanie koła a następnie podzielenie go na części (jak to w diagramie kołowym...). Cel to coś takiego jak to:
http://zabi_p.webpark.pl/diagram%20do%20zad%201,2.jpg

tylko jak to rozwiazac algorytmicznie?
z gory dzieki za pomoc

0

W klasie Graphics masz metodę :

fillArc

public abstract void fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)

Fills a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.

Parameters:
    x - the x coordinate of the upper-left corner of the arc to be filled.
    y - the y coordinate of the upper-left corner of the arc to be filled.
    width - the width of the arc to be filled.
    height - the height of the arc to be filled.
    startAngle - the beginning angle.
    arcAngle - the angular extent of the arc, relative to the start angle.
See Also:
    drawArc(int, int, int, int, int, int)

Służy do rysywania kół, elips oraz ich wycinków. Z takich kilku wycinków na pewno ułożysz bez problemu diagram.

1 użytkowników online, w tym zalogowanych: 0, gości: 1