• Login
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
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 16 Sept 2011, 03:03

    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
    • T Offline
      thomthom
      last edited by 16 Sept 2011, 08:46

      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
      • T Offline
        TIG Moderator
        last edited by 16 Sept 2011, 08:59

        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 16 Sept 2011, 14:41

          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
          • C Offline
            Chris Fullmer
            last edited by 16 Sept 2011, 15:01

            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 16 Sept 2011, 19:03

              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
              • C Offline
                Chris Fullmer
                last edited by 17 Sept 2011, 00:12

                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
                1 / 1
                • First post
                  1/7
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement