Camera space question
-
Adam,
Is your method different than using the Transformarion.axis, which is a
@unknownuser said:
method is used to create a Transformation that goes from world coordinates to an arbitrary coordinate system
Is the result the same? I could use a course on 3d mathematics, particularly as it applies in SketchUp.
-
No different. Just wasn't sure whether you can get the camera matrix as a whole, so thought it just as easy to do 3 dot products. (And we do just want a 3x3 tranform here).
-
-
First, sorry for not getting back earlier. Its been kind of hectic here.
Thanks for answering but I still have problems.
Adam, your way gives relly weird results. Either there is something wrong with your method or (more possibly) there is something wrong with me.
When using your method and just translating the xDist it gets a transform also in th z axis and if I use the value 100 as xDist it gets moved a distance of 2540 mm?Part of the code:
camSpaceTranslation = Geom;;Vector3d.new(xDist, yDist, zDist) worldSpaceTranslation = Geom;;Vector3d.new(camera.xaxis.dot(camSpaceTranslation), camera.yaxis.dot(camSpaceTranslation), camera.zaxis.dot(camSpaceTranslation)) newEye = eye + worldSpaceTranslation newTarget = target + worldSpaceTranslation eye = newEye target = newTarget camera = camera.set(eye, target, up)
Once more to clearify what I'm after:
Moving along world axes is working but I want to numerically move the camera eye point and target point (the target shall just move the same amount as the eye) in the cameras sightline*(in/out),*left/right and up/down.
Any thoughts? -
And how many millimeters in an inch (the native units of Sketchup) are there?
@pixero said:
First, sorry for not getting back earlier. Its been kind of hectic here.
When using your method and just translating the xDist it gets a transform also in th z axis and if I use the value 100 as xDist it gets moved a distance of 2540 mm?
-
25.4mm to an inch.
-
@adamb said:
And how many millimeters in an inch (the native units of Sketchup) are there?
The "native" unit of mySketchUp is centimetre. -
?
model = Sketchup.active_model c = model.active_view.camera eye = c.eye up = c.up target = c.target xaxis = c.xaxis yaxis = c.yaxis zaxis = c.zaxis model.entities.add_cpoint eye model.entities.add_cpoint target model.entities.add_text("eye", eye) model.entities.add_text("target", target) distance = 12 newEye = eye.offset(xaxis, distance) model.entities.add_cpoint newEye model.entities.add_text("newEye", newEye) newTarget = target.offset(xaxis, distance) model.entities.add_cpoint newTarget model.entities.add_text("newTarget", newTarget) c.set(newEye, newTarget, up)
-
Might I suggest AddPages as a reference script? It adds pages (scenes) orthographically (based on user-supplied x, y, and z offsets). If I understand the gist of the discussion, then AddPages has at its heart the transformation code in question.
-
Thanks all for helping!
Now I got it working the way I want.
I'll be back when the script is done. -
See this thread: http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=1528&p=41330#p41330
And once more, thanks for helping!
Advertisement