gotcha

Author Topic: Snap on geometrical positions for construction  (Read 6767 times)

November 17, 2016, 08:29:47 AM
Read 6767 times

piktor

  • Sr. Newbie

  • Offline
  • **

  • 2
Hello there,

Is there in Inkscape any solution, that I can draw lines from certain geometrical points (like in AutoCAD or CorelDraw).  E.g.  I wish to draw a line from the center of an rectangle which will be a tangent to circle.  Or I line, which will connect intersections of given objects.  Or draw a line from a starting point perpendicular to line.  Without precise geometrical snap to centers, midpoints, intersections, vertices, tangents it is very hard to construct precise objects.

Unfortunately I found nothing searching through help, tutorials and related web pages.

Thanks for any hint.

Piktor

November 17, 2016, 01:04:29 PM
Reply #1

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Welcome aboard!

There are certain snapping options.

However, keep in mind inkscape works with svg-s and has some limitations regarding the precision.
First of all, you can increase it in the prefs (Shift+Ctrl+P).
That means every value stored is a float with limited number of digits.
Theoretically the workspace can be 999,999 m / 999,999 m, large, but there is a ghosting issue when you exceed a certain area.
That means you may not draw everything in 1:1 scale.
Theoretically you can set the default document units in the document's properties (Shift+Ctrl+D) to real world units, but as far as I know
up to 0.91 inkscape works px based and a viewbox attribute is added to the whole document to scale everything to the set size.
There seems to be some improvement in 0.92, but cannot really tell what's in behind.
(Only know for sure the 90 dpi resolution was changed to 96 dpi.) 
Theoretically each value is stored "precisely", however if you open the document in the xml editor/with a notepad you will see weird values of 0,000006 etc. There must be some rounding errors.
Does this really affect the performance?
Not much, the interface only accepts two or three digits depending on the boxes.

Now, focusing more on the harder part.
Inkscape works svg based and the basic of these graphics are Bézier paths.
They by definition cannot resemble a circle precisely.
Although circular arcs are part of the svg specs, they are not implemented in 0.91, not sure if 0.92 is improved.
Now they may render right but not sure if there is a gui for editing arcs.

That means you will need to deal with some inaccuracy.


Real question is, is it a problem at all? Can Béziers be used for constructing?
By experience for comparing, constructed this image by intersections and the error added up was only about 0,005% in a total.
But it all depends on how you construct your image. Some methods may be more precise than others.
Like for constructing a tangent in midpoint of a line segment you can avoid drawing any circles.

November 17, 2016, 11:40:37 PM
Reply #2

piktor

  • Sr. Newbie

  • Offline
  • **

  • 2
Thanks for your detailed response. To answer your question about beeing a problem, I have to state yes, it is a problem.
I have learned to construct things by geometrical construction using a ruler and a compass.
I found the basic snapping tools, but they don't help very much. To make use of them you need to draw much more lines and do calculations for drawing guides, that you can use those snaps for more advanced constructions.
Examples: 
  • I have constructed a square and now i need a circle in the center of the square. In other programs i need to go with the cursor near the position, where i guess, that the center is, and a hint appears, that i can snap now to the center.
  • I have two circles and I wish to connect both circles with the to two common tangents
  • I need to draw a line from the center of a "straight line"-segment of a path
  • I need to draw a circle with the center beeing on the interection of two other objects

So it seems, that my observation is right, and there are no hidden features or plugins.

Thanks

  Piktor

I know about the precision behind, but that ist still good enough.  The problem here is, that I evaluate inkscape a an open source tool for kids, where Corel Draw or more expensive programs are no choice.

November 18, 2016, 11:14:34 AM
Reply #3

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Interesting.

For a square's center there is an option of snapping to bounding box centres.
If you need that point graphically constructed as a node, then it would be only duplicating the square,
deleting one of its corner nodes, straightening the remaining segment -might not be necessary depending on your settings-
and adding a new node to the "new" segment by the node tool's add new node option.

With the same trick you can generate midpoints to any segment.
There have been some request for cad like features, which never got big. Guess such a snapping option could be requested and implemented relatively easily. But there is an extension to divide path segments to equal lengths for a long time.

Circles are a lacking part. There is an option for tangential snapping to paths though I haven't used it, can't say how it works in practice.
Wouldn't say constructing tangents to two circles is impossible, but probably I wouldn't go exactly by the compass and ruler method.
Suv may correct me on circles, had seen her drawing using circular path segments so something is in development.
The "circle" svg element was added in 0.91, previously it was all ellipse objects.



I also learned constructing by compass and arrow but manual drafting also has its cheats and a much larger inaccuracy.
On an other hand "precise" constructions are targeted more by cad programs.
BUT that doesn't mean it would produce better output by saving as pdf.
In fact it is quite the opposite, cad programs produce the worst images of them all. Hatch fills and circle segments thrown to line segments, solid  fills with curved borders triangulated -inkscape can produce way better than that.
Some printers may even choke on those bad pdf-s because of the overload.

For comparing, here is more or less the same image drawn with autocad and inkscape.
Autocad (2006) one was saved to pdf, opened with inkscape and exported to png:

autocad

inkscape

I'd say for such a use inkscape is a way better choice.

November 18, 2016, 02:47:23 PM
Reply #4

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
 - For how to use the snap settings, see also: https://inkscape.org/en/~Moini/%E2%98%85snapping-guide-091
Circles can be created from the center by holding down Shift + Ctrl. Snapping to object centers as well as rotational centers is supported.

