Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Change direction of polar data visualization

    General and Desktop
    visualization data visualizat
    2
    9
    3235
    Loading More Posts
    • 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.
    • beecksche
      beecksche last edited by beecksche

      Hi,
      is it possible to change the direction of the polar coordinate system?
      In the Surface example the direction is clockwise:

      Polar example

      Can i change it to anti clockwise?

      Thanks

      kshegunov 1 Reply Last reply Reply Quote 0
      • kshegunov
        kshegunov Moderators @beecksche last edited by

        @beecksche
        Hey,
        In physics we call this parity. Flipping the coordinates will do what you want (i.e. if you make a reflection through the coordinate system's 0). I may be wrong, but probably the easiest way to do what you want is to actually change the coordinate system. In Qt it goes from left to right and top to bottom, if you switch it somehow (I don't know QML and I have no idea how this can be accomplished) so that it goes right to left, and bottom to top then you should be good to go.
        I hope that helps somewhat.

        Kind regards.

        Read and abide by the Qt Code of Conduct

        beecksche 1 Reply Last reply Reply Quote 0
        • beecksche
          beecksche @kshegunov last edited by beecksche

          @kshegunov
          Thanks for your reply.

          The doc says:

          The X axis becomes the angular axis and the Z axis becomes the radial axis. Polar mode is not available for bar graphs.

          I can change the reversed setting of the X axis. So i should change the direction, or am i wrong?

          Edit:
          I have tested the reveres setting, but the graph doesn't change.

          kshegunov 1 Reply Last reply Reply Quote 0
          • kshegunov
            kshegunov Moderators @beecksche last edited by kshegunov

            @beecksche
            Hi,
            I'm sorry I didn't realize you're using that module, I thought you're doing the graph yourself. Sadly, I have no idea how I can help with the data visualization module. I believe it was included in opensource only recently, so I haven't any experience with it.

            Kind regards.

            Read and abide by the Qt Code of Conduct

            beecksche 1 Reply Last reply Reply Quote 0
            • beecksche
              beecksche @kshegunov last edited by beecksche

              @kshegunov
              Oh sorry! It is my fault, i didn't mentioned anywhere.

              Since Qt 5.7 the Qt Data Visualization module is available under the GPL license, see this blog post.

              Now i have read some informations about the coordinate systems:
              The coordinate system used in the module is called azimuth system and it is mainly used in geography:

              For me as engineer, it would be interesting to use the "real" polar system ;-). Where the positve angle is count anti clockwise
              .

              But so far i haven't found any settings to change the systems.

              kshegunov 1 Reply Last reply Reply Quote 0
              • kshegunov
                kshegunov Moderators @beecksche last edited by kshegunov

                @beecksche
                Hi,

                I can change the reversed setting of the X axis. So i should change the direction, or am i wrong?

                No I meant you should reflect the rectangular coordinate. (There's an error in my first post, as you need to reflect only one of the coordinates, since this is a 2 dimensional space). What I mean is that instead of feeding (x, y, color) tuples to the chart you feed it (-x, y, color). This would reverse the "handedness", but also might screw up the labels ... I don't know ... try it out.

                Since Qt 5.7 the Qt Data Visualization module is available under the GPL license, see this blog post.

                Yes, that's what I mean. Until very recently it was available only for commercial users.

                The coordinate system used in the module is called azimuth system and it is mainly used in geography

                That's because they "look from" the center of the earth, not from the pole as one would expect. But in any case it's a very strange choice on account of the module developers, I'll grant you.

                For me as engineer, it would be interesting to use the "real" polar system

                I sympathize. I being a physicist wouldn't ever even consider using a left-handed coordinate system ...
                My advice is to address the developers directly on the mailing list if in a day or two you don't get a better answer here.

                Kind regards.

                Read and abide by the Qt Code of Conduct

                beecksche 1 Reply Last reply Reply Quote 0
                • beecksche
                  beecksche @kshegunov last edited by

                  @kshegunov
                  The data for the visualization is stored in cylindrical coordinates r, phi and z.

                  I tried to change the angle phi to -phi, but then no visualization is rendered.

                  The data is stored in a QItemModelSurfaceDataProxy, maybe i find some hints there!

                  I'm going to write the developers, like you suggested. Thanks a lot!

                  kshegunov 1 Reply Last reply Reply Quote 0
                  • kshegunov
                    kshegunov Moderators @beecksche last edited by kshegunov

                    @beecksche said:

                    I tried to change the angle phi to -phi, but then no visualization is rendered.

                    It wouldn't make any difference ordinarily, but are you sure the drawing can handle negative angles ...? You could do a very fast conversion of angles (after the inversion phi = -phi):

                    angle = std::fmod(angle, 360);
                    if (angle < 0)
                        angle += 360;
                    
                    // Angle is now always positive ...
                    

                    Sorry I couldn't be of more help. Good luck!

                    Read and abide by the Qt Code of Conduct

                    beecksche 1 Reply Last reply Reply Quote 0
                    • beecksche
                      beecksche @kshegunov last edited by beecksche

                      @kshegunov
                      No negative angles are not allowed.

                      If i get an answer from the developers i'm going to post it here!

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post