Perspective extension

Bug #169802 reported by Another-one
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Critical
Unassigned

Bug Description

Here is my perspective extension. It works like envelope ext (and is based
on it), but does correct perspective projection. Also, it accepts groups
for transforming.
There is external dependency: numpy, numeric package for python.
Interface is simple (like in envelope extension): select four-node path
(envelope to be projected into) (first) and object to transform (path or
group), then execute extension. Only paths inside groups are processed.

Known bugs: object transforms are not respected and this can lead to
strange results.

TODO: add user interface and "unperspective" option.

Revision history for this message
Another-one (another-one) wrote :
Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Originator: NO

Thanks! I tested your extension but I'm getting strange results. First, it
looks like it expects the envelope to be the first selected object, not
last as it claims. Second, it shows warnings:

** (inkscape:26502): WARNING **: Format autodetect failed. The file is
being opened as SVG.

** (inkscape:26503): WARNING **: Format autodetect failed. The file is
being opened as SVG.

** (inkscape:26504): WARNING **: Format autodetect failed. The file is
being opened as SVG.

** (inkscape:26505): WARNING **: Format autodetect failed. The file is
being opened as SVG.

And finally, I attach a sample that I used - as you see the transformed
path (red) is not in the perspective envelope at all. Can you fix that?

Revision history for this message
Another-one (another-one) wrote :

Originator: YES

Yes, envelope must be first - and I mentioned it in my post. Built-in help
is wrong, and I'll fix it in next release.
Warnings are issued by Inkscape. There are several possible fixes:
1) fix inkscape - should add .svg to temp file name passed to extension
2) rename file in extension (add .svg)
3) redirect inkscape's stderr (but user will not see possible error
messages from inkscape)

Result you are getting is very strange - for me it works fine. What
inkscape version are you using? I tested with 0.44.1
I attached my result.

Revision history for this message
Josef Vybíral (cornelius) (cornelius-cz) wrote :

Originator: NO

As DmitryP requested today, I've tried this extension(v0.3) in 0.44+devel
(svn revision #13407) and it works nicely(Ubuntu Dapper Drake, NumPy 1.0
package). The result is attached.

What can confuse user a bit is that the envelope has to be drawn from
left-bottom corner and CW to get proper, not-flipped, results. (help in
extension would be handy)

One suggestion, if Rectangle, Circle, Polygon, Text, Spiral or other
primitive svg objects are found in the selection, they should be converted
to paths to allow them to be transformed. Otherwise they are left in
place.

on the other hand, great job with the extension! Just yesterday I wanted
it :)

Revision history for this message
Jfbarraud (jfbarraud) wrote :

Originator: NO

About path conversion, handling of transform attributes, groups and or
clones...: I had the same problem for one of my extensions; I tried to
solve this in a reusable way, and gathered all the relevant code in a
separate script (pathmodifier.py).

Maybe you could consider building your extension on this. It defines a
general sub class of inkex Effect, that has several functions addressing
this (in particular 'expandGroups(List)', 'expandGroupsUnlinkClones(List)'
and 'objectsToPaths(List)').
They typically recieve the self.selected dictionnary, and do what their
name suggest (they also have optional arguments, see the script)

If you do, I would be very happy to have your comments and suggestions for
improving the script!
JF.

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Originator: NO

Strangely, I still can't get the correct result. Neither with my "propos"
sample nor with cornelius' sample. My versions are: python 2.4.3, numpy
1.0, inkscape svn. Any idea of what might be wrong?

Note that my output is not random - it's as if it's inscribed into a
rectangle whose two sides lay on the continuations of the original
rectangle's two sides. Maybe this might give you an idea. I can do more
testing if needed.

As for jfbarraud's suggestion, I agree it would be a good idea to reuse
his code for extra robustness. What do you think?

Revision history for this message
Bryce Harrington (bryce) wrote :

Originator: NO

Since this has gotten some testing, I think it would be okay to include it
in the 0.45 release, if the issue Bulia identified can be sorted out in
time.

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Originator: NO

ok, i committed what we have, hopefully someone will debug the issues with
this extension during the 0.45 cycle.

Revision history for this message
Aaron C Spike (acspike) wrote :

Originator: NO

Dmitry, could you please test and review the following patch as related to
your extension.
https://sourceforge.net/tracker/index.php?func=detail&aid=1690329&group_id=93438&atid=604308

There also remains a great need for someone to assist in debugging this
extension as it seems to be broken on many systems.

Revision history for this message
Bryce Harrington (bryce) wrote :

Has the situation with this extension improved? If not, should we disable it for the release?

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Here is a list of bugs related to this extension that I have collected, with their summaries. Not sure if they are all still valid.

bug 171967 (rfe) works, but hard to use
bug 168843 'effect->modify path->perspective' broken on SuSe?; should check for numpy libraries
bug 169802 (good discussion of inclusion in 0.45),
bug 174992 broken on debian in svn
bug 169095 Perspective effect still broken?
bug 168942 broken on groups
bug 176750/179683 broken on WinXP/Vista with registry errors
bug 171772 new effect planned

This last one is maybe most relevant. It looks like the developer is working on a whole new version based on live path effects. Which will be cool!

Revision history for this message
Another-one (dmitry-platonov) wrote :

I think, perspective extension is deprecated by http://wiki.inkscape.org/wiki/index.php/ReleaseNotes046#3D_Box_tool
If so, feel free to disable/remove it.

Revision history for this message
prkos (prkos) wrote :

Perspective effect and 3D box aren't the same thing, I don't think that one can exclude the other.

Perspective doesn't seem to work on Vista and XP, but does work on linux. Maybe then just disable on windows although its a very useful effect and I'd love to have it fixed so I don't need tto switch between 2 machines to complete an illustration.

Revision history for this message
prkos (prkos) wrote :

another related bug:

bug 178022 python extensions fail on win32

Revision history for this message
Another-one (dmitry-platonov) wrote :

After re-reading about 3D box tool, I see that it is no substitute for perspective extension. I thought that user can associate arbitrary path with box, so it can be transformed with it.
About extension: I can eliminate Numpy dependency by writing my own version of linear equation system solver.

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.