#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.1
Component:  graphics     |    Keywords:            
-------------------------+--------------------------------------------------

Old description:

> This feature would emulate Mathematica's
> [http://reference.wolfram.com/mathematica/ref/RegionFunction.html
> RegionFunction]. The user should be able to provide a function to
> parametric_plot3d which, given a (u,v) coordinate, would return whether
> to include that point in the overall plot. In this way, the user can
> specify which region to include in the plot drawn.
>
> The syntax would look something like this:
> {{{
> var('u,v')
> parametric_plot3d([u,v,u^2+v^2], (-2, 2), (-2, 2), region_function=lambda
> u,v: u^2+v^2>1)
> }}}
> This would draw a paraboloid with a circle cut out of the middle.

New description:

 This feature would emulate Mathematica's
 [http://reference.wolfram.com/mathematica/ref/RegionFunction.html
 RegionFunction]. The user should be able to provide a function to
 parametric_plot3d which, given a (u,v) coordinate, would return whether to
 include that point in the overall plot. In this way, the user can specify
 which region to include in the plot drawn.

 The syntax would look something like this:
 {{{
 var('u,v')
 parametric_plot3d([u,v,u^2+v^2], (-2, 2), (-2, 2), region_function=lambda
 u,v: u^2+v^2>1)
 }}}
 This would draw a paraboloid with a circle cut out of the middle.

 Another thing that would be nice is if you could specify the limits on uv
 in terms of u and v. Like:
 {{{
 parametric_plot3d([u,v,u^2+v^2], (-2, v), (-2, 2))
 }}}
 Here u would be bounded above -2 and below v. We could automatically
 translate this into a region function like simply:
 {{{
 parametric_plot3d([u,v,u^2+v^2], (-2, 2), (-2, 2), region=lambda u, v: u
 <= v)
 }}}
 But then we would have to automatically choose a concrete upper bound for
 u somehow...

--

Comment(by wcauchois):

 I've done some work on this issue, including implementing code to store
 the uv coordinates for every vertex in a separate array, and it SEEMS to
 work. Everything is in trac5514-new.patch, which I've rebased for Sage
 4.0.rc0. HOWEVER, I was just looking through the IndexFaceSet code and I
 realized that _separate_creases() and _clean_point_list() both rejigger
 the list of vertices. I added an array to ParametricSurface called
 _coords, where self._coords[i] is supposed to store the uv coordinates for
 the vertex self.vs[i]. But after an operation like the two I just
 mentioned, self.vs[i] could have moved to a completely different index. I
 don't understand exactly what _separate_creases() does, but it looks like
 it could even add NEW vertices to the IndexFaceSet. How would we clip
 these new vertices based on uv coordinates?

 Maybe there is some way to get around these issues, but I think we could
 eliminate this problem by removing the specialized version of clip() in
 ParametricSurface. So if you call clip() on a ParametricSurface object,
 you will only be able to use the xy and xyz variants of the region
 function. You would still be able to use the uv or xyzuv variants by
 passing the region function to the constructor of ParametricSurface, since
 in that case we could do all the clipping inside triangulate(), before
 _clean_point_list() and _separate_creases() are potentially called (by our
 code, or by client code, or by the viewing code). I should hope that in
 the vast majority of use cases this will be acceptable.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5514#comment:16>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to