Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Measures anywhere #208

Open
pnutus opened this issue Aug 8, 2014 · 5 comments · May be fixed by #246
Open

Using Measures anywhere #208

pnutus opened this issue Aug 8, 2014 · 5 comments · May be fixed by #246

Comments

@pnutus
Copy link
Contributor

pnutus commented Aug 8, 2014

I want to create a function that labels the angles of a polygon. The arcs (and for right angles, squares) that mark the angles should not scale with the polygon, neither should the user have to specify their size each time. The same goes for labels. I want to put labels beside each mark, which is simple using cat', but the separation between the arc and the text shouldn't have to be hardcoded.

I want to be able to make stuff using Measures, just like fontSize, lineWidth, etc. But I can't figure out how to do this. ScaleInv might help, but I want the marks' size to change dynamically with the size of the output.

@pnutus pnutus changed the title Using Measure anywhere Using Measures anywhere Aug 8, 2014
@pnutus pnutus changed the title Using Measures anywhere Using Measures anywhere Aug 8, 2014
@bergey
Copy link
Member

bergey commented Aug 8, 2014

At least in the current design, it's only possible to use Measure for things which have point Envelopes. The non-Local Measure depends on the total size of the Diagram, so we need to be able to calculate the size of the Diagram before handling Measure. Put another way, it's easy to write unsolvable diagrams, like "two circles side by side, each with a diameter equal to the whole diagram".

I'd probably write a function which takes the polygon description, including any scale factor, and draws both the polygon and the labels, so that no further scaling is needed after that.

@pnutus
Copy link
Contributor Author

pnutus commented Aug 8, 2014

Oh, but these are point-like in the sense that I'm not interested in doing anything with their Envelopes. They are annotations/labels and could be thought of as a special layer that doesn't "interact" with the rest of the diagram.

What is the current story for labels? I think I read somewhere that improvements are planned.

@bergey
Copy link
Member

bergey commented Aug 21, 2014

@jeffreyrosenbluth Are you planning some way of labeling arrows?

It's possible the fixpoint changes (which I hear are coming early next year) will provide a framework for this sort of thing, where you take responsibility for ensuring that the recursion converges / terminates.

In the meantime, you can roll your own by putting some sort of placeholder (which conveys orientation and angle) with a point envelope in the Diagram when you define the polygon. Walk the diagram before rendering, and replace each placeholder with a suitably scaled Path. withName might come in handy.

@jeffreyrosenbluth
Copy link
Member

@bergey I feel pretty strongly that labeling should not be limited to arrows. I.e. we should design a labeling API more generally so that any diagram could be labeled. For example we should be able to label the edges and vertices of a polygon, tree, graph, etc. I have spent some time looking at how this is done in the TeX world, e.g. Asymptote and TikZ but the "relative" nature of composition in diagrams makes these examples less than helpful.

I think the place to start is to have a discussion about design, perhaps a wiki entry. I'll try to start one in the next few days.

@bergey
Copy link
Member

bergey commented Aug 21, 2014

Sounds great, thanks.

@cchalmers cchalmers linked a pull request Apr 22, 2015 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants