Wireframe spheres extension

Bug #461964 reported by inductiveload
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Unassigned

Bug Description

I have written a new extension to render wireframe spheres (i.e. a collection of ellipses representing a sphere's latitude and longitude lines).

The number of lines of latitude and longitude is independently variable. Lines of latitude and longtude are in separate subgroups. The whole figure is also in its own group.

The whole sphere can be tilted towards or away from the veiwer by a given number of degrees. If the whole sphere is then rotated normally in Inkscape, any position can be acheived.

There is an option to hide the lines at the back of the sphere, as if the sphere were opaque. I couldn't work out the formula for calculating the exact way to stop some lines of longitude at the right place, so there is an approximation there at the moment. I invite anyone who can derive this expression to do so and contribute it.

Related branches

Revision history for this message
inductiveload (inductiveload) wrote :
Revision history for this message
inductiveload (inductiveload) wrote :
tags: added: extensions
tags: added: extensions-plugins
removed: extensions
Revision history for this message
Pablo Trabajos (pajarico) wrote :

Nice idea!

It might be a little too late to include it in 0.47, maybe better for 0.47.1? I tested it on pre4 and works well, however the "lines of longitude" only work with even numbers. Try with 5 for example.

Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
inductiveload (inductiveload) wrote :

I don't mind whch release it goes in, and I don't have SVN access so I can't do it myself anyway.

That problem is because the lines of longitude are made up of an ellipse, and it counts one ellipse as two lines of longitude (e.g. the prime meridian becomes the international date line at the poles). So you can only have an even number of longitude lines. The way the ellipses are constructed, it is extremely non-trival to break the ellipse at the poles.

Maybe I should add an error message to that effect when an odd number is entered?

Revision history for this message
Pablo Trabajos (pajarico) wrote :

> it is extremely non-trival to break the ellipse at the poles.
Ok, I understand that. I was pointing out that odd numbers give *some* result which is not using the chosen number of lines and renders something which is not geometrically correct. Maybe a small caption on the script window would suffice, like "odd numbers won't render geometrically correct spheres".

As far as I know, extension can't be made to only accept even/odd numbers.

Revision history for this message
inductiveload (inductiveload) wrote :

Yes, I understand your objection. While AFAIK you are correct in that I can't stop the dialogue passing an odd number in, I have modified the script so it will abort if you give it an odd number, with a reason. I also added a TODO at the top of the script so it could be fixed in a future version.

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

this is very cool, I would definitely vote for putting this in as soon as it is *allowed* to do so..

Revision history for this message
heathenx (heathenx) wrote :

Brilliant. :)

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

Call me silly, but couldn't you just double the number passed in, thus making it even?

Or in the code divide by two, truncate, then multiply by two to force the value to the next lower even number?

-Rob A>

Revision history for this message
inductiveload (inductiveload) wrote :

Well, I could do that, but then you will end up with half as many lines as you expect. The way it is done now means that it will not silently give you an unexpected output, it will warn you and abort. Also, this way means the interface will be unchanged if someone implements a way of drawing odd numbers of lines of longitude.

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

attaching 'wireframe_sphere.inx' again (probably inadvertently removed)

Alvin Penner (apenner)
Changed in inkscape:
status: Confirmed → Fix Committed
jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.48
Revision history for this message
Alvin Penner (apenner) wrote :

there is an occasional glitch that sometimes shows up when the rotation angle is not zero.
The attached svg was drawn with the parameters:
lines of latitude = 10
lines of longitude = 16
tilt = 65
rotation = 40

one globe has the lines hidden, the other not hidden. In the hidden case, there is a line of longitude that does not pass through the North pole. Comparing the two drawings it looks like the foreground and background lines are interchanged at this longitude, a line that should have been hidden in the background has not been hidden. Will investigate this after Christmas.

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

attached is a modified version of wireframe_sphere.py which fixes this, as well as an occasional crash at tilt = 90 degrees, which was caused by very small round-off error.

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

the formula for calculating the proportion of the line of latitude to hide has been re-derived from scratch. The new result is in the attached diff file, and these changes have been tested and committed to bzr rev 8861.

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

This extensions produces the same Inkscape warning messages as described in <https://bugs.launchpad.net/inkscape/+bug/465571/comments/8> (DataMatrix encoder extension):

console msg: (repeated 2 times for each ellipse)

** (inkscape-bin:69263): WARNING **: Invalid style property id: 23 value: 1

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

thanks, patch committed to bzr rev 9276

jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
Arjan (arjan-acdijkman) wrote :

I'm a teacher and currently I'm teaching about lattitude and longitude coordinates on Earth. This is why I am VERY interested in this tool. Hoewever, I'm new to Inkscape and I don't know how to install this plugin. I googled the web, looked at the Inscape-wiki, but I cannot find how to do this.

Can anyone please help?

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

> Can anyone please help?

Please use the Answers section, 'inkscape-user' mailing list or the Inkscape forum [1] for support questions. The bug tracker is intended for developers and giving user support is beyond its scope.

> Hoewever, I'm new to Inkscape and I don't know how to install this plugin.

You don't have to install the extension files yourself if you use a reasonably current version of Inkscape: the extension had been included with Inkscape with the release of Inkscape 0.48.0 in August 2010 [2].

The extension is available in menu 'Extensions > Render > Wireframe Sphere...'. The basic usage is described in the manual [3]. If you need more details, download the SVG file attached to comment #1 of this report [4] and open the downloaded SVG file in Inkscape (or view it directly in your web browser if it is capable of rendering SVG files).

[1] <https://answers.launchpad.net/inkscape>
   <https://lists.sourceforge.net/lists/listinfo/inkscape-user>
   <http://www.inkscapeforum.com>
[2] <http://wiki.inkscape.org/wiki/index.php/Release_notes/0.48#New_and_improved_extensions>
[3] <http://tavmjong.free.fr/INKSCAPE/MANUAL_v16/html/Extensions-Render.html#Extensions-WireframeSphere>
[4] <https://bugs.launchpad.net/inkscape/+bug/461964/+attachment/891622/+files/Wireframe%20sphere%20tutorial.svg>

Revision history for this message
Arjan (arjan-acdijkman) wrote :

Ah! Found it. I'm using a Dutch version of Inkscape, so I didn't recognise the translation ;-]

Thanks!

Revision history for this message
OJW (owhite) wrote :

Inkscape 0.91 r13725: If you enter a tilt of 0 degrees the latitude lines are messed-up, but entering tilt=0.1 degrees works fine. (This is with all other options left at default values)

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

not reproduced on Windows 7, 32 bit, using Inkscape 0.91 r13725 (Jan 30 2015)

settings were
latitude 19
longitude 24
tilt 0
rotation 4
radius 100

result attached here
could you indicate which OS, and if on Windows, 32 bit or 64?

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.