SpectralSequences / latex

Latex package to print spectral sequence diagrams using pgf/tikz.
9 stars 4 forks source link

Bent structlines do not start at center of class #15

Closed dalcde closed 2 years ago

dalcde commented 2 years ago

Minimal example:

\documentclass{article}
\usepackage{spectralsequences}

\begin{document}
  \begin{sseqpage}
    \class(0, 0)
    \class(1, 1)
    \structline[bend left = 50]
  \end{sseqpage}
\end{document}

Instead of the structline starting from the center of the class, it starts at the point where it would have left the node if it were straight. This looks extremely odd for a very bent structline.

Screenshot from 2022-01-03 17-15-45

hoodmane commented 2 years ago

There is a frustrating compromise here: I am not sure how to calculate the right start location of the bent line, but people sometimes use dots with no fill, and then it doesn't look correct. Maybe there could be a setting to choose which way, since going to the center is faster and better as long as the shape is filled, but with no fill it's better to use the setback.

I implemented a real solution to the problem of calculating Bezier setbacks at one point in Rust, but it is pretty tricky -- I do a first order approximation of Bezier arclength and then set back the start point by that much, then calculate the error and estimate again. This generally produces a point right on the boundary of the shape. I think on a diagram with lots of bent lines, this would take an unacceptably long time in latex.

As you pointed out, all of the math is much easier if you use circular paths rather than Bezier curves.

hoodmane commented 2 years ago

You can use:

\begin{sseqpage}
    \class(0, 0)
    \class(1, 1)
    \structline[bend left = 50, source anchor=center, target anchor=center]
\end{sseqpage}

for this.

But it doesn't seem like source anchor and target anchor work as a style option: edges={source anchor=center, target anchor=center} doesn't seem to work.

hoodmane commented 2 years ago

Okay, but the following also works fine:

\begin{sseqpage}[structlines={source anchor=center, target anchor=center}]
    \class(0, 0)
    \class(1, 1)
    \structline[bend left = 50]
\end{sseqpage}
dalcde commented 2 years ago

That results in the structline being drawn on top of the class though, which is less desirable.

hoodmane commented 2 years ago

Fair enough, I will look into it and see what I can do.

hoodmane commented 2 years ago

I guess this was simpler than I expected.