Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use arc co-ordinates from .slib file to draw an arc in Qt ?
Forum Updated to NodeBB v4.3 + New Features

How to use arc co-ordinates from .slib file to draw an arc in Qt ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 224 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tushu
    wrote on last edited by tushu
    #1

    I am trying to generate various gate symbols ( AND,NOT,XNOR,MUX etc) by reading .slib file.
    But I faced a problem while reading an arc related co-ordinate from .slib file.

    I am not understanding how to use those co-ordinates and draw an arc ?
    The format of an arc in .slib file is confusing.

    Here is the example:
    OAI.png

    .slib format for an arc and for line

    line (66 * SCALE, 80 * SCALE, 0 * SCALE, 80 * SCALE); 
    line (94 * SCALE, 70 * SCALE, 62 * SCALE, 70 * SCALE);
                  .
                  .
    arc (145 * SCALE, 100 * SCALE, 94 * SCALE, 70 * SCALE,94.9268 * SCALE,126.774 * SCALE);     
    arc (94 * SCALE, 130 * SCALE, 145 * SCALE, 100 * SCALE,94.9268 * SCALE, 73.2256 * SCALE);    
    arc (61 * SCALE, 130 * SCALE, 61 * SCALE, 70 * SCALE,8.75 * SCALE, 100 * SCALE);
    

    1st line says draw an arc from O (145,100) to F(94,70)
    2nd line says draw an arc from L(94,130) to O(145,100)
    3rd line says draw an arc from K(62,30) to E(62,70)

    I tried to draw an arc by using 1st 4 co-ordinates from line ( but do not know how to use remaining 2 co-ordinates ? )

    QPainterPath path;  // arc from L --->  F 
    path.moveTo(94,70);
    QRect bound1 (44,70,102,60);
    path.arcTo(bound1,90,-180);
           
    QPainterPath path1;  // arc from K ---> E
    path1.moveTo(62,70);
    QRect bound2 (42,70,40,60);
    path1.arcTo(bound2,90,-180);
    

    And I got following output :
    OAI2.PNG
    But ,
    Input lines to OR gate are not attached to 1st arc.
    I am using only first four co-ordinates. How to use remaining 2 co-ordinates to draw an arc ?

    So how to use all given co-ordinates from.slib to draw an arc ?

    Note : SCALE is defined at the start of the file.

    T 1 Reply Last reply
    0
    • T tushu

      I am trying to generate various gate symbols ( AND,NOT,XNOR,MUX etc) by reading .slib file.
      But I faced a problem while reading an arc related co-ordinate from .slib file.

      I am not understanding how to use those co-ordinates and draw an arc ?
      The format of an arc in .slib file is confusing.

      Here is the example:
      OAI.png

      .slib format for an arc and for line

      line (66 * SCALE, 80 * SCALE, 0 * SCALE, 80 * SCALE); 
      line (94 * SCALE, 70 * SCALE, 62 * SCALE, 70 * SCALE);
                    .
                    .
      arc (145 * SCALE, 100 * SCALE, 94 * SCALE, 70 * SCALE,94.9268 * SCALE,126.774 * SCALE);     
      arc (94 * SCALE, 130 * SCALE, 145 * SCALE, 100 * SCALE,94.9268 * SCALE, 73.2256 * SCALE);    
      arc (61 * SCALE, 130 * SCALE, 61 * SCALE, 70 * SCALE,8.75 * SCALE, 100 * SCALE);
      

      1st line says draw an arc from O (145,100) to F(94,70)
      2nd line says draw an arc from L(94,130) to O(145,100)
      3rd line says draw an arc from K(62,30) to E(62,70)

      I tried to draw an arc by using 1st 4 co-ordinates from line ( but do not know how to use remaining 2 co-ordinates ? )

      QPainterPath path;  // arc from L --->  F 
      path.moveTo(94,70);
      QRect bound1 (44,70,102,60);
      path.arcTo(bound1,90,-180);
             
      QPainterPath path1;  // arc from K ---> E
      path1.moveTo(62,70);
      QRect bound2 (42,70,40,60);
      path1.arcTo(bound2,90,-180);
      

      And I got following output :
      OAI2.PNG
      But ,
      Input lines to OR gate are not attached to 1st arc.
      I am using only first four co-ordinates. How to use remaining 2 co-ordinates to draw an arc ?

      So how to use all given co-ordinates from.slib to draw an arc ?

      Note : SCALE is defined at the start of the file.

      T Offline
      T Offline
      tushu
      wrote on last edited by
      #2

      @mrjj @JoeCFD @SGaist @JKSH @jsulm @JonB
      Can you look into this problem ?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        A complete minimal example would be better so people can check things.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by ChrisW67
          #4

          Seems to be a good answer to this same question posted on StackOverflow

          Essentially this:

          arc (61 * SCALE, 130 * SCALE, 61 * SCALE, 70 * SCALE,8.75 * SCALE, 100 * SCALE);
          

          reads as, a scaled arc centred on (8.75, 100) from (61,130) to (61, 70).
          The two end points are 60.25 units from the centre.
          Points H(66,80) and J(66,120) are 60.64 units from the centre, so pretty close to on the arc.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved