Author Topic: Rotate around center goes offcenter  (Read 1792 times)

June 11, 2018, 10:07:27 AM
Read 1792 times

daytooner

  • Sr. Newbie

  • Offline
  • **

  • 5
Hi, y'all:

New here, and not the most adept with graphics editing. But here is my problem at the moment:

(the simplest case) I draw a circle then rotate it by 360/31 (11.613) degrees. But as I do each rotation, the size/shape of the circle changes, as well as its position. I can see this in the toolbar settings for x/y and width/height. And after I do 31 rotations, it does not return back to the original size and position (usually).

I have checked the center - the plus marker) and made sure it was in the center of the circle (I even zoomed up the magnification to try to be as precise as possible). But still the same.

Perhaps this is due to rounding errors? I have tried this with different multiples (12, 10, 60, 7). It seems that the even ones do better.

Any ideas?

TIA

ken
  • 0.92
  • linux fedora 27

June 11, 2018, 07:37:41 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

Please tell us exactly, specifically, the steps you take. 

Did you draw the circle with the Ellipse tool, or other way? 
Did you hold Ctrl while dragging the mouse, to make sure you get a true circle? 
Is it a complete circle, and not 359.5 degree arc or wedge (segment of a circle)?
Was anything done to the circle after you drew it?  Like for example, did you apply any path effect or filter?
Could you have accidentally selected more than just the circle, before rotating?
If you drew the circle with Pen or Pencil, did you use any non-default options from the control bar (spiro spline mode, or a Shape option)?
I guess you must be using Object menu > Transform > Rotate?

If you have some concern that the rotation center isn't in exactly the center, you can do Shift + click on it, and it will jump back to its default position, which is in the center.

Since you mention rounding errors, it makes me wonder how large are the changes in X and Y, W and H values?  I probably would not worry if the changes are 0.001 or 0.002, and units are px or mm.  But larger units, or more than that would not be expected.  Or if the circle is huge -- thousands of pixels wide, or measured in feet, then changes of 0.001 pixel would not be anything to worry about.  But under more common situations, we wouldn't expect to see these changes when rotating a circle.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 12, 2018, 05:18:26 AM
Reply #2

daytooner

  • Sr. Newbie

  • Offline
  • **

  • 5
Welcome to the forum! [\quote]

Quote (selected)

Please tell us exactly, specifically, the steps you take. 


Step 1: new document 360x360 pixels.
Step 2: create guides horizontal and vertical at 180 pixels in each direction.
Step 3: Select ellipse tool: create circle with diameter 360 px (radius 180 px). Start dragging, with the ctrl key down, either at a document corner to its opposite corner;  or with the shift key down (as well as the ctrl key) from the intersection of the two guides to any document corner. Verify the exact size/shape/position via the settings on the toolbar at the top.
Step 3a (optional): using the node tool, draw a straight line from one edge of the circle to another, going through the center (ie, a diameter). This is just for visual aid.
Step 4:  Select the circle, along with the optional straight line). Then, using the transform tool (Object->Transform->Rotate), set the angle of rotation to 11.613° (you can even try '360/31°'). Click on apply, Watch the position and width numbers on the toolbar. They should remain constant (right?). Click again, and again. And watch the same numbers. The (optional) line should still cross through the center. If you click a total of 31 times, the line should return to its (exact) original position and the numbers on the tool bar should be their original values.

Repeat Step 4 with  different angle steps (eg, 360/60, 360/24, 360/7).


Quote (selected)
If you have some concern that the rotation center isn't in exactly the center, you can do Shift + click on it, and it will jump back to its default position, which is in the center.

Did that. Even zoomed the image to max magnification to visually see where to cross-hairs were. Typically, it was not at the intersection of the two guides, even after shift-click. So I moved the cross-hairs to that intersection. Although that made a difference, the position and size numbers kept changing.

Quote (selected)
Since you mention rounding errors, it makes me wonder how large are the changes in X and Y, W and H values?  I probably would not worry if the changes are 0.001 or 0.002, and units are px or mm.  But larger units, or more than that would not be expected.  Or if the circle is huge -- thousands of pixels wide, or measured in feet, then changes of 0.001 pixel would not be anything to worry about.  But under more common situations, we wouldn't expect to see these changes when rotating a circle.


For a 360 pixel diameter circle, changes by as much as 0.5 pixels is significant, and becomes visibly noticeable. The accumulation effect (with multiple rotate steps) becomes more visibly significant. I have seen changes by more than 1px in both position and size.

