You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Liu Benhong(Lewis)" <Le...@grapecity.com> on 2019/03/11 07:13:35 UTC

Draw arc with given data(start point, start angle, sweep angle, major axis, minor axis)

Hi,

                I'd like to know if you could help me with this problem:

              The only way to draw an arc when I use pdfbox is using bezier curve. However, I only have these data to describe an arc(start point, start angle, sweep angle, major axis, minor axis). So here is the problem: how could I draw an arc with these data or how could I transfer these data to bezier curve points?

I already read this solution on https://stackoverflow.com/questions/40781610/how-to-draw-a-pie-chart-using-pdfbox, but it didn't solve my problem when the length of major axis and minor axis are not equal.

Looking forward to hearing your answer, thank you very much!

Best regards,
Lewis.


Re: Draw arc with given data(start point, start angle, sweep angle, major axis, minor axis)

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 11.03.2019 um 14:24 schrieb Lachezar Dobrev:
>    I believe to OP means that the arc is part of an Ellipse, hence
> minor and major axis.


Oh. In that case I recommend to search on google, stackoverflow and 
math.stackexchange.com have a few answers just by searching for "bezier 
ellipse" (without quotes).

If not => ask a new question on http://math.stackexchange.com rather 
than the normal stackoverflow, to avoid people thinking that this is a 
pdfbox question.

I also wonder whether we could just draw a circular arc with radius 1, 
then (rather, before!) stretch the thing with an affine transform to fit 
the minor and major axis.


Tilman



>
> На пн, 11.03.2019 г. в 9:28 ч. Tilman Hausherr <TH...@t-online.de> написа:
>> Hi,
>>
>> I entered "sweep angle arc" into google images so now I see what you
>> mean with "sweep angle".
>>
>> When you write "major axis" and "minor axis", are these parallel? I.e.
>> you want to draw a "fat arc line", right?
>>
>> I'm thinking about two strategies:
>>
>> the first one would be to draw the shape using two arcs (see in the SO
>> link) and combining this (join the line) and fill the result
>>
>> the second would be to draw the line and stroke this line, but changing
>> the line width so that it is a "fat" line instead of the default width
>> 1, so you could use major - minor as the line width, and use  (major -
>> minor) / 2  as the radius.
>>
>> Is that what you need? And which strategy sounds better?
>>
>> Tilman
>>
>> Am 11.03.2019 um 08:13 schrieb Liu Benhong(Lewis):
>>> Hi,
>>>
>>>                   I'd like to know if you could help me with this problem:
>>>
>>>                 The only way to draw an arc when I use pdfbox is using bezier curve. However, I only have these data to describe an arc(start point, start angle, sweep angle, major axis, minor axis). So here is the problem: how could I draw an arc with these data or how could I transfer these data to bezier curve points?
>>>
>>> I already read this solution on https://stackoverflow.com/questions/40781610/how-to-draw-a-pie-chart-using-pdfbox, but it didn't solve my problem when the length of major axis and minor axis are not equal.
>>>
>>> Looking forward to hearing your answer, thank you very much!
>>>
>>> Best regards,
>>> Lewis.
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Draw arc with given data(start point, start angle, sweep angle, major axis, minor axis)

Posted by Lachezar Dobrev <l....@gmail.com>.
  I believe to OP means that the arc is part of an Ellipse, hence
minor and major axis.

На пн, 11.03.2019 г. в 9:28 ч. Tilman Hausherr <TH...@t-online.de> написа:
>
> Hi,
>
> I entered "sweep angle arc" into google images so now I see what you
> mean with "sweep angle".
>
> When you write "major axis" and "minor axis", are these parallel? I.e.
> you want to draw a "fat arc line", right?
>
> I'm thinking about two strategies:
>
> the first one would be to draw the shape using two arcs (see in the SO
> link) and combining this (join the line) and fill the result
>
> the second would be to draw the line and stroke this line, but changing
> the line width so that it is a "fat" line instead of the default width
> 1, so you could use major - minor as the line width, and use  (major -
> minor) / 2  as the radius.
>
> Is that what you need? And which strategy sounds better?
>
> Tilman
>
> Am 11.03.2019 um 08:13 schrieb Liu Benhong(Lewis):
> > Hi,
> >
> >                  I'd like to know if you could help me with this problem:
> >
> >                The only way to draw an arc when I use pdfbox is using bezier curve. However, I only have these data to describe an arc(start point, start angle, sweep angle, major axis, minor axis). So here is the problem: how could I draw an arc with these data or how could I transfer these data to bezier curve points?
> >
> > I already read this solution on https://stackoverflow.com/questions/40781610/how-to-draw-a-pie-chart-using-pdfbox, but it didn't solve my problem when the length of major axis and minor axis are not equal.
> >
> > Looking forward to hearing your answer, thank you very much!
> >
> > Best regards,
> > Lewis.
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Draw arc with given data(start point, start angle, sweep angle, major axis, minor axis)

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 11.03.2019 um 08:28 schrieb Tilman Hausherr:
> and use  (major - minor) / 2  as the radius. 

Oops, I think this should be


minor + (major - minor) / 2


as the radius of the "fat" line.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Draw arc with given data(start point, start angle, sweep angle, major axis, minor axis)

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

I entered "sweep angle arc" into google images so now I see what you 
mean with "sweep angle".

When you write "major axis" and "minor axis", are these parallel? I.e. 
you want to draw a "fat arc line", right?

I'm thinking about two strategies:

the first one would be to draw the shape using two arcs (see in the SO 
link) and combining this (join the line) and fill the result

the second would be to draw the line and stroke this line, but changing 
the line width so that it is a "fat" line instead of the default width 
1, so you could use major - minor as the line width, and use  (major - 
minor) / 2  as the radius.

Is that what you need? And which strategy sounds better?

Tilman

Am 11.03.2019 um 08:13 schrieb Liu Benhong(Lewis):
> Hi,
>
>                  I'd like to know if you could help me with this problem:
>
>                The only way to draw an arc when I use pdfbox is using bezier curve. However, I only have these data to describe an arc(start point, start angle, sweep angle, major axis, minor axis). So here is the problem: how could I draw an arc with these data or how could I transfer these data to bezier curve points?
>
> I already read this solution on https://stackoverflow.com/questions/40781610/how-to-draw-a-pie-chart-using-pdfbox, but it didn't solve my problem when the length of major axis and minor axis are not equal.
>
> Looking forward to hearing your answer, thank you very much!
>
> Best regards,
> Lewis.
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Draw arc with given data(start point, start angle, sweep angle, major axis, minor axis)

Posted by Tilman Hausherr <TH...@t-online.de>.
There's also a new answer here:
https://stackoverflow.com/questions/40781610/how-to-draw-a-pie-chart-using-pdfbox/55103584#55103584

I haven't tested his code but he has provided several other code parts 
to PDFBox and there were good.

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org