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

    Face width and height in 2d

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 960 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,

      I'm currently working on a project where each face's width and height e.g. x and y in 2d are required as if the face was being looked at staright on (like a plan view). I've used bounding box for this but am finding that it is not accurate enough when a face is at an angle in 2d.

      Any help or ideas would be greatly appreciated.

      Thanks very much

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

        Get the vertices of all 4 corners. Use Point3d#distance from any of the 4 points to the other 3. Throw away the longest distance. The two remaining are length & width (assuming you have a rectangle or square).

        Todd

        1 Reply Last reply Reply Quote 0
        • M Offline
          mocathe1st
          last edited by

          Hi,

          Thanks very much for that. The problem is with faces of varying shapes. I'm trying to find the overall width and height of every face in the model as if the faces were being looked at in a plan view but have no way of knowing how many sides or vertexes a face will have. I've started on a solution based on unfolding each face, but am not sure how well this will work.

          Thanks again,

          1 Reply Last reply Reply Quote 0
          • KrisidiousK Offline
            Krisidious
            last edited by

            perhaps you should explain what your goal is and what your model is...

            By: Kristoff Rand
            Home DesignerUnique House Plans

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              Perhaps you could make a temporary group and add the face into that. Then transform the face so it's flat normal=0,0,1. Rotate it so the longest side is say y=0. Then find the bounding box max/min etc ?

              TIG

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

                It's possible to use vectors to represent axes. The face.normal should be the Z axis, the X axis should be the intersection of a flat (XY) plane with the face plane, and the Y axis can be determined by the cross product of the X and Z axes.

                There's also a quicker way to do this after finding the Z axis (the face.normal):
                axes = face.normal.axes
                xAxis,yAxis,zAxis = axes

                However you do it, once you have the axis vectors, you can then either:

                1. test the X and Y axes against the points of the face to determine which are minimal and maximal, or
                2. use an axes transform to convert the vertex positions of the face to the world XYZ coordinates and then determine the minimal and maximal XY values.

                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