FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: EVE - How to draw an Arc with a line thickness  (Read 997 times)

jberkhout

  • Newbie
  • *
  • Posts: 31
    • View Profile
EVE - How to draw an Arc with a line thickness
« on: June 23, 2018, 03:17:48 PM »

Hi,
Using KT813, how can I best draw an arc with a line thickness?
For example for a line, I can use:

Code: [Select]
ft_void_t FT813::Line(ft_int16_t x0, ft_int16_t y0, ft_int16_t x1, ft_int16_t y1, ft_int16_t width)
{
    ft_uint32_t calc;

    StartFunc(FT_CMD_SIZE*5);
    SendCmd(DL_BEGIN | FT8_LINES);
    calc = LINE_WIDTH(width * 16);
    SendCmd(calc);
    calc = VERTEX2F(x0 * 16, y0 * 16);
    SendCmd(calc);
    calc = VERTEX2F(x1 * 16, y1 * 16);
    SendCmd(calc);
    SendCmd(DL_END);
    EndFunc();
}

Kind regards,
Jack.
« Last Edit: July 02, 2018, 08:50:58 AM by jberkhout »
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 263
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #1 on: June 25, 2018, 10:34:57 AM »

Hello,

Please see section 2.5.4 of the programmers guide:
http://brtchip.com/wp-content/uploads/Support/Documentation/Programming_Guides/ICs/EVE/FT81X_Series_Programmer_Guide.pdf
You can use the VERTEX2F or VERTEX2II commands to draw graphics primitives including lines/arcs.

I notice you have had a lot of queries recently, it may be more productive for you to direct these to support1@ftdichip.com.

Best Regards,
FTDI Community
Logged

Rudolph

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #2 on: June 26, 2018, 09:35:57 AM »

You can use the VERTEX2F or VERTEX2II commands to draw graphics primitives including lines/arcs.

Actually, no, there is no command for drawing arcs or full circles, that is something I am missing in the FT8xx as well.
You can draw a circle by drawing a POINT and then a smaller one with the background color on top of it.
Plus you could draw a RECT to mask out a portion of that circle for an arc.

And you could in theory use a LINESTRIP to draw an arc but that would not only require quite a lot VERTEX2F commands for a decent arc and therefore eating up the available space in the display-list fast, it also is a pain for the controller to calculate since the Y coordinate has to be shifted into that odd bit-position for every VERTEX2F.

The third option would be to use bitmaps, if you can't draw it on the fly, fake it. :-)

Logged

jberkhout

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #3 on: June 27, 2018, 05:46:59 PM »

Thank you Rudolph,
While still new to this display, I'm struggling with just the common graphics primitives, really basics like arcs, (outline) circles, for instance.
Using two points to draw an outline circle seems a bit odd, but then how do I create an arc with perpendicular line ends for any given start and end angles?
I could use a thick arc to draw a Pie Chart, among other indicators.

I searched section 2.5.4 already, but these common graphics primitives seem not listed there:
dl( BEGIN(ARCS) );
dl( BEGIN(CIRCLES) );
Can you please provide an arc example using any random start and end angle, please?
That would really help me and others.
Thank you very much!
Kind regards,
Jack.
Logged

Rudolph

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #4 on: June 30, 2018, 12:33:27 PM »

As I wrote, there is no function to draw arcs or circles directly.
The follwing is untested, just a bunch of code put together adhoc from existing code and modified.

Drawing a circle:
   FT8_cmd_dl(DL_BEGIN | FT8_POINTS);
   FT8_cmd_dl(DL_COLOR_RGB | mycolor);
   FT8_cmd_dl(POINT_SIZE((diameter + (2*width))* 16));
   FT8_cmd_dl(VERTEX2F(some_x * 16,some_y * 16));
   FT8_cmd_dl(DL_COLOR_RGB | background);
   FT8_cmd_dl(POINT_SIZE(diameter * 16));
   FT8_cmd_dl(VERTEX2F(some_x * 16, some_y * 16));
   FT8_cmd_dl(DL_END);

Drawing an arc:

       fill_arc_array();

   FT8_cmd_dl(DL_COLOR_RGB | color);
   FT8_cmd_dl(LINE_WIDTH(width * 16));
   FT8_cmd_dl(DL_BEGIN | FT8_LINE_STRIP);

   for(counter=0;counter<31;counter++)
   {
                FT8_cmd_dl(vertex2f_arc_xy[counter]);
   }
   FT8_cmd_dl(DL_END);

So the second assumes that you have a vertex2f_arc_xy[] array with 32 bit values filled like this:
vertex2f_arc_xy[n] = VERTEX2F(some_x * 16,some_y * 16);

This can be pre-calculated data, maybe with the help of a spreadsheet or calculated on the fly between to points
in the plane and probably a radius to go with that.

The result of this can be seen somewhat in this picture:
https://github.com/RudolphRiedel/FT800-FT813/blob/master/example_pics/FT811_HY50HD.jpg
That graph on the right consists of a line-strip with 64 points with fixed values for the sample code.
That sine curve on the far right only has a fraction of that points and still looks decent.

But as I wrote above, this eats the display-list, you have to find a a trade-off between just enough points for the arc and a really smooth one.

For static display elements however using pictures of arcs would be far superior in terms of resources used.
Logged