sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Finding a face's azimuth

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 1.9k Views 5 Watching
    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.
    • M Offline
      mocathe1st
      last edited by

      Hi all,

      Just wondering if anyone has any ideas on how to figure out a face's azimuth within sketchup. I've spent a while looking at this but haven't come up with anything too useful as yet. Any ideas would be greatly appreciated.

      My current value for azimuth is being calculated as such:
      def azimuth
      a = self.normal
      a.z = 0
      a.angle_between(Geom::Vector3d.new 1,0,0).radians
      end

      but is not correct

      Best Regards

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by

        No help here, but I would like to ask a faavor. Can you draw, in SU, an example that illustrates what an azimuth is? And, how an example one would be calculated? I went to wikipedia and I still don't get it.

        Thanks, Todd

        1 Reply Last reply Reply Quote 0
        • A Offline
          azuby
          last edited by

          @Todd
          Look here.

          azuby

          *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

          Bad English? PM me, correct me. :smile:**

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by

            Well, that's easy enough to understand with a picture! Thanks azuby.

            So, all that's needed to determine the azimuth is

            1. you have to know the north angle
            2. you need the face normal.

            Right?

            I'm also guessing an azimuth value is worthless without some type of lat-long to go along with it. Is this correct?

            Todd

            1 Reply Last reply Reply Quote 0
            • daikuD Offline
              daiku
              last edited by

              M:

              Do you need the angle in plan (projected down to the ground plane)? Also, be aware that the angle_between method will not return a negative value. It's always the absolute value of the difference, and it is that angle in 3D (not in plan). CB.

              Clark Bremer
              http://www.northernlightstimberframing.com

              1 Reply Last reply Reply Quote 0
              • R Offline
                RickW
                last edited by

                The problem is compounded by angles generally being measured counter-clockwise, while azimuth angles are measured clockwise.

                I think it would come down to determining the quadrant of the vector (by checking X and Y for +/- value), then adding the previous right-angle azimuth vector to the angle_between of it and the specified vector

                if vector.x>0
                  if vector.y>0
                    az = [0,1,0].angle_between(vector).radians
                  else
                    az = [1,0,0].angle_between(vector).radians+Math;;PI/2
                  end
                else
                  if vector.y<0
                    az = [0,-1,0].angle_between(vector).radians+Math;;PI
                  else
                    az = [-1,0,0].angle_between(vector).radians+(3*Math;;PI/2)
                end
                

                The above example doesn't take into account cases where x or y equal zero, so you'll have to add that. It shouldn't be too difficult, though.

                RickW
                [www.smustard.com](http://www.smustard.com)

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement