From: Susan S. <sus...@gm...> - 2012-10-01 04:35:50
|
Nathan, Thanks for this info! Replies are inline... On Sun, Sep 30, 2012 at 5:53 PM, Nathan Hurst <nj...@nj...> wrote: > On Sun, Sep 30, 2012 at 05:12:27PM -0500, Susan Spencer wrote: > > Hi developers, > > > > Here are some examples of current output using > > the tmtp library <https://github.com/sconklin/tmtp.git> for pattern > design. > > > > https://docs.google.com/open?id=0BxsnjDIHW4yvNGZEMGlNSGpzblk > > https://docs.google.com/open?id=0BxsnjDIHW4yvTVFndHIyYnBoZjA > > https://docs.google.com/open?id=0BxsnjDIHW4yvck9iMGVVTWFXMFU > > freaken awesome. I just spent several hours reverse engineering a > teeshirt pattern I liked: this would have been very handy! > > Something I would like is a way of tracing the support lines from body > measurements and using them to adjust the pattern. I have no idea how > to do this :) > Do you have a drawing or diagram to illustrate? Send me email, it sounds do-able. > > It would improve the tmtp project to replace functions like > > pointOnCurveAtLength() and lengthOnCurveAtPoint() > > with calls to cy2geom/lib2geom code. > > > > The data structures are very simple, > > a point is a python object with x & y values. > > Point A is A.x, A.y, and A.name = 'A' > > Curve paths are python lists where a cubic curve P0 c1 c2 P1 > > is stored as curve[0],curve[1],curve[2],curve[3] > > Longer curves P0 c11 c12 P1 c21 c22 P2 are stored as > > curve[0],curve[1],curve[2],curve[3], curve[4],curve[5],curve[6] > > where the shared points (eg P1 in example) are not repeated. > > > > Can anyone give me examples for: > > 1.) returning a point at a known length on a curve, > > There are two ways to go about this, depending on how many points you > want. If you just want a single point then you could do it with a > root find on length, but if you want it for many values it would be > more efficient to use arc_length_parametrization(D2<SBasis> const &M, > unsigned order=3, > double tol=.01); > > which returns a new path which 't' is in length. arc_length_parametrization returns a new path in an SBasis form, right? Do you have links to a detailed description of SBasis, so I can write a mapping from the tmtp simple list structure into an SBasis structure and back again to a simple list? The tmtp function returns a list of the points found, but only the first item in the list is used (so far, anyway). > > > 2.) returning the length at a known or interpolated point on a > > curve, > > double length(path.portion(0,t)); > > should do that. > > > 3.) the point at an intersection of a line and a curve, > > 4.) the point at an intersection of two curves > > void find_intersections_bezier_clipping (std::vector< > std::pair<double, double> > & xs, > std::vector<Point> const& A, > std::vector<Point> const& B, > double precision = 1e-5); > > will find the intersection of two bezier curves (including lines) > Great! This would require the mapping function from tmtp list to lib2geom SBasis & back, and the results would be as you say, freaking awesome. > > > > 5.) interpolating a curve. > > What do you mean by this? the simplest interpolation would be to just > Lerp the control points. If you want something like the stretchy > rubber mat transforms in the toys/2dsb2d you are actually composing > curves. If you want something like path-along-path you are composing > with a 2d arc length parameterisation. > > For patterns I think the solution is somewhere in the middle of these > approaches: it's not an affine scaling transform because people aren't > all the same shape and you are actually also ensuring that both sides > of seam are the same length. I will think about it for a bit. > I have been interpolating a curve (typically into 100 interpolation points) and using the resulting list of points in finding an intersection with line (2 points) or curve (another list of 100 interpolated points). But this is not a best solution. > > > I have very simple code for these functions in tmtp, > > but I need to improve accuracy. > > Jan is the expert on the cy2geom bindings and I'm sure he'll be able > to give example code for these better than me. > > > Bonus points if anyone can produce an example for Bend Path!!! > > I obviously don't have code for this - see the 2nd file in list > > above. > > yeah, I think it's a variant of path-along-path. > > njh > path-along-path will open up a whole new territory...can't wait. Again, it sounds like I need more information about SBasis. Johan Engelen's presentation at LGM 2012 was excellent, but obviously I wasn't at the proper knowlege level yet to digest it all, it was a starting point for me. - Susan |