You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Anjello <An...@gmail.com> on 2010/07/07 17:58:17 UTC

CubicCurve2D in a Batik application

Hello,

I develop a java application which uses batik, and I need to split a curve
at a specific location. What I try to do is to convert the svg into an AWT
shape and do the splitting. It was succesful with the lines, however I do
not understand how the offset parameters work in the CubicCurve2D object. (I
am trying to use subdivide(double[] src, int srcoff, double[] left, int
leftoff, double[] right, int rightoff) method)

Tried hard to find any examples but failed. Can someone please explain how
scroff, leftoff and rightoff parameters work? or please send me a link from
where I can get some examples or advice? I do understand the arrays that are
passed.

Thanks in advance,
Anjello
-- 
View this message in context: http://old.nabble.com/CubicCurve2D-in-a-Batik-application-tp29098061p29098061.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: CubicCurve2D in a Batik application

Posted by Anjello <An...@gmail.com>.
Hello Thomas,

Thank you for your reply. So, since it is unable to use the
CubicCurve2D.subdivide() to split the curve at a specified location, I wrote
my own method to split the curve by first running a path Iterator to find a
segment closest to the split point, and then using deCasteljau algorithm.
Seems to work well so far.

Thanks once again for taking time to reply me!
Anjello


thomas.deweese wrote:
> 
> Hi Anjello,
> 
> Anjello <An...@gmail.com> wrote on 07/07/2010 11:58:17 AM:
> 
>> I develop a java application which uses batik, and I need to split a 
> curve
>> at a specific location. What I try to do is to convert the svg into an 
> AWT
>> shape and do the splitting. It was succesful with the lines, however I 
> do
>> not understand how the offset parameters work in the CubicCurve2D 
> object. (I
>> am trying to use subdivide(double[] src, int srcoff, double[] left, int
>> leftoff, double[] right, int rightoff) method)
> 
>         Those are offsets into the src, left, and right arrays.  The 
> CubicCurve2D
> class doesn't let you split a curve at a specific location it only allows 
> you
> to subdivide a curve into two "equal" halves.  The offset parameters let 
> you
> allocate one large array and then store the subdivided cubics into that 
> array.
> 
>         You might want to look at Batik's 
> org.apache.batik.ext.awt.geom.Cubic
> class that offers a bit more flexibility in subdividing cubic curves. 
> Several
> classes in that package use the methods to subdivide cubics for the text
> wrapping code.
> 
> 

-- 
View this message in context: http://old.nabble.com/CubicCurve2D-in-a-Batik-application-tp29098061p29128080.html
Sent from the Batik - Users mailing list archive at Nabble.com.


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


Re: CubicCurve2D in a Batik application

Posted by th...@kodak.com.
Hi Anjello,

Anjello <An...@gmail.com> wrote on 07/07/2010 11:58:17 AM:

> I develop a java application which uses batik, and I need to split a 
curve
> at a specific location. What I try to do is to convert the svg into an 
AWT
> shape and do the splitting. It was succesful with the lines, however I 
do
> not understand how the offset parameters work in the CubicCurve2D 
object. (I
> am trying to use subdivide(double[] src, int srcoff, double[] left, int
> leftoff, double[] right, int rightoff) method)

        Those are offsets into the src, left, and right arrays.  The 
CubicCurve2D
class doesn't let you split a curve at a specific location it only allows 
you
to subdivide a curve into two "equal" halves.  The offset parameters let 
you
allocate one large array and then store the subdivided cubics into that 
array.

        You might want to look at Batik's 
org.apache.batik.ext.awt.geom.Cubic
class that offers a bit more flexibility in subdividing cubic curves. 
Several
classes in that package use the methods to subdivide cubics for the text
wrapping code.