Bug 405643

Summary: Feature request: circle in a square assistant tool
Product: [Applications] krita Reporter: Hector <misha.bossmass>
Component: Tool/AssistantsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: griffinvalley, maxmustermann1884, srirupa.sps, tgdev001
Priority: NOR Keywords: triaged
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: simple drawing example
from getleonardo.com

Description Hector 2019-03-19 12:48:54 UTC
Created attachment 118912 [details]
simple drawing example

The tool looks like an ellipse tool, but is in a square. This is needed for more simply drawing ellipses in perspective. To draw it with the current ellipse tool, you need to draw the diagonals of the square and correctly align the axis of the ellipse to the square. With the circle in a square tool you just need to set the 4 corners of the square.
Comment 1 wolthera 2019-03-19 12:55:57 UTC
Okay, so what you effectively want is a readjustable 4 corner mesh that always has a circle inside it which touch the sides?
Comment 2 Hector 2019-03-19 13:04:06 UTC
(In reply to wolthera from comment #1)
> a readjustable 4 corner mesh that always has a circle inside

Yes it is. This is the simplest method of drawing an ellipse in perspective. We draw a square, and in it we draw a circle. The circle touches the midpoints of the sides of the square. It is easy to draw a square in perspective, but it takes too much time to set a concentric ellipse tool.
Comment 3 wolthera 2019-03-19 16:35:43 UTC
Alright, it doesn't seem to complex to implement, but someone needs to find time first ;)

WISHGROUP: Larger Usability Fixes
Comment 4 Hector 2019-09-30 08:01:08 UTC
Created attachment 122943 [details]
from getleonardo.com
Comment 5 stephen 2021-02-17 19:24:55 UTC
(In reply to wolthera from comment #1)
> Okay, so what you effectively want is a readjustable 4 corner mesh that
> always has a circle inside it which touch the sides?

(In reply to Hector from comment #4)
> Created attachment 122943 [details]
> from getleonardo.com

Greetings. Here's an article with demo showing another use case of the feature : having it in perspective and move it according to distance in space. You might take a look.

https://lazynezumi.com/perspectiveEllipse
Comment 6 Srirupa Datta 2022-01-03 20:01:23 UTC
(In reply to wolthera from comment #3)
> Alright, it doesn't seem to complex to implement, but someone needs to find
> time first ;)
> 
> WISHGROUP: Larger Usability Fixes

I was thinking about implementing this as part of Season of KDE 2022, is anyone available to mentor this project?
Comment 7 Hector 2022-01-05 07:49:12 UTC
(In reply to Srirupa Datta from comment #6)
> anyone available to mentor this project?
I am not a mentor, but i can be your tester for this. If you need
Comment 8 Srirupa Datta 2022-01-05 08:35:54 UTC
(In reply to Hector from comment #7)
> (In reply to Srirupa Datta from comment #6)
> > anyone available to mentor this project?
> I am not a mentor, but i can be your tester for this. If you need

That would great, let me see if someone on #krita is willing to mentor this project as having a mentor is compulsory for SoK.
Comment 9 Halla Rempt 2022-05-26 09:31:24 UTC
Git commit 35f3f66444c39ceb7c227b545fccaea6164b4fb9 by Halla Rempt, on behalf of Srirupa Datta.
Committed on 26/05/2022 at 09:30.
Pushed by rempt into branch 'master'.

Add Perspective Ellipse Assistant Tool

This assistant is meant to help create an ellipse
within a quadrilateral (tetragon).
It helps the user to draw circles in perspective.
The assistant draws the vanishing points that fit
that perspective.

This commit however doesn't have correct calculations,
so the end result assistant doesn't work properly.

M  +6    -0    libs/ui/kis_painting_assistant.cc
M  +1    -0    plugins/assistants/Assistants/CMakeLists.txt
A  +509  -0    plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc  *
A  +70   -0    plugins/assistants/Assistants/PerspectiveEllipseAssistant.h  *
M  +2    -0    plugins/assistants/Assistants/assistant_tool.cc
M  +5    -1    plugins/impex/libkra/kis_kra_saver.cpp

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://invent.kde.org/graphics/krita/commit/35f3f66444c39ceb7c227b545fccaea6164b4fb9
Comment 10 Halla Rempt 2022-05-26 09:31:32 UTC
Git commit 01ade4920b8cf03feee12490bf5b4d5355732c8b by Halla Rempt, on behalf of Agata Cacko.
Committed on 26/05/2022 at 09:30.
Pushed by rempt into branch 'master'.

Fix Ellipse in Perspective calculations

Fix ellipse calculations and formulas and clean up
the code.
After this commit, the ellipse in perspective assistant
works as expected.

M  +128  -29   libs/global/kis_algebra_2d.cpp
M  +15   -0    libs/global/kis_algebra_2d.h
M  +18   -0    libs/image/tests/kis_algebra_2d_test.cpp
M  +1    -0    libs/image/tests/kis_algebra_2d_test.h
M  +408  -227  plugins/assistants/Assistants/PerspectiveEllipseAssistant.cc
M  +15   -9    plugins/assistants/Assistants/PerspectiveEllipseAssistant.h

https://invent.kde.org/graphics/krita/commit/01ade4920b8cf03feee12490bf5b4d5355732c8b