- For the circles' tangents, there exists an extension, see http://wiki.inkscape.org/wiki/index.php/Inkscape_Extensions .

- snapping to segment midpoints is supported, see first link.

- snapping to path intersections is supported, see first link.

November 19, 2016, 03:45:59 AM
Reply #5

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Theoretical discussion aside, let's talk specifics.  The difference between Inkscape circles, and the true circles which Lazur describes is only evident if you zoom in as far as Inkscape can zoom.  And even then, it's hard to see (well, hard for me anyway).  And I don't personally know which one is correct.  edit - I mean, I don't disbelieve Lazur, but I have no personal understanding of why they are different.  Maybe pi aren't square?  But it really is a very tiny difference.

Is there in Inkscape any solution, that I can draw lines from certain geometrical points (like in AutoCAD or CorelDraw).  E.g.  I wish to draw a line from the center of an rectangle which will be a tangent to circle.  Or I line, which will connect intersections of given objects.  Or draw a line from a starting point perpendicular to line.  Without precise geometrical snap to centers, midpoints, intersections, vertices, tangents it is very hard to construct precise objects.

I find Inkscape to be incredibly precise.  Perhaps not for building rocket parts, but still very precise.  I also started with a very geometrical perspective with Inkscape, wanting it to work as if I had a ruler, pencil and paper.  Inkscape just doesn't work like that, but it was not a difficult transition at all, for me.  You just need to get a grasp of vector graphics, and things will start to make more sense.

Inkscape can snap to either rotation center or center of object, segment midpoints, path intersection (or intersection with other things like guides), in addition to nodes, paths, bounding box sides, corners, midpoints.  Since there will always be a node creating a true vertex, then yes, Inkscape can snap to vertices.  And I'm pretty sure there's a way to snap to circle tangent.

To draw a line from a precise point, first draw the line, then move the nodes (the endpoints of the line) to the point you need (Node tool control bar).  If you absolutely have to start drawing from one particular point, I would suggest dragging out a Guide.  Double-click on the Guide to get a small window where you can precisely place the guide line. 

Now, you can either place another guide (perpendicular) or you can place the guide's handle (it's a tiny dot) on your point (also using the same small window).  Now, with snapping enable, you can click on or even just near that point, and Inkscape will start the path precisely on that point.

I have found that snapping can be + or -0.001 pixels off.  So if you need more precision than that, you will need to look somewhere else, perhaps to CAD.

Let me re-read your other requests and I can explain how to draw them as well.
« Last Edit: November 19, 2016, 04:19:32 AM 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                       

November 19, 2016, 04:17:12 AM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
I know about the precision behind, but that ist still good enough.  The problem here is, that I evaluate inkscape a an open source tool for kids, where Corel Draw or more expensive programs are no choice
You're evaluating Inkscape for children, and you need absolute precision?   :???:  If you want to teach children how to use Inkscape, I think that is great!  But you might as well teach from a vector perspective.  What's wrong with learning both ways -- paper and ruler, as well as vector (Inkscape)?

Examples: 
  • I have constructed a square and now i need a circle in the center of the square. In other programs i need to go with the cursor near the position, where i guess, that the center is, and a hint appears, that i can snap now to the center.
  • I have two circles and I wish to connect both circles with the to two common tangents
  • I need to draw a line from the center of a "straight line"-segment of a path
  • I need to draw a circle with the center beeing on the interection of two other objects

To put a circle in the middle of a square using vector paths, first draw the circle and square to the needed dimensions.  Select both.  The Object menu > Align and Distribute.  Now in the dialog which opens, click the Align on Vertical Axis button :ava: and also the Align on Horizontal Axis button  :aha: .  I consider that to be the easiest way.  But if you want to teach drawing from the center, there is a way to do that as well, using snapping.

First draw the square.  Then set up snapping to snap to either center of object or rotation center.  Now enable the Ellipse tool.  When you are roughly near the center of the square, hold the Ctrl key and the Shift key together, while you drag out the circle.  Inkscape will automatically snap the center of the new circle to the center of the square.  As you drag out towards one of the corners of the square, Inkscape will snap the Ellipse tool to the corner, so that you've constructed a circle that is exactly the same size as the square -- and automatically centered.

I don't understand you're 2nd task.  Connect 2 circles to 2 common tangents.  Are you starting with the circles or with the tangent lines?  I can explain, but I need to understand which one you want to draw first.

Drawing a line from the center of a segment is really easy with snapping.  Just enable to snap to the center of line segments, put your mouse near the center, and when you click to start the new path, it will automatically be aligned at the precise center.

Your 4th example is still easily do-able with Inkscape.  If you want me to explain how, I can.  But I hope I've answered your questions about what Inkscape can do.

I think it would be awesome for children to learn Inkscape, and I think for the basic tasks you're talking about, Inkscape would be easy for them to learn -- especially if they've never used any kind of paint type of program (raster graphics).  Just from my personal experience, as well as helping other people learn Inkscape, it seems to be easier if they've never used a raster graphics program before.  It seems to make it more confusing for them, if they first learned about computer graphics using a paint type or raster graphics program.

  • 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                       

November 19, 2016, 04:23:34 AM
Reply #7

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Note that it takes a little study and practice to learn how to set up snapping in the best way for your particular needs.  If you find it's behaving wildly, or that it's hard to use, just post back, and we can help you with all the various options.  I promise you that it's incredibly useful and easy to use, once you understand all the options!
  • 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