FWIW: I even exported the circle/line image (File->Export PNG image - with zero compression) and checked the rotation of that image in another application. Still not good enough (ie, visibly out of center).

FWIW2: What I am ultimately trying to do is to make a circular dial, with numbers (or other text)  equally placed around the edge of the circle. Then make a static mask over the dial, so that only one  number (or text string) at a specific angle is visible. Rotating the bottom layer dial at the correct angle should have a full single number/text  displayed, centered in the mask's view box.

Hope this gives enough information.

Thanks for the response. Any further information, again, greatly appreciated.

ken

  • 0.92
  • linux fedora 27

June 12, 2018, 05:29:56 AM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Thanks for the awesome details!

I can't reproduce this.  I'll have a video for you shortly.

I wonder if there could be something "off" with the extra line that you're adding?  Be right back.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 12, 2018, 05:43:34 AM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Well, I've got a large download in progress, so I can't upload the video.  I've never tried to attach one though, so I'll try that....

Edit
Aah ok, so hopefully you'll have something that can play the video.  When it's inserted into a message, a player is automatically added for convenience.  But for attachments, you need to use your own player.  But most people probably can play an mp4 these days.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 12, 2018, 05:53:50 AM
Reply #5

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Typically, it was not at the intersection of the two guides, even after shift-click. So I moved the cross-hairs to that intersection. Although that made a difference, the position and size numbers kept changing.

That's because the guides aren't visually precise.  They're "guides".  Although the rulers aren't visually precise either  :uhoh:  So using Shift + click puts the rotation center in the center, even though it might not look like it's exactly on the guides intersection.  It really is in the true center.

I'm still not coming up with a good explanation for what might be going wrong for you.  Could you share the file where this is happening?

Hhmm....I've never seen one of Inkscape's well-known tranform attribute issues affecting rotation, but only placement of objects.  But if there are other object in the file, and you've been working on other objects in the file, it's possible that the tranform attribute issue is affecting it.

You can avoid that problem by putting the circle on a new layer.  If putting the circle in a new layer fixes the problem, nevermind about sharing a file with us.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 12, 2018, 09:31:59 AM
Reply #6

daytooner

  • Sr. Newbie

  • Offline
  • **

  • 5
A little more info:

When you have one or more objects with their individual centers at the same point, then the rotation of all objects is (mostly) fine. There are some insignificant changes with the location of some individual object's center, but usually after a full 360° rotation everything is back to its original position.

But if you have two (or more) objects with different individual centers, and then try to rotate all together, the group's center changes. Create a circle and a square. place both of them somewhere with different individual centers; then select both, and rotate. For me, the  group center moves. Trying to reset the group center (which didn't change it) still had the same result. Now, move both individual objects' centers to the same place, and, again for me, the group center remained stable.

To put this all in perhaps simpler terms: when rotating a group of  objects, each  with different individual centers, the group center changes; if you set each individual center to one group center, then the group rotates around that center, and that center remains in place.

This gets to be a bit of a problem if your group has many individuals (30+). I tried editing the svg xml manually (ok, with sed), and that seemed to work.

Don't know if this is a feature or a bug. You can decide. At least I am aware of what is happening, and have a fix.

Thanks again for your help.

ken


  • 0.92
  • linux fedora 27

June 12, 2018, 11:53:11 AM
Reply #7

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Well yes of course it stands to reason that if you have more than one object, and they don't share the same rotation center, things will get out of whack.

I'm glad you found a solution :)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 12, 2018, 06:35:40 PM
Reply #8

daytooner

  • Sr. Newbie

  • Offline
  • **

  • 5
Well yes of course it stands to reason that if you have more than one object, and they don't share the same rotation center, things will get out of whack.

I'm glad you found a solution :)

I thought that inkscape generated a group center, based on the individual centers. Yes/no/maybe?

In my experiment, I created two individual objects with different centers. When I select both, a new center is generated - one which the two objects should rotate around. But, what I see is that the new center isn't exactly the center of rotation of the two combined object. Also, that new center changes as the objects are rotated.

Am I missing something here?

Thanks for your help. Just trying to understand what is happening.

ken
  • 0.92
  • linux fedora 27

June 13, 2018, 06:08:57 PM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
If one object is larger in either width and/or height, then the X, Y, W, and H values are always going to change during the rotation.  How could they not?

