After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 151092 - GFig's Polar Grid: Independent Sector Spacing Control
GFig's Polar Grid: Independent Sector Spacing Control
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.0.x
Other All
: Normal enhancement
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2004-08-26 04:18 UTC by Shaneyfelt
Modified: 2006-06-15 00:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First attempt to make a Shaneyfelt-style polar-grid (11.24 KB, patch)
2004-12-08 00:16 UTC, Shaneyfelt
needs-work Details | Review
Complete patch against /gimp-2.2.7/plug-ins/gfig for Shaneyfelt-style polar grid. (16.19 KB, patch)
2005-07-09 23:58 UTC, Shaneyfelt
committed Details | Review

Description Shaneyfelt 2004-08-26 04:18:10 UTC
Trivial Request:
The user should be able to change the 
sector spacing (select N sectors) without changing the
track spacing (select N pixels thickness per track)

I tried to produce an illustration with 128 segments around 
a circle, and GFIG was unable to do it.

Optional Generalization:
I imagine there are other tweaks one might want to do to grid 
spacing as well.  (rotation, origin shifting, log scale, 
separate scale per axis, etc.)

Optional Challenge:
Another possible enhancement would be to make the radial grid
have more sectors on outer tracks than inner tracks.  (Using 3
as an approximation for pi, to maintain approximately
equal sector spacing at various radii, split the sector in 
half every time the radius triples.  So you might have 4 sectors
in track 0, 8 sectors in tracks 1&2, 16 sectors in tracks 3-6, 
32 in 7-14, 64 in 15-30, 128 in 31-62, etc.  
Changing the sector scale would simply split up these sectors 
(instead of 4, you could have up to about 32 in track zero, 
or down to 1 sector)  This might be an option (checkbox)
somewhere for more uniform sector spacing at varying radii.

There are other possible grids, but I think these cover the 
most useful ones.  (If I were drawing nautili, I might 
ask for a spiral grid:)     @
Comment 1 Sven Neumann 2004-08-26 08:59:22 UTC
A patch (against CVS HEAD!) would very much increase the likelihood of this ever
going to be implemented.
Comment 2 weskaggs 2004-08-26 15:49:03 UTC
Hmm. CVS head contains my majorly hacked version of gfig, which might or might
not be in a usable state by the time 2.2 is released.  (I've been putting most
of my efforts into writing help docs recently.)  However, I really haven't
touched the grid code at all, so a patch to that code in the 2.0.4 version could
easily be forward-ported to the version in cvs, and might turn out to be more
useful than a patch to the cvs version.
Comment 3 Shaneyfelt 2004-12-08 00:16:52 UTC
Created attachment 34616 [details] [review]
First attempt to make a Shaneyfelt-style polar-grid

This patch implements a polar grid with reduced congestion 
near its center.  Parameters in the selvals.opts struct 
control various aspects of the grid, including:
*  arbitrary track spacing (default 10)
*  arbitrary track spacing offset (default 0)
*  arbitrary maximum number of sectors (default 120)
*  arbitrary minimum spacing per sector (default 5)
*  arbitrary rotation (default 0)

I didn't add gui control of the struct, as it seems the 
gui is in flux at the moment.  Also, there's some roundoff
error that affects the display by one pixel in places
that should be fixed as time permits.
Comment 4 Sven Neumann 2005-01-07 12:03:00 UTC
Now would be a good time to add this patch to CVS. I haven't tried the patch
myself. Is the patch good enough and will it apply cleanly or do you think it
needs further work?
Comment 5 Shaneyfelt 2005-01-07 20:14:13 UTC
The patch should be fine if someone cares to make the user interface
control the data structure.  (It will still work without GUI but you 
won't be able to change spacing/etc.)

Also, I wrote some trivial code but haven't posted another patch to
take care of roundoff because my build environment is broken and 
I don't have time to deal with it at the moment.  The patch is simple, 
so anybody could do it: Wherever a float is used as an int,
round first. (I tried a mock-up on Java and it works fine,
so I expect everything will be fine with the C plugin)

Sorry I haven't time to handle the remaining items, please feel 
free as I've got too much happening at the moment (visitors, 
conference, prepare new classes (I wanted to install GIMP 2.2 with
the latest patches on Windows to fix gfig, but no time to build that
either. I'd be thankful if that were built by someone this weekend)

_-T

Comment 6 Dave Neary 2005-01-24 08:12:27 UTC
Comment on attachment 34616 [details] [review]
First attempt to make a Shaneyfelt-style polar-grid


The grid spacing should probably use the existing grid settings from
GimpConfig.
Comment 7 Shaneyfelt 2005-01-25 03:56:33 UTC
It would be nice to have polar and isomorphic support 
throughout GIMP, supported by GimpConfig settings.
However, the settings designed for rectangular grids 
won't do for all grid types.
Comment 8 Shaneyfelt 2005-07-09 23:58:10 UTC
Created attachment 48886 [details] [review]
Complete patch against /gimp-2.2.7/plug-ins/gfig for Shaneyfelt-style polar grid.

Complete patch against /gimp-2.2.7/plug-ins/gfig

The user interface controls desired number of sectors 
and desired radius interval.  It could easily be extended
to control a few other parameters, just by adjusting these
variables:

 grid_radius_min (shift outward all tracks)
 grid_rotation (shift counterclockwise all sectors)
 grid_granularity (control minimum sector size limit)
Comment 9 Shaneyfelt 2005-07-10 00:00:10 UTC
Comment on attachment 48886 [details] [review]
Complete patch against /gimp-2.2.7/plug-ins/gfig for Shaneyfelt-style polar grid.

Fixed.
Comment 10 Michael Schumacher 2005-07-10 00:44:04 UTC
Sven asked for a diff against CVS head in comment #1, it would be nice if you
could provide one.
Comment 11 Sven Neumann 2005-07-10 18:39:03 UTC
The patch against 2.2 will most probably apply cleanly against CVS HEAD.
Comment 12 Michael Schumacher 2005-07-12 06:15:25 UTC
I've tried this patch and it applies inded. The result looks nice, too. But
there are two things that bother me:

The center is only marked by one line now. This is a bit awkward, IMO it shoul
be either three lines (the closest to 0, 120 and 240 degrees?) or four (0, 90,
180 and 270 respectively).

Until I tried the patch, I thought that this was just something that changed the
diaply of the grid (e.g. removes lines to make the display less crowded). But it
removes the snap points as well - will this be controllable by the other
parameters that aren't in the gui yet?
Comment 13 Shaneyfelt 2005-07-12 21:11:01 UTC
Three lines wouldn't scale as well. For example, you might want
to divide the circle into 64 sectors (something I wanted to do 
for an illustration that inspired this enhancement.  After 
experimentation, it seems to work best and most efficiently
as submitted.  Changes to it might be added as a separate 
enhancement request.  I can think of endless other possible
enhancements, as well. 

For efficiency of all grids, someone might consider drawing
the grid once on a separate layer and not calculating again
after that.  

For generality, one might consider generating arbitrary grid 
types from path intersections and voroni regions, but that 
would take some work and I don't know how efficient it would be.

For better organization, one might consider to only show the options
for the current type of grid.  (e.g. rect grids could have 
different horizontal and vertical spacing, some offset of alignment 
relative to top, left, right, or center, arbitrary rotation, etc.
and the same could go for iso, etc.) and the list goes on...

To answer your question about control of snap points,
You can control how tightly the grids can get together if you 
add a gui control the value of grid_granularity (minimum 
spacing per sector).  Making gridlines and snap points different
from one another would be confusing.  I have tested the algorithm 
with various parameters (grid_granularity, grid_radius_min, 
grid_rotation) Just add GUI if you like them. That should
solve the problem if you need tighter snap points. But it is
how it is now to keep the user interface simple.
If people have a need for the other features after using this, the
groundwork is laid for many enhancements.  

After testing, I'm satisfied with the implementation 
as it is in the patch.

_-T
Comment 14 Sven Neumann 2005-07-12 21:35:38 UTC
Looks good to me (from a quick glimpse), why not just commit it? We can improve
things later if there's a need to do so.
Comment 15 Michael Schumacher 2005-07-13 20:06:04 UTC
2005-07-13  Michael Schumacher  <schumaml@cvs.gnome.org>

	* plug-ins/gfig/gfig-dialog.c
	* plug-ins/gfig/gfig-grid.c
	* plug-ins/gfig/gfig.h: applied a patch by Ted Shaneyfelt that
	addresses parts of bug 151092: less sectors on inner, more sectors
	on outer tracks.
Comment 16 Michael Schumacher 2005-07-15 08:44:22 UTC
How should we proceed with this? We have multiple additional enhancements in
here... I'm going to remove the PATCH keyword, as I've applied it already. IMO
the best way would be to make the new polar grid behaviour know on the mailing
lists and ask direct people to this report if they want to make additions or
changes.
Comment 17 Shaneyfelt 2005-07-15 18:59:44 UTC
The original request that I wrote has been completely satisfied:

  "Trivial Request:
  The user should be able to change the 
  sector spacing (select N sectors) without changing the
  track spacing (select N pixels thickness per track)

  I tried to produce an illustration with 128 segments around 
  a circle, and GFIG was unable to do it."

It would be appropriate to close this and add the additional 
"Optional Challenges" and other items that were brought up 
later as separate enhancements, if desired.  Most (if not all)
of the remaining items could be applied to rectangular and 
isomorphic grids as well.
Comment 18 Sven Neumann 2005-07-20 09:41:41 UTC
2005-07-20  Sven Neumann  <sven@gimp.org>

	* plug-ins/gfig/gfig-grid.c: declare variables at the start of the
	scope. Apply GIMP coding style to the new polar grid code.

Next time you submit a patch, please try to avoid such C99isms and adhere to the
GIMP coding style. Thank you.

Closing this bug as FIXED now. Feel free to open a new one for remaining issues.
Comment 19 Shaneyfelt 2006-06-15 00:03:05 UTC
The target milestone still shows 2.0, will it be moved to 2.4 now?
Comment 20 Shaneyfelt 2006-06-15 00:04:55 UTC
Oops - my mistake. I was reading version instead of target milestone. Sorry. Ignore.