How to get/display object angle?

Post questions on how to use or achieve an effect in Inkscape.
toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

How to get/display object angle?

Postby toxigames » Wed Dec 16, 2015 1:50 am

How do I get/display object angle? Lets say you create a rectangle. You then turn it around in unknown degrees. How do I display how many degrees it has been rotated? And how do I reset it's angle/rotation to it's original (0 degrees I guess?)?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to get/display object angle?

Postby brynn » Wed Dec 16, 2015 3:38 am

If you watch the status bar while you rotate (using Selection tool) it displays the angle. But as soon as you release the mouse, that info goes away. But in my experience, it's hard to see the angle. If I rotate very fast, the angle is displayed. But if I rotate slowly, the angle flashes so fast I can't see it. And I only see the usual info for what kind of object it is (for a star made with Star tool, "Star with 5 vertices").

The new Measurement tool (stubby ruler icon) can measure the angle after you finish rotating. But the only way to rotate it back to where it started, is to use Object menu > Transform > Rotate. There you can set the precise angle you want to rotate. Or maybe better to just use the Transform dialog from the start?

Another rotation feature is to hold the Ctrl key while you rotate (with Selection tool). It limits the rotation to 15 degree steps. You can change that angle in Inkscape Preferences.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to get/display object angle?

Postby Lazur » Wed Dec 16, 2015 3:58 am

Try to use snapping on paths.

You can measure only 3 digits, and use the transformation tool to rotate 3 digits, so it won't be an exact match if you rotated the object first by its handles.

Rectangles are a special case, as well as groups -after the rotate the transformation is preserved in the codes -usually as transformation matrixes.
Delete them in the xml editor, it might work, depending on what else you did to edit the rectangles.
Maybe group objects for that purpose.


But to add another answer to the original question, guides can come handy.
Pull down one from the ruler, snap it to a cusp node,
hold Shift and rotate the guide until it snaps to a neighboring node, then double click it for measurement where you can copy/paste the value from the guide's settings.

If you want to rotate vice-versa, make a horizontal guide too; snap the rotation centre of the object to the intersection of the guides,
and rotate the object until it snaps either to the horizontal or diagonal guide.

toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

Re: How to get/display object angle?

Postby toxigames » Wed Dec 16, 2015 6:58 am

Thanks guys. Wow, why is it so complicated? I'm thinking this: Why doesn't Inkscape just remember the original angle, from object creation, as 0 degrees, and then always show the current angle relative to this original 0 degrees angle? It could be as simple as that.

And then it could even be a input box: input 5 degrees and the object is shown at 5 degrees. Input 0 degrees and the object will be shown a 0 degrees (0 degrees being the original angle from when the object was created). Right now we are not shown the current angle, we are only being shown how many degrees we rotate it, not the previous, current or resulting angle.

Brynn, correct me if I'm wrong, but when you say that Inkscape shows the angle, it doesn't show the objects angle. Instead it just shows how many degrees you will be adding/detracting from the current angle (and that current angle is unknown). Also the Transform > Rotate function does the same, it adds/detracts whatever degree value you input; but you can't set the final degrees you want the object to be at. And you can't see the current angle either. I can't figure out how I could use the Transform > Rotate function to rotate the object back to it's original angle. I can come close using my eyes, probably like 0.5-1 degrees error margin, but I won't be able to get exactly back to 0 degrees just using my eyes when rotating.

Unless I'm missing something?

Ah well, maybe I should make my own addon to fix this, right? Perhaps it's time to sift through the xml.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to get/display object angle?

Postby brynn » Wed Dec 16, 2015 7:42 am

It sounds like you're asking for 2 different things. In one place, you want to rotate the object where the object is at zero. But then later, you want to object to have some kind of angle already applied to it.

toxigames wrote:Thanks guys. Wow, why is it so complicated? I'm thinking this: Why doesn't Inkscape just remember the original angle, from object creation, as 0 degrees, and then always show the current angle relative to this original 0 degrees angle? It could be as simple as that.


That's how the Transform dialog works. Your object is zero, and whatever degree you enter in the dialog is how far it rotates. If you enter 21 degrees, it rotates 21 degrees. To rotate it back to where it started, put a minus in front of 21.00.

If you rotate using Ctrl with the Selection tool, and you rotate 2 steps, that's 30 degrees. You don't even half to do the math. To rotate back, use Ctrl and rotate 2 steps back.

Brynn, correct me if I'm wrong, but when you say that Inkscape shows the angle, it doesn't show the objects angle.


Think about this. How does Inkscape know what angle the object is at? What if the object is an octagon? Which side, if any, is zero? What about a circle? What angle is the circle at?

If you have version 0.91, maybe the new Measurement tool can help you. I don't know this for sure. But just from using it a few times, it looks like it always measures from the horizontal.

toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

Re: How to get/display object angle?

Postby toxigames » Wed Dec 16, 2015 7:48 am

brynn wrote:Think about this. How does Inkscape know what angle the object is at? What if the object is an octagon? Which side, if any, is zero? What about a circle? What angle is the circle at?


I didn't explain it properly initially, but wrote it later: I want Inkscape to tell me the angle relative to the original angle, the first angle that the object was created with. And I want to also be able to directly set the angle to this original angle.

Concerning Measurement tool, well it can get close, but only as close as the eye permits. Still will be off by some fraction of a degree.
Last edited by toxigames on Wed Dec 16, 2015 7:59 am, edited 2 times in total.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to get/display object angle?

Postby brynn » Wed Dec 16, 2015 7:57 am

But still, how does Inkscape know what angle the object was created with?

toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

Re: How to get/display object angle?

Postby toxigames » Wed Dec 16, 2015 8:00 am

brynn wrote:But still, how does Inkscape know what angle the object was created with?


Because Inkscape could simply state that the creation angle = 0 degrees. And then measure every rotation relative to this angle. I guess if one knew Python a bit better an addon to display this would be easy to code?

toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

Re: How to get/display object angle?

Postby toxigames » Wed Dec 16, 2015 8:08 am

Oh, fiddled a bit around with the measurement tool. And turns out I did overlook something. It is possible to use Measurement tool to display the exact degree, because snap can make the begin and end point snap to the objects corners. So for now, only seems to work with rectangles, and not any object with more polygons than four. Also the actual original angle still is still not recorded/shown anywhere.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to get/display object angle?

Postby Moini » Wed Dec 16, 2015 8:25 am

There are different ways an object's transformation can be saved in Inkscape:

- for paths, a transformation (rotation, scaling, skewing) can be saved in a transformation matrix OR just as the new node positions (so it's lost)

- for other objects (groups, circles, rectangles), (some) transformations can only ever be saved in a transformation matrix, as they require the object to have it's own coordinate system - and can't be indicated by just changing the position of a node, or corner coordinate, or center and radius.

There's a setting in the preferences that allows to keep the transformation matrix for paths (relative), or to save optimized paths (optimized for the length of text in the SVG source code), or to always save the new node positions (absolute) (Edit -> Preferences -> SVG-Output -> Path Data)

If you have an object that actually has a transformation matrix, and all you've ever done with the object was to rotate it, and you delete the transformation matrix in the XML editor, you reset the rotation.

If you have also done other things (move, skew, resize...), it needs matrix maths to selectively reset rotation, but keep all other transformations (not sure if it's possible at all, as it's a summary of all transforms, as far as I understand).

Bildschirmfoto_2015-12-15_23-16-47.png
Bildschirmfoto_2015-12-15_23-16-47.png (62.63 KiB) Viewed 7303 times
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

Re: How to get/display object angle?

Postby toxigames » Thu Dec 17, 2015 12:01 am

@Moini thank you for the explanation and suggestion. It may be worth to try an delete transformation matrix in some cases then. In the screenshot are you opening an xml editor from within Inkscape, or is it an external xml editor program?

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to get/display object angle?

Postby Moini » Thu Dec 17, 2015 1:10 am

It's Inkscape's XML editor (Shift+Ctrl+X , or the fourth button from the right in the topmost bar below the menu, the one where you can also find the save buttons).
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to get/display object angle?

Postby brynn » Thu Dec 17, 2015 5:40 am

toxigames wrote:
brynn wrote:But still, how does Inkscape know what angle the object was created with?


Because Inkscape could simply state that the creation angle = 0 degrees. And then measure every rotation relative to this angle.

I think I just don't understand what you're trying to explain....or maybe you don't understand me.... We're going around in circles here!

Inkscape already does consider that the original angle is zero. I've said that a couple of times. But then you say no, not zero, you want to know the original angle. Then I ask, how does Inkscape know what the original angle is. Then you say, you want the orignal angle to be zero. And I say, Inkscape already does use zero for the original angle. So somewhere, one of us....or maybe both of us don't understand what the other is saying.

Sort of off topic
When I first started to learn Inkscape, I asked if it would be possible to undo something, even if it wasn't the last thing you did. So for example, you draw an object, rotate, then flip it, then edit some nodes, then draw another object, and do some more work, would it be possible to go back and undo the flip only. To me, it seems like that would be an awesome and very useful feature. Apparently it would be all but impossible to create such a feature. (Iirc, I was told it would require massive memory.) But I still think it would be an interesting feature!
Sort of end off topic

It seems to me what you're asking for is something like that. Of course the solution in my example would be to just flip that object again. And in your request, you can't go back and un-rotate an object, unless that was the last thing you did (which would be just Undo). The solution is just to rotate it again, except you have to remember how much it was rotated originally, to be able to rotate back to where it started.

If you simply want the object's angle of rotation to be displayed (like in the status bar, I assume), I would ask why only for rotation? Why not all transformations?

But mostly I ask -- Why do you need that info to be displayed? If you could tell us what you want to do, we can either tell you how, or tell you it's not possible. But discussing why doesn't Inkscape do this or that....it's not helping you to reach your goal.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: How to get/display object angle?

Postby Lazur » Thu Dec 17, 2015 6:07 am

In blender it works that polished.

You have a separate location, rotation and scale transformations for an object (in each axises), that you can apply or preserve, and, set object's origin to 3D cursor.

Sort of keeping separate transformation matrixes for scale/skew/rotate/translate in inkscape, with a gui part where you can access and replace the values other than the xml editor. Maybe it could be a feature request boundled into the announced object browser (?).

toxigames
Posts: 149
Joined: Sat Aug 17, 2013 7:28 pm

Re: How to get/display object angle?

Postby toxigames » Tue Dec 22, 2015 11:52 pm

Sorry for the late reply. Brynn, you're right we're probably just misunderstanding each other. I think I have some form of autism that sometimes makes communication and explaining things to others harder for me. Please bear over with me, I'm trying :).

Anyway I did find the solution I needed with the suggestion of the Measurement tool.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to get/display object angle?

Postby brynn » Wed Dec 23, 2015 12:43 am

Oh, I'm so glad you found what you need!

No worries about explaining. I have large amount of patience :D

(Especially when someone is translating thoughts in their native language, to English, sometimes a lot of patience needed ;))


Return to “Help with using Inkscape”