java - Removing Path2D from Rectangle -
i trying remove bezier curve rectangle. have both shapes, have small problem when subtracting path2d object rectangle. here looks like:
as can see, don't want line @ bottom, under curve. code (no need worry values):
path2d path1 = new path2d.double(); path1.moveto(start_x, start_y); path1.curveto(control1_x, control1_y, control2_x, control2_y, end_x, end_y); path1.append(new line2d.double(start_x, start_y, end_x, start_y), false); path1.closepath(); g2.setcolor(color.blue); area shape = calculateoutside(path1); g2.fill(shape);
also, calculateoutside
method:
private area calculateoutside(path2d path) { area outside = new area(new rectangle2d.double(0, 0, width, height); outside.subtract(new area(path2d)); return outside; }
i tried appending line under curve true
constructor value. or tried without appending line. missing?
thanks help.
also, values if needs it:
int start_x = 60, start_y = 76; int control1_x = 57, control1_y = 49; int control2_x = 83, control2_y = 47; int end_x = 80, end_y = 76;
Comments
Post a Comment