Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3240 > unrolled thread
| Started by | "mearvk" <mearvk@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:43 +0000 |
| Last post | 2011-04-27 15:43 +0000 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.java.gui
CubicCurve2D Tracing "mearvk" <mearvk@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: CubicCurve2D Tracing "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: CubicCurve2D Tracing "mearvk" <mearvk@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: CubicCurve2D Tracing "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: CubicCurve2D Tracing "mearvk" <mearvk@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
Re: CubicCurve2D Tracing "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:43 +0000
| From | "mearvk" <mearvk@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:43 +0000 |
| Subject | CubicCurve2D Tracing |
| Message-ID | <f6976e08-2d48-4e53-9223-5e21015df589@b1g2000hsg.googlegroups.com> |
To: comp.lang.java.gui Given an arbitrary CubicCurve2D how can I iterate along it getting both the x and y coordinates of the current point as I go? Thanks. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:43 +0000 |
| Message-ID | <47d2a1e2$0$30720$7836cce5@newsrazor.net> |
| In reply to | #3240 |
To: comp.lang.java.gui mearvk wrote: > Given an arbitrary CubicCurve2D how can I iterate along it getting > both the x and y coordinates of the current point as I go? > > Thanks. Try: calling getPathIterator on it. <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Shape.html#getPathIterator(java.awt.geom.AffineTransform)> -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "mearvk" <mearvk@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:43 +0000 |
| Message-ID | <b8bab04d-5b9f-45b1-a56e-1ebe8c83745f@e60g2000hsh.googlegroups.com> |
| In reply to | #3248 |
To: comp.lang.java.gui On Mar 8, 12:29=A0pm, Daniel Pitts <newsgroup.spamfil...@virtualinfinity.net> wrote: > mearvk wrote: > > Given an arbitrary CubicCurve2D how can I iterate along it getting > > both the x and y coordinates of the current point as I go? > > > Thanks. > > Try: calling getPathIterator on it. > <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Shape.html#getPathIt...)= > > > -- > Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> Looking at the API I think PathIterator's currentSegment() will just get me the beginning, end and both control points. What I need is a way to, for instance, find the length of or iterate over, pixel by pixel, an arbitrary bezier curve. What I am actually doing is trying to find the shortest path along a pair of bezier curves (think race track) using a third bezier curve (think finding the apex). But how to grade the quality of the current best path? Surely the simplest thing to do would be to ask how long is the line? I was thinking if there were a way to map the start, end, and both control points onto a mathematical function, then I could just scale it appropriately and iterate pixel by pixel, summing as I go, but I'm not sure if this can be done. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:43 +0000 |
| Message-ID | <47d4dc2d$0$3298$7836cce5@newsrazor.net> |
| In reply to | #3249 |
To: comp.lang.java.gui mearvk wrote: > On Mar 8, 12:29 pm, Daniel Pitts > <newsgroup.spamfil...@virtualinfinity.net> wrote: >> mearvk wrote: >>> Given an arbitrary CubicCurve2D how can I iterate along it getting >>> both the x and y coordinates of the current point as I go? >>> Thanks. >> Try: calling getPathIterator on it. >> <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Shape.html#getPathIt...)> >> >> -- >> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> > > Looking at the API I think PathIterator's currentSegment() will just > get me the beginning, end and both control points. What I need is a > way to, for instance, find the length of or iterate over, pixel by > pixel, an arbitrary bezier curve. What I am actually doing is trying > to find the shortest path along a pair of bezier curves (think race > track) using a third bezier curve (think finding the apex). But how to > grade the quality of the current best path? Surely the simplest thing > to do would be to ask how long is the line? I was thinking if there > were a way to map the start, end, and both control points onto a > mathematical function, then I could just scale it appropriately and > iterate pixel by pixel, summing as I go, but I'm not sure if this can > be done. This might help: <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/FlatteningPathIterator.html> Also, Bezier curves are well defined mathematically, there is quite likely a formula to find the length given the endpoints and control points. A quick google turned up: <http://www.cit.gu.edu.au/~anthony/info/graphics/bezier.curves> Its actually an integral, so you are going about it in a reasonable way. FlatteningPathIterator is what you want. Just sum the distance between any two endpoints it gives you. -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "mearvk" <mearvk@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:43 +0000 |
| Message-ID | <ab4b3e8f-484e-411f-ba2b-5b02ad2243b2@d62g2000hsf.googlegroups.com> |
| In reply to | #3254 |
To: comp.lang.java.gui On Mar 10, 11:01=A0am, Daniel Pitts <newsgroup.spamfil...@virtualinfinity.net> wrote: > mearvk wrote: > > On Mar 8, 12:29 pm, Daniel Pitts > > <newsgroup.spamfil...@virtualinfinity.net> wrote: > >> mearvk wrote: > >>> Given an arbitrary CubicCurve2D how can I iterate along it getting > >>> both the x and y coordinates of the current point as I go? > >>> Thanks. > >> Try: calling getPathIterator on it. > >> <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Shape.html#getPathIt.= ..)> > > >> -- > >> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> > > > Looking at the API I think PathIterator's currentSegment() will just > > get me the beginning, end and both control points. What I need is a > > way to, for instance, find the length of or iterate over, pixel by > > pixel, an arbitrary bezier curve. What I am actually doing is trying > > to find the shortest path along a pair of bezier curves (think race > > track) using a third bezier curve (think finding the apex). But how to > > grade the quality of the current best path? Surely the simplest thing > > to do would be to ask how long is the line? I was thinking if there > > were a way to map the start, end, and both control points onto a > > mathematical function, then I could just scale it appropriately and > > iterate pixel by pixel, summing as I go, but I'm not sure if this can > > be done. > > This might help: > <http://java.sun.com/j2se/1.4.2/docs/api/java/awt/geom/FlatteningPathI...>= > > Also, Bezier curves are well defined mathematically, there is quite > likely a formula to find the length given the endpoints and control points= . > > A quick google turned up: > <http://www.cit.gu.edu.au/~anthony/info/graphics/bezier.curves> > > Its actually an integral, so you are going about it in a reasonable way. > =A0 FlatteningPathIterator is what you want. Just sum the distance between= > any two endpoints it gives you. > -- > Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>- Hide quo= ted text - > > - Show quoted text - Thank you both. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "tar" <tar@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:43 +0000 |
| Message-ID | <ymiiqzuh39c.fsf@blackcat.isi.edu> |
| In reply to | #3249 |
To: comp.lang.java.gui Well, you can get some results by Googling "bezier curve length" One promising approach, with C code, is: <http://steve.hollasch.net/cgindex/curves/cbezarclen.html> -- Thomas A. Russ, USC/Information Sciences Institute --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web