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 8: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?

Cheers

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

Re: Canvas arcs

Postby Necolatis » Tue Dec 13, 2016 7: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
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Canvas arcs

Postby D-EKEW » Tue Dec 13, 2016 8: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.
D-EKEW
 
Posts: 174
Joined: Mon Jan 10, 2011 9:22 pm
Callsign: D-EKEW, ELLX-TWR
Version: git
OS: Linux

Re: Canvas arcs

Postby Soitanen » Wed Dec 14, 2016 8: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).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Canvas arcs

Postby zakalawe » Thu Dec 15, 2016 6: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!
zakalawe
 
Posts: 1259
Joined: Sat Jul 19, 2008 5:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

Re: Canvas arcs

Postby xcvb » Mon Jan 02, 2017 10: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"
xcvb
 
Posts: 132
Joined: Sat Mar 14, 2015 3:08 pm
Version: Next
OS: Fedora Kinoite

Re: Canvas arcs

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

The canvas arc is basic and very low level- seehttp://wiki.flightgear.org/Canvas_Nasal_API#arcSmallCCWTo

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.

Alan
Alant
 
Posts: 1219
Joined: Wed Jun 23, 2010 6:58 am
Location: Portugal
Callsign: Tarnish99
Version: latest Git
OS: Windows 10/11

Re: Canvas arcs

Postby Hooray » Wed Jan 04, 2017 8: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:

http://wiki.flightgear.org/Howto:Extend ... SVG_module
Image

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,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Canvas arcs

Postby Octal450 » Sat Jul 29, 2017 12:06 am

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!!!
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Canvas arcs

Postby Octal450 » Sat Jul 29, 2017 12:18 am

Nevermind guys -- this fixed it: viewtopic.php?f=71&t=29180#p289357
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11


Return to Canvas

Who is online

Users browsing this forum: No registered users and 5 guests