Board index FlightGear Development Canvas

Canvas arcs

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Canvas arcs

Postby D-EKEW » Mon Dec 12, 2016 7:41 pm

Every now and then I stumble on this, but canvas seems to display arcs the wrong way around (mirrored around the endpoints) to what is drawn in Inkscape.
Well sometimes, sometimes it is correct. It seems it is arbitrary.

Anyone else seen this issue?


Posts: 164
Joined: Mon Jan 10, 2011 8:22 pm
Callsign: D-EKEW, ELLX-TWR
Version: git
OS: Linux

Re: Canvas arcs

Postby Necolatis » Tue Dec 13, 2016 6:27 am

Isn't that just a question of using small vs. large arcs?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore

User avatar
Posts: 1947
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Canvas arcs

Postby D-EKEW » Tue Dec 13, 2016 7:32 pm

not sure what you mean by that.
Let me try to explain better. I draw an open arc in Inkscape. It is of course defined by 2 points and the radius. But then you can still draw the arc in 2 ways: left or right. Don't know how Inkscape defines that, but it does because the arc is always presented as I have drawn in on my screen.

However if I display the .svg with canvas, drawing it left or right is arbitrary. Sometimes right, sometimes left. Up to now I have always found a workaround, but I think if it could be fixed would save us some trouble.
Posts: 164
Joined: Mon Jan 10, 2011 8:22 pm
Callsign: D-EKEW, ELLX-TWR
Version: git
OS: Linux

Re: Canvas arcs

Postby Soitanen » Wed Dec 14, 2016 7:42 am

Looks similar to my problem: viewtopic.php?f=71&t=29180#p280760
Solved with some manipulations in Inkscape.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Canvas arcs

Postby zakalawe » Thu Dec 15, 2016 5:53 pm

Can you email me two SVG files from Inkscape, which different in the left/right direction? I suspect this is a bug which can be fixed in our side, unless of course it's a bug in Inkscape. I've been touching this code recently for other reasons so it's currently fresh in my mind, having taken a while to understand it!
Posts: 1152
Joined: Sat Jul 19, 2008 4:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

Re: Canvas arcs

Postby xcvb » Mon Jan 02, 2017 9:05 pm

I only have this issue if I use closed circles instead of arcs. This is how I can solve it:
- Activate path edit mode in Inkscape (button "n")
- Select one node of the circle
- Click "break path at selected nodes"
Posts: 86
Joined: Sat Mar 14, 2015 2:08 pm
Version: 2018.1.1
OS: Fedora 27

Re: Canvas arcs

Postby Alant » Tue Jan 03, 2017 12:36 am

The canvas arc is basic and very low level- see

1. All co-ordinates are cartesian, not polar. (not a good idea for drawing arcs - but that is all we have.IMHO Centre co-ordinates, radius, start angle , finish angle would be much better)
2. End co-ordinates are relative to the start position of the arc.( also bad, why not have the same co-ordinate system for both start and stop ?)
3. Any one of 4 routines may be used, depending on the direction and size of the arc that you are trying to generate.
4. arcSmallCW and arcLargeCW draw clockwise arcs from the start position to the finish position.
5. arcSmallCCW and arc LargeCCW draw counterclockwise arcs from the start position to the finish position..
6. "Small" and "Large" are used to say that you want a large ( <180deg) or small (>180deg) arc.

Hope this helps.

Posts: 912
Joined: Wed Jun 23, 2010 5:58 am
Location: Portugal
Callsign: Tarnish99
Version: from Git
OS: Windows 10

Re: Canvas arcs

Postby Hooray » Wed Jan 04, 2017 7:13 pm

It might be worth noting that many SVG related problems that people report here are due to the svg.nas parser not supporting the corresponding higher-level SVG elements, so that people currently need to resort to "simplify path".

However, it is rather straightforward to modify/extend the parser, especially for people already familiar with Nasal - I think James recently also made a few additions. A while ago, I began documenting how the parser can be extended to support additional tags. The tutorial demonstrates how to add support for the <image> tag to map it to the corresponding Canvas::Image element: ... SVG_module

Note that such, and similar, additions would be generally useful - i.e. because people could design their avionics/MFDs (or whatever else) using mainly Inkscape instead of having to use tons of custom Nasal coding to work around certain limitations.

The same could be said to also apply to refining the corresponding Nasal APIs for some of the more common 2D drawing purposes.

I think it was Thorsten who was once hinting at helping create/shape a corresponding API for procedurally creating such MFD elements
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Posts: 11329
Joined: Tue Mar 25, 2008 8:40 am

Re: Canvas arcs

Postby Octal450 » Fri Jul 28, 2017 11:06 pm

I have this same problem (see my thread: viewtopic.php?f=71&t=32626&p=315259#p315259)

Any way to solve this? It is really annoying!!!
Posts: 4397
Joined: Tue Oct 06, 2015 12:51 pm

Re: Canvas arcs

Postby Octal450 » Fri Jul 28, 2017 11:18 pm

Nevermind guys -- this fixed it: viewtopic.php?f=71&t=29180#p289357
Posts: 4397
Joined: Tue Oct 06, 2015 12:51 pm

Return to Canvas

Who is online

Users browsing this forum: No registered users and 2 guests