Results 1 to 5 of 5

Thread: How to draw a fixed line based on Orientaion

  1. #1
    Join Date
    Jun 2013
    Posts
    58
    Thanks
    26
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Post How to draw a fixed line based on Orientaion

    Good day

    Where a user clicks a line or must be drawn showing the orientation
    Where the user clicks I store its point in an array
    I have another array with different orientations

    How do I draw a Fixed line of length(3)[arrow] from 1 point in the direction of the orientation

    Idea on how to go about doing it

    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to draw a fixed line based on Orientaion

    By keeping the coordinate of the other axis?

    Cheers,
    _

  3. #3
    Join Date
    Jun 2013
    Posts
    58
    Thanks
    26
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: How to draw a fixed line based on Orientaion

    Basically, my idea is
    After user clicks a point
    I have to create another point in the orientation from the initial point
    and draw a line between them

    Is there a function out there
    that accepts Initial point, and an orientation -> showOrientation(1stPoint, Orientation)
    and does the math?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to draw a fixed line based on Orientaion

    Orientation as in Qt::Orientation?

    Btw, you will also need a distance

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    ebsaith (28th June 2013)

  6. #5
    Join Date
    Jun 2013
    Posts
    58
    Thanks
    26
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: How to draw a fixed line based on Orientaion

    Sloved! it was more of a math problem

    my solution:
    Qt Code:
    1. newEndPoint.setX(x1 + length*cos(theta));
    2. newEndPoint.setY(y1 + (length*sin(theta)));
    To copy to clipboard, switch view to plain text mode 

    Kind Regards

Similar Threads

  1. Replies: 4
    Last Post: 23rd May 2012, 08:10
  2. Replies: 0
    Last Post: 28th June 2010, 01:29
  3. Draw a line
    By Daan in forum KDE Forum
    Replies: 1
    Last Post: 27th August 2009, 17:29
  4. Draw Line
    By aloysiusjegan in forum Qwt
    Replies: 4
    Last Post: 12th February 2009, 11:02
  5. Best way to draw a Line
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2008, 09:57

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.