From: André W. <wo...@us...> - 2011-07-07 20:51:05
Attachments:
smime.p7s
|
(I just noticed that I missed to send a copy of my answer to the list, so I'm sending it again.) Dear Michael, overall I like this module very much. Some random remarks from a quick review: You could use self.x_pt etc. internally instead of self.x to remind yourself, that those properties are not PyX length internally anymore. We did so in the path module. Jörg and I kind of agreed and like this convention. You already did that in part of the code (like controlcurve_pt), but in other cases you didn't (like knot_pt). The float comparisions should probably use an epsilon. In _mp_make_choices the comparisons look similar to the epsilon we have in normpath (epsilon in units of pt). This epsilon could be a parameter of the path, defaulting to 1e-5pt. However, this would mean you can't use *elems to receive the list of elements. Instead path should take a list of elements. We had this issue at other places as well and resolved it by using lists. I suggest to do it here too. In _mp_solve_choices the comparisions are probably similar to the epsilon found at various places in the graph (epsilon in units of 1 like the graph coordinates). It could also be a named parameter of the path. We need a second name for this epsilon. We could rename this other epsilon in the graph too, no problem. Suggestions? isinstance is not a pythonic solution. Maybe you could check for attributes to distinguish between the different types. But, well, probably just ignore this comment. I suggest to move this module into a directory metapost (in favor of mpost) and name it path. This module really is about metapost path creation and there are other things in metapost, we can implement too (like the linear equation solver; we already have some code for that, which is however not yet integrated in PyX). The module needs some documentation in the manual. Some very small documentation will probably do the job, but without any documentation, most users probably won't notice this functionality at all. Do you understand why you can't reproduce some cases in the functional examples? I didn't even tried to understand that. Best, André Am 04.07.2011 um 12:35 schrieb Michael SCHINDLER: > Salut André and Jörg, > > I added a module to imitate the path construction technique of > MetaPost. The original idea was to have a means to easily get > nice-looking smooth curves, for example to be used in simple cases of > function plotting. I was first considering to write a > graph.style.curve class, but did not know how to do this properly > without refined re-evaluation of points. Now, it would be rather a > deformer which takes the series of lines and turns it into curves. The > result is then at the responsability of the user (data representation > _is_ difficult). > > In my first attempts, I tried to directly use the C code of MetaPost, > but there is so much initialisation going on, that I did not succeed. > So, I translated the C code, which is based on integer arithmetics > into double-based Python code. I left as much of the original > structure as I could (that's why there are so many functions _mp_*). > > For the interface, I scratched my head for quite some time. The > essential task is to reasonably distribute the different properties of > the metapost knots (smooth tangents, curlyness, given direction, > endpoint, ... see mpman.pdf) to some classes. I now did it like this: > > * For me, the tension is a property of the link, although what is > specified are the tensions at its end. This is why I have a > tensioncurve. > * If control points are specified manually, also the metapost language > only allows to specify both of them for one curve element. And I > think that is required also in the internals of the algorithm. > So, I kept that and made a controlcurve. > > * The remaining three properties, > endpoint > curlyness > tangent direction > are kept as properties of the knots. > > Please have a look at it to see whether the logics is consistent and > convenient in your minds as well. There are some examples in the > interface() routine of test/functional/test_mpost.py > > Michael > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > PyX-devel mailing list > PyX...@li... > https://lists.sourceforge.net/lists/listinfo/pyx-devel -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |