From: Armin S. <li...@ar...> - 2005-09-21 16:48:44
|
Hallo, > Note that usually in PyX, attributes come in lists, so the PyX-way of > doing this would be > > point(x, y, [symbol.cross]) > > Then you could also allow things like > > point(x, y, [color.rgb.red, symbol.cross]) This was really what my first attempt looked like, but then I thought that= =20 e.g. the color should be an attribute of the symbol. What I had in mind was= =20 the idea of using symbol in other places, too, e.g. line(x1, y1, x2, y2, [rgb.red, symbol.cross([rgb.blue])]). Just taking the symbol as a parameter and not a list of attributes is model= led=20 after the usage of the style parameter in plot(). I defined symbol as an=20 attribute (in contrast to a graph style) though, because of possible future= =20 usecases. > They are stored as attributes x_pt and y_pt, that is, in PS points. Ah, so I can access e.g. the vertices of a rect via the pathitems and x_pt,= =20 y_pt. Nice to know. Thanks! > However, "edges of a path" may not be a very well defined concept. I > could imagine something like the first and last point of a line and the > first and last points of a B=E9zier curve. If you want to use that, just > convert the path in a normpath and use that instead. I'm sorry. s/edges/vertices/. I missed this one. The idea was to have a=20 decorator that could emphasize e.g. the vertices of a triangle. > But your idea is still interesting. We could have something like: > > c.stroke(path.point(x, y), [deco.symbol.cross]) > > where point is a degenerate line: > > class point(line): > def __init__(x, y): > line.__init__(x, y, x, y) > > The advantage would be that one decouples the position x, y from the > rest of the symbol. One would have to think about the implications when > stroking/filling such an object, though. I like this idea. And it would fit into the concept of symbol.cross drawing= a=20 cross at each vertex of a general path. > An alternative solution without this problem would be to put the symbol > in the path (future: paths) module and have something like > > c.stroke(path.cross(x, y, size=3D3), [color.rgb.red]) > > Then, the separation between the position and the rest of the attributes > is drawn differently. > > Of course, we could also have a combination between both ways, with the > second way (via path(s)) being the more fundamental one. I don't know if a path.cross or a path.diamond would be of much use besides= =20 representing a point. But it may be worth some thoughts... Cheers =2D-=20 Armin Straub |