Alan,

Here comes a rather detailed explanation in the hope that
we might add this to the example code. Maybe you can polish
the formulation a bit.

On 18.07.08, Alan G Isaac wrote:
> The example at 
> http://pyx.sourceforge.net/gallery/graphs/integral.html
> includes the following code::
> 
> 
>     p = d.path # the path is available after the graph is finished

This line gives you the path of the curve drawn in the graph.
> 
>     pa = g.xgridpath(a)
>     pb = g.xgridpath(b)

The graph method xgridpath returs a path along a line of constant x in
the plot area of the graph. In the present case, these paths are used
for construction the two straight line segments forming the left and
right boundary of the grey area.

>     (splita,), (splitpa,) = p.intersect(pa)
>     (splitb,), (splitpb,) = p.intersect(pb)

Here, the top-left and top-right corners of the grey area are determined
by intersecting the curve's path with the left and right grid lines,
respectively. The intersect method returns a tuple of two lists of equal
length, where each lists contains the parameter values corresponding
to the intersection point. Here, the first list contains the result for
the path p and the second list the one for the paths pa and pb,
respectively.

>     area = (pa.split([splitpa])[0] <<
>             p.split([splita, splitb])[1] <<
>             pb.split([splitpb])[0].reversed())

Now the various paths are split at the intersection points and the right
segments are selected from the resulting list of paths. Then, these
segments are joined (using the << operator) to a single sub path. For
doing so, the last segment has to be reversed.

Best,

        Jörg

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to