For the P2 you could use something like this:
GeneralPath path = new GeneralPath();
float p1x = 10, p1y = 10; // P1
float p2x = 100, p2y = 10; // P2
float cx = 55, cy = 50; // Control point of the curve
float arrSize = 5; // Size of the arrow segments
float adjSize = (float)(arrSize/Math.sqrt(2));
float ex = p2x - cx;
float ey = p2y - cy;
float abs_e = (float)Math.sqrt(ex*ex + ey*ey);
ex /= abs_e;
ey /= abs_e;
// Creating quad arrow
path.moveTo(p1x, p1y);
path.quadTo(cx, cy, p2x, p2y);
path.lineTo(p2x + (ey-ex)*adjSize, p2y - (ex + ey)*adjSize);
path.moveTo(p2x, p2y);
path.lineTo(p2x - (ey + ex)*adjSize, p2y + (ex - ey)*adjSize);
Best Regards,
Alexey
On Fri, Oct 28, 2005 at 08:10:51PM +0300, Thanasis (Hotmail) wrote:
> Hi to every one,
>
> what i want to achieve is to draw a quadratic arrow-headed curve between 2
> arbitrary points P1,P2.
> I already know how to draw a curve using the quadTo method of GeneralPath
> class.
> i don't know how to add an arrow to either P1 or P2.
>
> Thanks in advance
>
> Thanasis
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body of the message "signoff JAVA2D-INTEREST". For general help, send
> email to [EMAIL PROTECTED] and include in the body of the message
> "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".