There's no easy way to draw springs, coils, sinusoids, etc. The only way to do this is with a bézier curve (too much precision required), hand-drawn (even more), or with ellipse arcs (and everyone knows how ugly a "sinusoid" drawn with half ellipses is). It might be a good idea to include a line shape that allowed to draw * a sinusoid * a "coil" or "spring" * a cycloid or trochoid (I doubt anyone actually wants to draw this, but it would be a particular case of "coil") The parametric formula (for a horizontal coil) is { x = t * L/2pi + e*H/2 * cos(t+t0) { y = H/2 * sin(t+t0) { for t = 0 ... W / (L/2pi) where H is the height (amplitude), W the width (length), L the distance between loops (wavelength), e the eccentricity (e=0: sinusoid; e=1: trocoid; 0<e<1: another coil-shaped line), and t0 the initial phase.
enhancement request. inherited from OOo
While having a function plotter in Draw sounds interesting, I'd say this is out of scope. As a workaround (it's rather the intended interaction in an office suite) you could enter the function in Calc, plot the data and copy/paste the result to Draw.
I want to clarify that the main point of this report was not plotting arbitrary functions nor rigorously accurate shapes, but rather to provide a shape that *resembles* a "wave" or a "spring". This would be useful in the same way that it's useful to have curved arrows, clouds, or smileys; i.e. to decorate drawings and presentations. The mathematical functions I wrote were just one way to generate them, although I guess that approximating it with Bézier curves would be easier to implement (it does not need to be an exact shape; just something that "looks like a coil"). (I mentioned the cycloid and trochoid just because they were just particular cases of "a coil in perspective", not because I thought those mathematical shapes were necessary. Maybe it was a mistake to mention them since they're out of the point of this report.)
(In reply to cousteau from comment #3) > I want to clarify that the main point of this report was not plotting > arbitrary functions nor rigorously accurate shapes, but rather to provide a > shape that *resembles* a "wave" or a "spring". Sorry, misunderstood this. Wouldn't this shape have an odd size limitation? And what category do you suggest for this type of shape? I mean, currently we have way too many categories and objects in the gallery. That might be convenient for users who know what they are looking for but browsing through the gallery is a pain.
Probably the Symbols category would be the best suited. What do you mean with size limitation?
(In reply to cousteau from comment #5) > What do you mean with size limitation? Gallery objects have a fix size, and when you need a coil with 200px you have to scale up the predfined 100px object (for example) to double its original size. (In reply to Heiko Tietze from comment #2) > While having a function plotter in Draw sounds interesting, I'd say this is > out of scope. Not so sure anymore, and perhaps it can be done easily. Such a special curve could start as a simple sinusoid and offer special options. Could be an outstanding feature.
The coil could be an interesting object for custom shapes, if possible.
Re-evaluating the EasyHack in 2022 This enhancement is still relevant. I don't see springs, coils, sinusoids or other similar shapes available in the menus or toolbars. These shapes can be drawn using some input parameters taken from the user.
Created attachment 193326 [details] A LibreOffice Draw file showing a demo of the proposed sinusoid gallery shape.
Created attachment 193327 [details] A LibreOffice Draw file showing a demo of the proposed flag gallery shape.
Hello, I'd like to work on this issue as my interesting difficulty easyhack for GSoC. To that end, I have submitted a gerrit patchset (https://gerrit.libreoffice.org/c/core/+/165353) for the same, which adds a sinusoid shape, as well as a flag shape. The sinusoid is a standard mathematical sine wave (approximated by Bézier curves), one wavelength in size. It can be stretched, rotated, flipped, and tiled end-to-end to form various sine waves. For sections of sinusoids smalled than a wavelength, the shape subtract operation could be used to cut away parts. The fill and stroke can be set (or unset) to form detailed graphs. I imagine the shape will be used primarly for mathematical texts, and works well enough for that, as can be seen in the attached Sinusoid.odg (https://bugs.documentfoundation.org/attachment.cgi?id=193326) file. The flag is a pair of sinusoids, vertically shifted with the enclosed area filled in. I originally meant it to be a sinusoid with arbitrary thickness (i.e. the curve is a fill rather than a stroke, like in the sinusoid shape). However that looked weird (as sinusoids do not have well-defined parallel curves, and simply vertically shifting them thus creates uneven thickness). But I decided to keep the shape, as with sufficient thickness it resembles how one might draw a waving flag, and giving it bitmap/gradient fills can be a good way to make flags. This is demoed in the attached Flag.odg (https://bugs.documentfoundation.org/attachment.cgi?id=193327) file. I'm aware these shapes are not release-ready yet. For one, they need icons in in icon themes for the LO Draw sidebar, for which the design team will have to step in. There may also be places in the code where I missed adding names/references to these shapes, as all the code files I altered where the ones I could find with grep and deduce their workings. If so, I'd appreciate if someone could let me know what more to change. The issue mentions taking user input for the shapes, however I believe they should not be made more complex than is. At that point it may be easier to just let the user plot a function in Calc (as a chart) or create it externally (and paste it in). This issue also mentions a coil/spring like shape, which I'd be willing to work on as well, but I might need help on the approximating with Bézier curves part.
RMZeroFour committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/afb18ac0628c54fdffc1ee5b55db6110c20872cd tdf#50998 tdf#87892 Add sinusoid shape It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
In release notes: https://wiki.documentfoundation.org/index.php?title=ReleaseNotes%2F24.8&type=revision&diff=752759&oldid=752758 Verified in: Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community Build ID: 1f15d097cace14ca6e44e7652f460aa3fa7bd150 CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: CL threaded