#5514: [with patch, needs work] implement exclusions for parametric 3d plots
-------------------------+--------------------------------------------------
Reporter: wcauchois | Owner: wcauchois
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.0
Component: graphics | Keywords:
-------------------------+--------------------------------------------------
Comment(by wcauchois):
Replying to [comment:12 rbeezer]:
> Great progress on this, Bill and Jason! I had a go with a few of the
commands in the doctests and a couple of my own. Two thoughts.
Thanks for looking at this!
> 1. The JMOL bounding box may be computed pre-clip? Compare[[BR]]
> {{{plot3d(6-2*x^2-5*y^2, (x, -10, 10), (y, -10, 10),
region_function=lambda x,y: 6-2*x^2-6*y^2>0)}}}[[BR]]
> with[[BR]]
> {{{plot3d(6-2*x^2-5*y^2, (x, -sqrt(3), sqrt(3)), (y, -1, 1),
region_function=lambda x,y: 6-2*x^2-6*y^2>0)}}}
>
> The former would seem to use the unseen faces near inputs like (-10,10)
to compute the vertical axis and the plot is then a really, really
insignificant portion of the bounding box.
IndexFaceSet computes the bounding box by finding the min/max of its
vertices. The problem you describe appears to occur because we don't
remove all of the unused vertices. The issue is somewhat subtle since if
we remove a face, that does not necessarily mean the vertices that it
references are not in use by another face. One way to solve this problem
would be to maintain an array of reference counts for every vertex while
we are clipping the region. At the end of the method, we could delete
vertices with a reference count of 0. This seems like overkill though --
perhaps we can use assumptions about the structure of the parametric
surface (a rectangular grid).
> 2. I thought maybe something like[[BR]]
> {{{plot3d(sqrt(6-2*x^2-5*y^2), (x, -sqrt(3), sqrt(3)), (y, -1, 1),
region_function=lambda x,y: 6-2*x^2-6*y^2>0)}}}[[BR]]
> would now be possible, but it appears the clip comes after the
evaluations, thus this raises an error for the negatives in the square
root. So maybe this should be handled with some sort of piecewise
definition for the function and then the excess would be clipped by a
{{{region_function}}} before showing it.
>
> OK, thinking while I write - here's a hack - insert an absolute value,
then trim:[[BR]]
> {{{plot3d(sqrt(abs(6-2*x^2-5*y^2)), (x, -sqrt(3), sqrt(3)), (y, -1, 1),
region_function=lambda x,y: 6-2*x^2-6*y^2>0)}}}
That's because the clipping is done after the function is evaluated at
every (u,v) coordinate. Maybe we should modify eval_grid so that it does
not perform this unecessary (and sometimes troublesome) computation.
> Nicely done. Holler if I can provide more testing as you finish this
up.
>
> Rob
I'm uploading a patch that makes some cosmetic changes, including renaming
"clip_region" to "clip" and "region_function" to "region" (following the
convention adopted in implicit_plot3d). I'm hoping to get some work done
on this ticket this week!
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5514#comment:13>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---