Bug 50998 - add "coil" to draw basic shape menu
Summary: add "coil" to draw basic shape menu
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Ritobroto Mukherjee
URL:
Whiteboard: reviewed:2022 target:24.8.0
Keywords: difficultyInteresting, easyHack, skillDesign, topicUI
Depends on:
Blocks: Gallery Shapes-Custom
  Show dependency treegraph
 
Reported: 2012-06-12 02:30 UTC by cousteau
Modified: 2024-04-08 07:55 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
A LibreOffice Draw file showing a demo of the proposed sinusoid gallery shape. (34.11 KB, application/vnd.oasis.opendocument.graphics)
2024-03-26 16:57 UTC, Ritobroto Mukherjee
Details
A LibreOffice Draw file showing a demo of the proposed flag gallery shape. (15.33 KB, application/vnd.oasis.opendocument.graphics)
2024-03-26 16:57 UTC, Ritobroto Mukherjee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cousteau 2012-06-12 02:30:23 UTC
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.
Comment 1 tommy27 2014-12-13 10:11:49 UTC
enhancement request. inherited from OOo
Comment 2 Heiko Tietze 2016-05-04 12:17:41 UTC
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.
Comment 3 cousteau 2016-05-11 07:56:16 UTC
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.)
Comment 4 Heiko Tietze 2016-06-01 07:44:35 UTC
(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.
Comment 5 cousteau 2016-07-07 23:41:34 UTC
Probably the Symbols category would be the best suited.

What do you mean with size limitation?
Comment 6 Heiko Tietze 2016-07-08 08:47:48 UTC
(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.
Comment 7 Heiko Tietze 2019-02-22 11:03:11 UTC
The coil could be an interesting object for custom shapes, if possible.
Comment 8 Hossein 2022-08-04 13:41:26 UTC
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.
Comment 9 Ritobroto Mukherjee 2024-03-26 16:57:14 UTC
Created attachment 193326 [details]
A LibreOffice Draw file showing a demo of the proposed sinusoid gallery shape.
Comment 10 Ritobroto Mukherjee 2024-03-26 16:57:42 UTC
Created attachment 193327 [details]
A LibreOffice Draw file showing a demo of the proposed flag gallery shape.
Comment 11 Ritobroto Mukherjee 2024-03-26 16:59:31 UTC
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.
Comment 12 Commit Notification 2024-04-08 07:55:23 UTC
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.