sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    View.guess_target algorithem?

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 286 Views 4 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.
    • A Offline
      antonksky
      last edited by

      I was wondering if anybody knows how the View.guess_target works? What is the algorithm of guessing the target?

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        I haven't studies it, but maybe a ray shot from the camera eye?

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

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

          If you take a random view=model.active_view and get its view.camera, and then get its view.camera.target it returns a Point3d.
          If you use view.guess_target it return a different Point3d [probably calculated from geometry hit in the line of sight? no one knows πŸ˜’ ].
          If you now make a new_camera based on the original various view.camera values BUT with ' view.guess_target' used as the target [2nd] value, and then change view.camera=new_camera nothing changes! BUT the view.camera.target is now equivalent to the earlier view.guess_target - so it has sort of 'optimized' the eye/target relationship - I can see no practical value πŸ˜•

          TIG

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

            An intersection with a geometry and a ray shot from the camera eye seems like a reasonable assumption. There are several possible uses for a guess target. I think some of the Camera tools in sketchup (zoom, orbit and such) are using the guessed target to know where to zoom or to figure out the vertical axis of rotation.

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              Zoom zooms to where the mouse cursor is, not where the camera is looking.

              Orbit orbits around an object, and I think it feels like is is using the center of the object. Maybe a simple bounding box center, but I'm pretty sure its more than that because the view does not skip around if the center of the object in sight is off the screen. So it must be something more. But if it were merely where the view line intersects the model, then I think that point would appear to stay fixed in place, which it does not, its more fluid than that.

              So I'm afraid the guessed target is not what's used in those tools.

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

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

                The zoom tool (magnifying glass invoked by the Z shortcut) does not zoom to where the mouse courser is, it zooms to the guessed target.

                The orbit has a vertical and a horizontal axis of rotation. The vertical axis is always in the z direction going through the origin. The horizontal axis is always in the camera x axis direction going through a point which is new every time a mouse is clicked...that point is the guess target I think...that said, the guess target might be a function of some bounding box.

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  Oh yes, that zoom tool. I forgot about that one. I never use it, I'm a scroll wheel only person. And the scroll wheel does zoom to where the mouse cursor is.

                  The actual zoom tool though yes, that also uses the mouse pointer to some degree. If you hold it over something close, you zoom quickly. hold it over something far and you zoom slower. Even if your mouse goes from being on top of something close to not on top of something int he same dragging event, the speed of zoom will vary. I'd never noticed that before.

                  The orbit tool (again, my scroll wheel) doesn't do what I was thinking it does. It does seem to just orbit around the center of the screen, and the distance of the z axis seems to be based on some sort of target. I'm wondering if it has to do with the near and far culling planes? Perhaps evenly spaced between them?

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  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