## lib2geom-devel — development discussion

You can subscribe to this list here.

 2007 2008 2009 2010 2011 2012 2013 2014 2015 Jan (2) Feb (3) Mar (4) Apr (27) May (5) Jun Jul (14) Aug Sep (1) Oct (4) Nov (19) Dec Jan (8) Feb (1) Mar (4) Apr (28) May (77) Jun (79) Jul (112) Aug (36) Sep (33) Oct (19) Nov (9) Dec (11) Jan Feb Mar (12) Apr (11) May (13) Jun (23) Jul (5) Aug (25) Sep (9) Oct (22) Nov (16) Dec (5) Jan (23) Feb (12) Mar (5) Apr (29) May (4) Jun (9) Jul (22) Aug (2) Sep (10) Oct (6) Nov (8) Dec Jan (2) Feb (44) Mar Apr (4) May Jun (9) Jul (5) Aug (4) Sep (7) Oct Nov Dec (10) Jan (16) Feb (8) Mar (9) Apr (5) May (3) Jun (3) Jul (6) Aug (10) Sep (48) Oct (6) Nov Dec Jan Feb Mar Apr May Jun Jul Aug (19) Sep (3) Oct (5) Nov (35) Dec (3) Jan Feb (3) Mar (4) Apr (12) May (6) Jun (16) Jul (25) Aug (16) Sep (3) Oct Nov (7) Dec Jan (3) Feb (1) Mar (21) Apr (10) May (6) Jun (3) Jul (2) Aug (4) Sep Oct Nov Dec
S M T W T F S

1
(1)
2

3

4

5

6
(1)
7

8

9

10

11

12

13

14

15

16

17

18
(1)
19
(1)
20
(2)
21

22

23

24

25

26

27

28

29

30

31

Showing 6 results of 6

 Re: [Lib2geom-devel] Get 4 Points defined a Geom::Curve From: Johan Engelen - 2012-10-20 11:50:50 ```On 20-10-2012 13:26, Jabiertxo Arraiza Cenoz wrote: > Solved (Find the second handle position (p2) ): > Geom_::Curve foo = ... > Geom::Point p2 = ?; > if (foo) { > Geom::CubicBezier const * cubic = dynamic_cast( foo ); > if ( cubic && (*cubic)[2] != (*cubic)[3] ){ > p2 = (*cubic1)[2]; > } > } > Hi to all > > For find symmetric handle node I use this > Where g3 is the end node of previous curve and (*cubic1)[2] his second handle position. > (g0-(*penultimateGreenCubic)[2]) + g0 > Geom::Point symmhandle =(g3-(*cubic1)[2]) + g3; > Hi to all and sorry for repost Hello Jabiertxo, Although I do not understand completely what you are trying to compute, I can give you an important tip to improve your code. In most cases you should not do a direct floating point comparison. "(*cubic)[2] != (*cubic)[3]" will only evaluate to 'false' if both point are exactly the same (binary equivalent). Due to numerical errors, this is almost never the case, even if you think they should be the same. For example, "1.0/3.0 * 3.0 == 1.0" may evaluate to 'false'. Instead, you should use "Geom::are_near" to compare whether points or coordinates are the same or not. So "(*cubic)[2] != (*cubic)[3]" ---> "!are_near((*cubic)[2], (*cubic)[3])" Ciao, Johan ```
 Re: [Lib2geom-devel] Get 4 Points defined a Geom::Curve From: Jabiertxo Arraiza Cenoz - 2012-10-20 11:26:39 ```Solved (Find the second handle position (p2) ): Geom_::Curve foo = ... Geom::Point p2 = ?; if (foo) { Geom::CubicBezier const * cubic = dynamic_cast( foo ); if ( cubic && (*cubic)[2] != (*cubic)[3] ){ p2 = (*cubic1)[2]; } } Hi to all For find symmetric handle node I use this Where g3 is the end node of previous curve and (*cubic1)[2] his second handle position. (g0-(*penultimateGreenCubic)[2]) + g0 Geom::Point symmhandle =(g3-(*cubic1)[2]) + g3; Hi to all and sorry for repost ```
 [Lib2geom-devel] Get 4 Points defined a Geom::Curve [solved] From: Jabiertxo Arraiza Cenoz - 2012-10-19 17:58:29 ```Solved by myself (Find the second handle position (p2) ): Geom_::Cueve foo = ... Geom::Point p2 = ?; if (foo) { Geom::CubicBezier const * cubic = dynamic_cast( foo ); if ( cubic && (*cubic)[2] != (*cubic)[3] ){ //symm node -> p2 = g3 + ((*cubic1)[2] - g3)/3; p2 = (*cubic1)[2]; } } Hi to all ```
 [Lib2geom-devel] Get 4 Points defined a Geom::Curve From: Jabiertxo Arraiza Cenoz - 2012-10-18 18:09:54 ```Hi all, I'm new to the list, let me know if I make mistakes. I'm working on "inkscape" and took days locked because you like to find out where this either "handles" of a curve. I understand that a curve is defined by four points but I see no way to access the two intermediates that set the direction. I researched sbasis with unitTangentAt but without success. Anybody can help me? Thanks in advance. Translated by google. ```
 [Lib2geom-devel] cmake error From: Susan Spencer - 2012-10-06 02:44:01 Attachments: Message as HTML ```I've seen this message before and can't remember what I did to make it go away: CMake Error at src/2geom/CMakeLists.txt:157 (ADD_LIBRARY): Target "2geom" links to item "-lgsl -lgslcblas -lm " which has leading or trailing whitespace. This is now an error according to policy CMP0004 Any suggestions? - Susan ```
 Re: [Lib2geom-devel] cy2geom questions From: Susan Spencer - 2012-10-01 04:35:50 Attachments: Message as HTML ```Nathan, Thanks for this info! Replies are inline... On Sun, Sep 30, 2012 at 5:53 PM, Nathan Hurst 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 ; 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 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 > & xs, > std::vector const& A, > std::vector 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 ```

Showing 6 results of 6