-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
SVG rendering clips points at the boundaries. #1091
Comments
That's interesting, it looks like |
Ok, I think I found the definition:
So the definition should be
|
This looks like an issue with |
This may also be a "problem" in asymptote: maybe it's the caller's responsibility to add some padding around the image to avoid this. @rocky I don't quite understand how the images are generated, but I do have a lot of experience writing SVG by hand and I'm sure it's a problem with I don't know what's the most appropriate place for the patch. Maybe this is Combinatorica-specific and we should patch Combinatorica. I don't like this option because we would become responsible for maintaining the patch over time. Maybe this a generalized issue with All in all, here's what I think we should do:
|
Here is what I remember when I looked at this the other day. The points are positioned starting at (x,y) = (0,0). As you suggest, the problem is that the layout is not taking into account the radius of the points. The specific place where things start to go wrong is in boxes_to_xml which I mentioned in my rant the other day. Intuitively obvious that this is where you'd look, right? The xmin,ymin values (the dot with 3/4ths of it chopped off), has negative xmin,ymin. Yes, one could add a padding, but I don't know if that kind of concept appears in WL. The approach I looked at was to use a SVG transform(translate()) to adjust (0,0), to xmin, ymin. SVG transform seems to be implemented but I don't know that it is used anywhere. And Poke1024's incomplete graphics work seems to try to address that too, at least at some point, which you can see in the pdf he copied. I think this is related to #1078 which also probably needs translate to work properly. Getting translate fixed would go a long way towards improving our graphics overall since this is probably the reason our axes do not have labels on them. |
Yeah, I was looking into fixing the specific example you provided an it looks like we'll have to use |
We know that this is returning the wrong width and height (and h and w) values when xmin/ymin are less than 0. That's also true when xmax, and ymax are greater than what it returns as well.
|
Here is what's going on. Basically PointSize is not implemented. And equally bad a PointBox is computed assuming that points have a radiius/diameter/area of zero! But when the formatting routines eventually get called, of course they set the radius to some nonzero value. So of course those are going to extend outside of the SVG viewport. PointSize here is specified as a fraction of the overall width. And I don't see that this is known until very late graphics processing, such as after at least an initial guess is made. @mmatera here is an example where you could conceive of the format step making use of Mathics evaluation. A PointSize could be kept as a Mathics symbolic expression and so when the size is known the Mathics symbolic expression is turned into an actual value. (Another approach is just to bind this to some sort of Python function which is passed the size when it is known.) |
To replicate
The text was updated successfully, but these errors were encountered: