prepare manual for rest conversion
[PyX/mjg.git] / examples / path / at.txt
blob6a10ffa2ebbaad50bd9f13554882bbacc42f72dd
1 Positions along a path
3 There are several methods to access certain positions at a path. At first there
4 are `atbegin` and `atend` methods, which return a coordinate tuple. ...
6 ! In this example, we have defined a small helper function `mark` to which we
7 can pass the return value of the `at...` methods. We do this by transforming
8 the sequence in to positional argument of the function call. This Python
9 language feature is available by the `*` syntax in the call.
11 ! The coordinates returned by the `at...` methods are PyX lengths in the
12 unscaleable true units similar to the return value of the `arclen` method.
14 For the left path `p1`, we also show how to use the `at` method,
15 which can be used to get the coordinates of a certain point of the path
16 depending on the arc length along the path.
18 A different use of the `at` function is shown for the right path `p2`: It is
19 also possible to pass parametrization instances of the path to the `at` method.
20 In the shown case we first fetch such parametrization instances for the
21 beginning and the end of the path by the `begin` and `end` methods. Note that
22 the `atbegin` method is equal to call `at` with the result value of the `begin`
23 method (except for optimizations: atbegin is faster than the two calls).
24 Similar `atend` could be rewritten using the result value of `end`. As shown in
25 the example you can use the parametrization instances to add and substract arc
26 lengths from selected point.
28 ! The `at` method of a path instance can not only handle a single value, in
29 which case it returns a single result tuple. You can also pass a list to the
30 method and the return value will contain a list of coordinate tuples. You
31 should bear in mind that passing a list is much more efficient than multiple
32 calls of the method performing single conversions at each time.