Question

Ok

I have the line and the component. The component itself is a JPanel. I draw shapes inside it. And adding the shape to the container. This shape can be any polygon. And drawing a curved line (this can be Line2D, CubicCurve2D or QuadCurve2D) in a container.

Now I need to draw an arrow shape on the container so that while moving a line this arrow would span around the shape.

There can be many curve lines connected to the center of the shape with different Control point. And the shape can be any regular polygon.

At least I need the intersection points of the rounded rectangle and the curve line below image.

Edit: I want to determine the intersection points of a curved line and an arbitrary regular polygon. Given polygon width, height, center points and the starting, ending and the control points of the line.

enter image description here


Edit: I can't post questions so I will edit this one. How can I zoom both JComponents and Graphics object? If it should done with AffineTransform then how should I transform event points on JComponents?

Was it helpful?

Solution

You can use BasicStroke and getStrokedShape(). Set thickness=e.g. 5 and get stroked shapes of the Polygon and Line. Then create 2 Area classes based on the stoked shapes and get intersection Shape.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top