sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Mini-Challenge #2

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    26 Posts 7 Posters 1.9k Views 7 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.
    • sdmitchS Offline
      sdmitch
      last edited by

      http://youtu.be/_0TY6HHL25Y
      A graphical solution.

      Nothing is worthless, it can always be used as a bad example.

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • jeff hammondJ Offline
        jeff hammond
        last edited by

        @sdmitch said:

        A graphical solution.

        hey sdmitch..
        that's only doing one side of it though.. the difficulty comes when trying to fit the rectangle between two corners.
        do you have a solution for that?

        dotdotdot

        1 Reply Last reply Reply Quote 0
        • sdmitchS Offline
          sdmitch
          last edited by

          @jeff hammond said:

          @sdmitch said:

          A graphical solution.

          hey sdmitch..
          that's only doing one side of it though.. the difficulty comes when trying to fit the rectangle between two corners.
          do you have a solution for that?

          You have to repeat the process on the other end also of course. Connecting those lines to create a face produces a slightly skewed rectangle. Rotating the ends to create a regular rectangle moves the ends but, in my test, by less than 0.01" from the edge. The perfect solution would require several iterations.

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

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

            Each of the two corners have two extreme limits.
            Where the 'x' width of the inscribed rectangle's end meet at 90 degrees.
            These limits have an 'overlap' at each end.
            If the corner's angle is <=90 degrees then the possible range is limited.
            if is the 'overlap' of the two possible solutions.
            If its > 90 degrees the range is 'x' set off from the corner vertex itself [of course only the full range applies if the quads angles are 90 degrees]
            You only need to test one 'corner'.
            You take a series of pairs of points which fall within the two 'overlap' zones on the two edges sharing that corner's vertex - which of course must also be exactly 'x' apart when measured at the angle.

            of an inscribed rectangle.

            To do that we need to project a line from the two end vertices, at a vector that is transformed to be perpendicular to that line [x], and check if it intersects with the lines of the other two edges [i.e. those which are not shared the 'corner']; and where it does, if that intersected point is between the two ends of the tested line, and then of the length of the two tested vectors from each of the x.vertex.position to the hit.point is the same length, then the two long sides of the rectangle would be corrected so we have a match.
            To minimize the number of tests the two corners could be compared and the overlap lengths compared - the shortest set then have the fewest tests...
            Now potentially there is a whole series of solutions for 'x' in the minimum corner's zone set that would fit an inscribed rectangle into the quad...
            Now to code it...

            TIG

            1 Reply Last reply Reply Quote 0
            • S Offline
              slbaumgartner
              last edited by

              I worked out an analytic geometry solution using the formulas for the distance between two points and for the intersection point of two given lines. Solving is "just" a matter of algebra. However, the remaining difficulty is that the math formulation covers various configurations that have no real-value solution (e.g. attached image) and it is difficult (or at least confusing) to weed these out of the formulas.

              Screen Shot 2014-12-02 at 9.43.20 AM.png

              1 Reply Last reply Reply Quote 0
              • sdmitchS Offline
                sdmitch
                last edited by

                @slbaumgartner said:

                I worked out an analytic geometry solution using the formulas for the distance between two points and for the intersection point of two given lines. Solving is "just" a matter of algebra. However, the remaining difficulty is that the math formulation covers various configurations that have no real-value solution (e.g. attached image) and it is difficult (or at least confusing) to weed these out of the formulas.

                [attachment=1:2acewcov]<!-- ia1 -->Screen Shot 2014-12-02 at 9.43.20 AM.png<!-- ia1 -->[/attachment:2acewcov]


                mini-challenge.jpg

                Nothing is worthless, it can always be used as a bad example.

                http://sdmitch.blogspot.com/

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

                Advertisement