0
458.41016 425.70843 427.74316 392.55343 403.93516 370.91243 
399.48516 366.83843 398.54916 368.02743 397.41516 372.27043 
394.75116 382.25643 392.96616 392.69543 391.09516 402.03043 
390.35916 405.62343 389.79116 406.92443 392.62616 409.52743 
406.00316 421.83343 442.19716 458.07143 444.89016 482.76843 
431.76716 528.31343 393.39116 574.56743 350.22516 594.56743 
316.63916 610.12643 278.88716 614.34043 242.18316 610.35243 
232.12112 609.27843 228.38012 619.29143 238.47016 621.92243 
274.01216 631.28543 320.32416 637.73643 356.57416 628.91043 
420.03416 613.46343 456.48216 533.71643 457.61616 470.82943

I have this data. They're for drawing shapes based on cubic curves, I used curveTo() method and I should begin with moveTo() method these methods are in GeneralPath class, each 6 points are one curve, and the last 2 points are used for moveTo() method.

How can I implement that programmatically in each line the last 2 points are for moveTo?

For example the first line is:

path.moveTo(403.93516,370.91243)
path.curveTo(458.41016, 425.70843, 427.74316, 392.55343 ,403.93516 ,370.91243) 

And each line the same way. this question is related to Split and Replace methods in java

Community
  • 1
  • 1
a14
  • 31
  • 15
  • 1
    Your question is not clear for me atleast – Keerthivasan Jan 09 '14 at 09:17
  • 1
    What have you tried? What's the problem? In waht form do you have this data (a text file, a list of lists, a 2D array?) – JB Nizet Jan 09 '14 at 09:19
  • 1
    if I'm reading your description right, you have the order reversed: the first two values are your moveTo x/y coordinates, then every 6 coordinates are curveTo data. Where's the loose 2 values in your quoted data block? (each line shows 6 values) – Mike 'Pomax' Kamermans Jan 09 '14 at 09:21
  • For better help sooner, post an [SSCCE](http://sscce.org/). Note the document is being reviewed and discussed on [this question](http://meta.stackexchange.com/q/214955/155831), contributions welcome. – Andrew Thompson Jan 09 '14 at 09:21
  • @Octopus, i am drawing shapes using java graphics2D, these points are used to draw cubic curve, cubic curve has 8 points, first 2 points are for moveTo() and the rest points are for curveTo() method – a14 Jan 09 '14 at 09:23
  • @Mike'Pomax'Kamermans there's no lost because the end of last 2 points in curveTo() is the starting for the next curve and so – a14 Jan 09 '14 at 09:25
  • okay, so where's the very first 2 points then? you still need an initial moveTo, because curveTo takes two control points and an endpoint. – Mike 'Pomax' Kamermans Jan 09 '14 at 09:26
  • Paraphrase the problem, it's unclear to us. Is the problem to read in the data from a file? Or how to store the 6 values and then how to pass them to the methods? Better clarify and change the title of this question accordingly. – LastFreeNickname Jan 09 '14 at 09:28
  • @Mike'Pomax'Kamermans the first moveTo is the last 2 points of the curveTo, they are (457.61616, 470.82943) – a14 Jan 09 '14 at 09:29
  • in that case your question needs clarification: is the block of data that you show one (closed) shape, or do you want to generate closed individual bezier curves? (which is what the second half of your question implies) – Mike 'Pomax' Kamermans Jan 09 '14 at 09:34
  • You're welcome (though I'm not sure what I did to deserve thanks). But note that I would ***prefer*** you spend your time answering the questions of @JBNizet, which will be of much more help in solving this problem. – Andrew Thompson Jan 09 '14 at 09:37
  • well, it's part of this question http://stackoverflow.com/questions/20608272/split-and-replace-methods-in-java – a14 Jan 09 '14 at 10:13
  • also belongs to this question http://stackoverflow.com/questions/20465837/retrieving-path-from-mysql-database-to-draw-bezier-curve-on-jframe – a14 Jan 09 '14 at 10:16

0 Answers0