Move objects by distance and angle

Post questions on how to use or achieve an effect in Inkscape.
User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Move objects by distance and angle

Postby Grobe » Fri Aug 03, 2012 2:33 am

Hi.

I guess that subject is obvious so I don't dig any deeper.

Is there a method in Inkscape that is more effective then doing the math externally?
:lol:

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Move objects by distance and angle

Postby druban » Fri Aug 03, 2012 8:43 am

You are probably not asking for workarounds, so the short answer is no.
Maybe you can put in a request for there to be a preferences item, "Polar coordinates in transform dialog" or "Polar coordinates checkbox in transform dialog."
In development builds you are allowed to enter light calculations into spinboxes
http://wiki.inkscape.org/wiki/index.php/Release_notes/0.49#Simple_calculations_in_spinboxes,
I suppose this might possibly be extended to trig functions and offer a solution that way. (Maybe trig is already available and I just don't know the syntax? ~suv?)

If this is just a onetime problem you are having, the solution is to use the bezier pen to snap to any node of the object and start drawing a line. The info bar tells you distance and angle. End the line segment by double clicking when the display reads the angle and distance you want your object to move. Now drag the object so the same node that you started drawing from snaps to the end node of the line segment.
Your mind is what you think it is.

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

Re: Move objects by distance and angle

Postby brynn » Fri Aug 03, 2012 9:53 am

Off topic:
When I was first trying to understand the difference between raster and vector, I learned the following. In raster graphics, colors are mapped to the pixels. A line is nothing more than a strip of contiguous pixels of the same color. In vector graphics, pixels are irrelevant. There are objects on the canvas which have nothing to do with pixels (unless pixels are used as units of measure). And objects are placed or moved on the canvas in terms of distance and angles. Well, that's my interpretation of what I read, even it's not an accurate technical explanation. So I was quite surprised when I started to learn Inkscape, that I couldn't define a line by length (or distance) or define a certain angle at segment intersections. It seems to me that the very definition of vector graphics, can't be done by Inkscape, lol. (in current stable release)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Move objects by distance and angle

Postby ~suv » Fri Aug 03, 2012 3:50 pm

druban wrote:If this is just a onetime problem you are having, the solution is to use the bezier pen to snap to any node of the object and start drawing a line. The info bar tells you distance and angle. End the line segment by double clicking when the display reads the angle and distance you want your object to move. Now drag the object so the same node that you started drawing from snaps to the end node of the line segment.

Another one-time solution (or workaround) by numbers [1] (without requiring external calculators, and not by approximating based on values of the current cursor position shown in the status bar):
  1. draw a full, unstroked circle with the radius of required distance (width = 2 * distance, W/H ratio locked)
  2. move circle and snap its center to a well-defined node snap point of the object
  3. switch to ellipse tool, change 'End:' to desired angle (CW)
  4. optional: lower circle segment (-> below the object to be moved)
  5. grab object, drag it and let the same snap point now snap to the cusp end node of the circle segment.
Done.

(It can be done via XML Editor too, with a series of nested groups and individual 'transform' attributes set on them, but this solution is almost like hand-coding the SVG source code (no extended math required, though, only SVG logic based on nested viewports defined by the svg type <g> (group))).

[1] Known limitation (Inkscape is not a CAD or CAGD application): a circle in Inkscape is approximated by four bézier curves, this might limit the mathematical precision of the end point of the segment (might be offset a tiny fraction in radial direction).
Last edited by ~suv on Fri Aug 03, 2012 4:29 pm, edited 1 time in total.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Move objects by distance and angle

Postby ~suv » Fri Aug 03, 2012 4:26 pm

Off topic:
druban wrote:Maybe you can put in a request for there to be a preferences item, "Polar coordinates in transform dialog" or "Polar coordinates checkbox in transform dialog."
IIRC (no, I haven't searched yet) support for (relative) polar transformations/coordinates has already been requested and filed numerous times (probably in different variations - depending on the user's current task and preferred workflow - and sometimes likely buried in mixed-bag wishlists aiming to turn Inkscape into full-blown CAD (or CAGD) application).

druban wrote:In development builds you are allowed to enter light calculations into spinboxes
http://wiki.inkscape.org/wiki/index.php/Release_notes/0.49#Simple_calculations_in_spinboxes,
I suppose this might possibly be extended to trig functions and offer a solution that way. (Maybe trig is already available and I just don't know the syntax? ~suv?)
AFAICT no trigonometry supported, only basic arithmetic expressions - but there's too few (aka none) detailed documentation available, and peeking into the source code doesn't give me an obvious answer either (I don't code C/C++ myself). The code for the expression evaluator originates from GIMP btw.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Move objects by distance and angle

Postby druban » Fri Aug 03, 2012 5:53 pm

Thanks for the info, ~suv, and for going to the trouble of looking into the source code!
Your mind is what you think it is.

newsboost
Posts: 24
Joined: Sun Jul 15, 2012 10:07 am

Re: Move objects by distance and angle

Postby newsboost » Sat Aug 04, 2012 12:57 am

~suv wrote:[offtopic]
druban wrote:Maybe you can put in a request for there to be a preferences item, "Polar coordinates in transform dialog" or "Polar coordinates checkbox in transform dialog."
IIRC (no, I haven't searched yet) support for (relative) polar transformations/coordinates has already been requested and filed numerous times (probably in different variations - depending on the user's current task and preferred workflow - and sometimes likely buried in mixed-bag wishlists aiming to turn Inkscape into full-blown CAD (or CAGD) application).
I would also appreciate this entering of RELATIVE coordinates and angles using keypad... Would be REALLY REALLY nice, and it wouldn't turn it into any full-blown CAD program if developers implement it (don't know what CAGD is and neither tried to google it, just wanted to express my support and wish for in the future, to be able to input RELATIVE coordinates: Lengths and angles), thank you!

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Move objects by distance and angle

Postby ~suv » Sat Aug 04, 2012 2:15 am

Off topic:
druban wrote:In development builds you are allowed to enter light calculations into spinboxes (Simple calculations in spinboxes), I suppose this might possibly be extended to trig functions and offer a solution that way. (Maybe trig is already available and I just don't know the syntax? ~suv?)

JFTR - I have just unlinked the most recent duplicate feature request for an expression evaluator or calculator in input boxes --> Bug #1024362 “RFE: enhance expression evaluator in input boxes” now tracks further enhancements (like support for basic trigonometric functions). Don't expect this to be added any time soon though ;-)


Return to “Help with using Inkscape”