#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:            
-------------------------+--------------------------------------------------

Comment(by jason):

 Replying to [comment:13 wcauchois]:
 >
 > 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).


 I believe the {{{_clean_point_list}}} function clears out unused points
 (implementing the functionality that Bill describes above).  However, we
 don't call this (i.e., we commented out the existing call to this) so that
 we can still get an easy correspondence between the parameter values and
 the points generated (i.e., the points are still in a grid of parameter
 values, as long as none are missing).

   * We could bolt one more thing on---a bitset of the points that are
 used.  We could use the bitset class in misc/bitset.pxi for that.
   * Or we could just store the parameter values with each point.  This
 would also make us more flexible in handling the situation below.

 We need this correspondence between vertices and parameter values so that
 we can clip based on the parameter values.

 >
 > > 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.

 So, we could:

   * make it so that the region passed into the plot3d command is used
 during the initial evaluation; if the point passes the region function,
 then a vertex is calculated from it.  This would probably save time
 anyway.  If we do this, we need to take into account the different
 signatures of region functions.  For a two-argument function, check before
 the vertex is calculated, and for a three- or five-argument region
 function, check after the vertex is calculated (because the arguments to
 the region function include the vertex coordinates).  Because of this last
 possibility, we probably also want to also
   * make the indexed face sets handle evaluations which throw errors, in a
 similar way that 2d plotting handles undefined values.  This would also
 probably necessitate storing the parameter values with the vertices.

 Either way, we violate the assumption that the vertices are from a grid of
 parameter values.  We probably will have to store the parameter values
 that generate each vertex.

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