Camera Constructor - Target position error

I’m using the camera constructor to create a camera object with the following statements:

  initial_eye    = Geom::Point3d.new( 200.0, 200.0, 15.0 )
  initial_target = Geom::Point3d.new( 202.0, 202.0, 15.0 )
  camera = Sketchup::Camera.new( initial_eye, initial_target, Z_AXIS )

I’m not seeing the camera have the same position as the “initial_target”. It is just over 2 feet in error. Observe that I have the Z coordinate for both positions at the same value. The camera direction should be level to the X-Y plane and the Z_AXIS constant should be acceptable as an “up” axis.

When I include the output statements:

  puts "camera.eye = #{camera.eye}; camera.target  = #{camera.target}"
  dist = initial_target.vector_to(camera.target).length.to_f
  puts "camera.up= #{camera.up};   dist= #{dist}"

I observe (Windows 7, Sketchup 16; 32 bit):

camera.eye = (200", 200", 15"); camera.target  = (220.227827", 220.227827", 15")
camera.up= (0.0, 0.0, 1.0);   dist= 25.778040675386023

Switching to parallel projection doesn’t change the results. Why can’t I set a more accurate target?

intial_direction = initial_eye.vector_to(initial_target)
camera_direction = camera.eye.vector_to(camera.target)
camera_direction == camera.direction

>> false

camera_direction.normalize == camera.direction

>> true

intial_direction.parallel? camera.direction

>> true

intial_direction.normalize == camera.direction

>> true

So the direction is fine. It must have something to do with FOV or focal length, or etc.

Have you ever tried to focus on something 2 inches in front of your eye ?

The test was run with Sketchup running without loading any model. The FOV and focal length are the start up defaults of 35 degrees and around 57 inches. I tried a few different values at those settings, and it is not letting me set a target closer than 31 inches. It does work with the initial target of:

initial_target = Geom::Point3d.new( 231.0, 200.0, 15.0 )

I dropped the FOV down to 5 degrees and up to 100 degrees from the command line and reran some examples and it was still limited to 31 inches (at least with an eye at 200, 200, 15).

So is this going to cause an issue for some plugin you are writing ?

It occurs to me that perhaps this is linked to clipping. (Maybe the dev. team put a min distance in the code “under the hood”) ?

It is not for a plugin. I do animation for a hobby.

When I try:

target_x2 = Geom::Point3d.new( 2, 0, 0 )
camera_atO = Sketchup::Camera.new( ORIGIN, target_x2, Z_AXIS )
puts "camera_atO.eye = #{camera_atO.eye}; camera_atO.target  = #{camera_atO.target}"

My “puts” statement produces:

camera_atO.eye = (0", 0", 0"); camera_atO.target = (2", 0", 0")

So it did allow it. The target distance hasn’t been an actual issue because it is used to set the direction. Its not like a focus distance is needed for depth of field.