pgf
                                
                                 pgf copied to clipboard
                                
                                    pgf copied to clipboard
                            
                            
                            
                        Adding timers for the `parabola`, `rectangle`, `sin` and `cos` path operators
Adding timers for the parabola, rectangle, sin and cos path operators using the same calculations as \pgfpathparabola, \pgfpathsine and \pgfpathcosine in pgfcorepathconstruct.code.tex.
The rectangle timer uses the timer for -|, i.e. the timer flows anticlockwise (just like the angles from 0 to 360).
Motivation for this change
- 
TeX.sx user CrazyArm wanted to place nodes along a rectanglepath.
- 
TeX.sx user cis wanted to place nodes along a parabolapath.
Example that use the new timers
\documentclass[tikz]{standalone}
\tikzset{
  inline node/.style={sloped, fill=white, font=\tiny, inner sep=+0pt},
  dot nodes/.style args={#1:#2:#3}{
    alias=@, inner sep=+.5pt, fill=black, circle, node contents=,
    append after command={(@) edge[gray, <-] node[gray, pos=1, font=\tiny, inner sep=+0pt,anchor={#1}]{#3} ++ (#2:.3cm)}},
  mark nodes online/.style={insert path={
    foreach \pos in {#1} {node[inline node, pos=\pos/10]{\pos}}}},
  mark nodes online/.default={1,...,4,6,7,...,9},
  mark nodes/.style={insert path={
    foreach \pos in {#1} {node[inline node, style/.expand once=\pos]{\pos}}}}}
\begin{document}
\begin{tikzpicture}[scale=2]
\coordinate [label=above right:Target] (A) at (0,0);
\coordinate [label=below left:Start] (B) at (2,1);
\draw[->, help lines] ([shift=(50:.8 and .3)] 1,.5) arc[start angle=50, delta angle=340, x radius=.8, y radius=.3];
\draw (B) rectangle (A)
  foreach \pos/\ang in {at start/90, very near start/90, near start/180, pos=.375/180,
                        midway/180, pos=.625/270, near end/0, very near end/0, at end/0}{
    node[dot nodes=\ang+180:\ang:\pos, style/.expanded=\pos]{}};
\end{tikzpicture}
\begin{tikzpicture}
    \draw[help lines]  (-2.25,-1.25) grid (2.25,3.25);
    \draw              ( 2,-1) parabola bend (0,0) (-1,3);
    \draw[ultra thick] (-2,-1) parabola bend (0,0) ( 1,3) [mark nodes online];
\end{tikzpicture}
\begin{tikzpicture}
    \draw[help lines] (-2.75,-2.75) grid (1.25, .75);
    \draw                      (-2,-2) parabola (1,0)
         foreach \pos in {0,1,...,10} {node[dot nodes=-18*\pos+90:-18*\pos+270:\pos, pos=\pos/10] {}};
\end{tikzpicture}
\begin{tikzpicture}
    \draw[help lines] (-2.1,-2.1) grid (2.1,0.1);
    \draw             (-2,-2) sin (1,0) [mark nodes online={1,...,9}];
    \draw[shift=(0:1)](-2,-2) cos (1,0) [mark nodes online={1,...,9}];
\end{tikzpicture}
\end{document}
Output
 
 
 

Checklist
Please signoff your commits to explicitly state your agreement to the Developer Certificate of Origin. If that is not possible you may check the boxes below instead:
This looks like a very nice addition, thanks!
However, we need tests for the old and the new behavior.
It would also be nice if you could write commit messages like Conventional Commits and sign them off.
However, we need tests for the old and the new behavior.
The old behaviour was:
- rectangleused the direct line timer previously (i.e. nodes were placed on the diagonal)
- the others didn't even use a timer
Obviously, this can change the outcome of previous documents. As I'm just realizing, the manual states that
[f]or all other path constructions operations [that aren't
--or.. controls ..], the position placement does not work, currently.
If this is considered a backwards compatibility break, I can add a key true/false key that switches the new timers on, manually, or create a separate library that would need to be loaded explicitly.
That said, the manual ought to be changed then, too. I didn't realize that the manual actually says something about "other path construction operators".
(My previous TeX.sx answer for rectangle used a switch already so that the old behaviour can stay and the new one can be used for positions between 1 and 2.)
It would also be nice if you could write commit messages like Conventional Commits and sign them off.
It doesn't look like I can do this retroactively. Shall I retract these commits and start from scratch? I don't know how else I could sign off the previous commits and change the messages.
If this is considered a backwards compatibility break
I will think about this and come back to you.
It doesn't look like I can do this retroactively.
You can rebase onto the upstream master and reword the messages: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
In a nutshell, execute
$ git remote add upstream https://github.com/pgf-tikz/pgf.git
$ git remote update
$ EDITOR=nano git rebase --signoff -i upstream/master
This will open the Nano text editor. Replace all occurences of pick with reword (or just r). Then save and close the file. Instead of EDITOR=nano you can also use EDITOR=gedit (to use Gedit) or EDITOR=code (to use VSCode).