No Y clipping in Effects/Render/Function Plotter

Bug #492103 reported by dhstraayer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
su_v

Bug Description

The function plotter is almost perfect for use in generating graphs for use in math worksheets, exams, etc. A glaring problem is that as the function is evaluated from Xmin to Xmax (effectively clipping the function to the left and right), the function is drawn on the canvas outside the bounding box (in the Y direction). At the very least, a checkbox should be added "Clip in Y direction", which could be left unchecked by default to preserve backward compatibility. This clipping should be a piece of cake to do, as it is a strictly one-dimensional clipping against Ymax and Ymin. If I undertake to download the source myself, I might just give it a try...

jazzynico (jazzynico)
tags: added: extensions-plugins
Revision history for this message
su_v (suv-lp) wrote :

1) Any contributions would be very welcome! You don't need to download the source if you want to work on enhancing the function plotter extension: it is a python script that is installed with the default Inkscape 0.47 distribution. Depending on your OS you can find it in these default locations:
 linux: /usr/share/inkscape/extensions/funcplot.py
 osx: /Applications/Inkscape.app/Contents/Resources/extensions/funcplot.py
 win32: [installation directory of inkscape]\share\extensions\funcplot.py

Links to the 0.47 release branch source code repository:
Python script:
<http://bazaar.launchpad.net/%7Einkscape.dev/inkscape/RELEASE_0_47_BRANCH/annotate/head%3A/share/extensions/funcplot.py>
Extension definition file:
<http://bazaar.launchpad.net/%7Einkscape.dev/inkscape/RELEASE_0_47_BRANCH/annotate/head%3A/share/extensions/funcplot.inx>

2) the term 'clipping' is problematic for what you miss in the output of the function plotter: 'clipping' in Inkscape refers to the implementation of the SVG feature described in the SVG spec (http://www.w3.org/TR/SVG11/masking.html#ClippingPaths).

3) I agree that the output of the function plotter seems inconsistent: the x and y axis (if drawn) are limited to the area of the initial rectangle whereas the function curve itself, when rendered for values between the entered 'Start X value' and 'End X value', is not. AFAIU the requested "Y clipping" is implemented by adjusting the Y values of the rectangle's top and bottom so that the output lies within the rectangle.

Changed in inkscape:
importance: Undecided → Wishlist
Revision history for this message
su_v (suv-lp) wrote :

Patch to add clip option (copy of rect is used as clip-path).

Revision history for this message
su_v (suv-lp) wrote :

Better version (add <defs> if missing).

Revision history for this message
Alvin Penner (apenner) wrote :

just tested v2.diff file. From a functional point of view this appears to be working perfectly, very nicely done!

The only thing I noticed is that the clip path ID is not unique. The resulting svg file contains code like:
       clip-path="url(#clipPath)"
normally one would expect to see something like #clipPath27 or some unique number.

Revision history for this message
Alvin Penner (apenner) wrote :

sorry, I spoke toop soon. It appears that the id is unique. After one application I get the id clipPath, the next applications yields clipPathy, and the next application yields clipPathT, so they are unique.

Revision history for this message
Alvin Penner (apenner) wrote :

committed to rev 11977

Changed in inkscape:
status: New → Fix Committed
su_v (suv-lp)
Changed in inkscape:
assignee: nobody → ~suv (suv-lp)
milestone: none → 0.49
su_v (suv-lp)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.