Inkscape is correctly rotating around the center of either the group, or the 2 selected objects.  But the X, Y, W and H values are reflecting either the group or the selection (of both objects), and no longer reflecting only the circle.

I think what you may be seeing, is Inkscape trying to keep the selection in the window.  It looks like the group or selection is jumping around at every rotation.  But I think that's just Inkscape trying to keep everything (as much as possible) showing on the screen.  (If you make much smaller objects, you probably wouldn't see that jumping around thing.)

You could try this.  Snap 2 guides to the rotation center of the group (one vertical and one horizontal).  When you do that, then the guides' anchor points are also at the center.  Then double-click on a guide, to open the little guide dialog, and you can see the position of the guide's anchor point.  In that way, you can confirm whether the center itself is actually moving.

Oh rats!  For some reason, I'm not able to snap a guide to the rotation center of a group.  Why not??  It snaps to the objects' rotation centers, but not the group's.  That must be a bug!  Well crap!

Ok, it will take a little longer to set up, but you could use a vertical and horizontal path, with a node at the intersection, to do the same test.

Edit
After some research, the guide snapping problem is a reported bug.  But it seems to be intermittent, for some users.  So it just might work for you.   :xf1:
« Last Edit: June 13, 2018, 06:47:41 PM by brynn »
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 15, 2018, 06:13:55 AM
Reply #10

daytooner

  • Sr. Newbie

  • Offline
  • **

  • 5
After some research, the guide snapping problem is a reported bug.  But it seems to be intermittent, for some users.  So it just might work for you.   :xf1:

Snapping to guides/grids has always been a very useful curse )-:

For me, when inkscape rotates a group of objects, a new bounding box is calculated. If the original group had an irregular shape, then the box created is the smallest to fit all object in the group, but with caveat: the WxH, and center,  depends on the current shape; when the group rotates, - even though it rotates as a group - the shape may change due to the new positionsshape of the individual objects.

Simple test (yet again): create a dial using Extension->Render->Scale. Attached are my settings.

 Place guides (horizontal/vertical ) to mark the center of the group. Now, rotate (viaTransform->Rotate) by an amount of 360/n°, where n is the number of indices. Ideally, one should see each successive number appear at the top, same position as the last, with the same center (number and group). For me, no. And the size/position of the bounding box  changes. Try rotating multiple times (just keep clicking Apply). Maybe if the text boxes were all the same, and fixed. (How do I do that - fixed size text box?)

I guess this isn't a bug, just an unexpected feature. Would be nice if it was possible to keep the bounding box size/shape fixed, as well as the center.

I am (trying to) write a script to generate something like that (based on the Scale script but: 1) I'm not very familiar with python; 2) the same with the svg xml. But I am obsessive/compulsive :argh: so I persist. Of course any pointers always help.

Thanks for your responses. They are really helping.

ken

PS: notice the bug with the Scale  extension?

 
  • 0.92
  • linux fedora 27

June 16, 2018, 07:02:42 PM
Reply #11

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Wellll, to be honest, you're starting to get outside my realm of knowledge with

Now, rotate (viaTransform->Rotate) by an amount of 360/n°, where n is the number of indices.
 

Not sure what you mean by indices.  (I know what it means, just can't seem to apply it to what we're talking about.)

Yes, Inkscape calculates a new bounding box when anything but a circle is rotated.  If it didn't, then it would no longer be a bounding box.  Right?

Actually I don't seem to have an extension under Render > Scale.  But I set up the scenario with 2 guides intersecting at the group's center.  NOW I see what you're talking about.  I thought you meant that the group's center was changing so that it was no longer the center.  But what you're concerned about is how Inkscape is keeping the object on the screen, in the middle of the screen as much as possible.  Well....actually I'm guessing that's what it's doing.

So the center of the group does not change relative to the group.  But it gets relocated on the screen, as necessary because the bounding box is re-drawn, and also maybe because of Inkscape keeping the selectioni in the middle of the screen.

You must be wanting to do something where you expect or need the rotation center to stay put?

In any case, if you're writing an extension, you should be getting developers to answer your technical questions.  I only know things like 'if you press this button, this will happen'.  I don't know why or how Inkscape works.

You can reach developers either on a mailing list or IRC.  Info here:  https://inkscape.org/en/community/

I'll be glad to keep trying to answer your questions, but we're getting to the point where I might only be able to guess.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann