Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

camlookat

Position camera to view object or group of objects

Syntax

camlookat(object_handles)
camlookat(axes_handle)
camlookat

Description

camlookat(object_handles) views the objects identified in the vector object_handles. The vector can contain the handles of axes Children.

camlookat(axes_handle) views the objects that are children of the axes identified by axes_handle.

camlookat views the objects that are in the current axes by moving the camera position and camera target while preserving the relative view direction and camera view angle. The viewed object (or objects) roughly fill the axes position rectangle. To change the view, camlookat sets the axes CameraPosition and CameraTarget properties.

Examples

collapse all

Create three spheres. Then set the data aspect ratio, the view, and the projection type.

[x,y,z] = sphere;
s1 = surf(x,y,z);
hold on
s2 = surf(x+3,y,z+3);
s3 = surf(x,y,z+6);

daspect([1 1 1])
view(30,10)
camproj perspective

Compose the scene around sphere s1.

camlookat(s1)

Compose the scene around sphere s2.

camlookat(s2)

Compose the scene around sphere s3.

camlookat(s3)

Introduced before R2006a

Was this topic helpful?