Camera#
- class ansys.stk.core.graphics.Camera#
Implemented by the scene camera. Contains operations to manipulate the camera position, view direction and orientation in the scene.
Overview#
Get the visibility of a sphere against the view frustum and any occluding central bodies. |
|
Convert a cartographic position to a pixel coordinate relative to the globe control. This method can throw an exception. Returns an array containing the pixel coordinate (in the order x, y) of the cartographic position relative to the globe control… |
|
Convert a cartographic position to a pixel coordinate relative to the globe control. This method does not throw an exception. |
|
Convert a pixel coordinate relative to the globe control to a cartographic position. For speed, terrain is not considered; if the pixel coordinate does not intersect the ellipsoid, an exception is thrown. Returns the cartographic position… |
|
Convert a pixel coordinate relative to the globe control to a cartographic position. For speed, terrain is not considered. This method does not throw an exception. |
|
Zoom to a central body and use the specified axes for rotation. The reference point is set to the center of the central body and the camera’s position is set so the entire central body is visible. |
|
Zooms to a cartographic extent on the centralBody. The camera will be looking straight down at the extent, with the up vector pointing toward local north. The axes is set to an east-north-up axes at the center of extent. |
|
Zooms to a rectangular extent composed of west, south, east, north on the centralBody. The camera will be looking straight down at the extent, with the up vector pointing toward local north… |
|
View from a point to a point. Sets the camera’s position and the reference point the camera is looking at. |
|
View from a point to a point. Sets the camera’s position and the reference point the camera is looking at. |
|
View from a point to a direction. Sets the camera’s position and the direction vector indicating where the camera is looking. |
|
View from a point to a direction. Sets the camera’s position and the direction vector indicating where the camera is looking. |
|
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the offset. |
|
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the offset. |
|
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the direction vector. |
|
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the direction vector. |
Get or set the position of the camera. The array contains the components of the position arranged in the order x, y, z. |
|
Get or set the reference point of the camera. The array contains the components of the reference point arranged in the order x, y, z. |
|
Get or set the direction of the camera in axes. The array contains the components of the direction arranged in the order x, y, z. |
|
Get or set the up direction of the camera in axes. The array contains the components of the direction arranged in the order x, y, z. |
|
Get or set the distance the camera position is from the reference point. |
|
Get or set camera’s axes of rotation. |
|
Get or set the axis to constrain the up vector to. |
|
Get or set whether the camera can rotate over the constrained up axis. For example, if true the camera would be able to flip over the North Pole and view the globe upside down. |
|
Get or set whether the camera’s direction is locked. |
|
Get or set field of view. The field of view is applied to the larger of the window dimensions. For example, if the window width was 640 and the height was 480, the field of view applies to the horizontal… |
|
Get the horizontal field of view. |
|
Get the vertical field of view. |
|
Get or set the distance from the camera to the near plane. |
|
Get or set the distance from the camera to the far plane. |
|
Get or set the value that is used to compute subdivisions of the viewing frustum. A large value will be faster but lose z-value precision. A small value will have better precision but perform slower… |
|
Return the distance that the Camera’s Position should be from the ReferencePoint in order to ensure that a sphere with a 1 meter radius centered at the ReferencePoint fits entirely in the view frustum. |
|
Get the camera snapshot settings. |
|
Get the camera video recorder. |
|
Get the approximate number of meters covered by a pixel that is 1 meter away from the camera. This is commonly multiplied by the distance from the camera to an object to compute the approximate number of meters covered by a pixel of the object. |
|
Get the reference frame that the position is returned in. This reference frame is composed of the camera’s from point and the axes. |
|
Get the reference frame that the reference point is returned in. This reference frame is composed of the camera’s to point and the axes. |
Examples#
Change the camera reference frame
# Scenario scenario: Scenario object
# STKObjectRoot root: STK Object Model Root
manager = scenario.scene_manager
manager.scenes.item(0).camera.view_central_body(
"Earth", root.central_bodies.earth.analysis_workbench_components.axes.item("Fixed")
)
manager.render()
Change the camera view to Imagery Extents
# Scenario scenario: Scenario object
# AGIProcessedImageGlobeOverlay imageryTile: Image Overlay object
manager = scenario.scene_manager
extent = imageryTile.extent
# Change extent in the default 3D window
manager.scenes.item(0).camera.view_extent("Earth", extent)
manager.render()
Import detail#
from ansys.stk.core.graphics import Camera
Property detail#
- property Camera.position: list#
Get or set the position of the camera. The array contains the components of the position arranged in the order x, y, z.
- property Camera.reference_point: list#
Get or set the reference point of the camera. The array contains the components of the reference point arranged in the order x, y, z.
- property Camera.direction: list#
Get or set the direction of the camera in axes. The array contains the components of the direction arranged in the order x, y, z.
- property Camera.up_vector: list#
Get or set the up direction of the camera in axes. The array contains the components of the direction arranged in the order x, y, z.
- property Camera.distance: float#
Get or set the distance the camera position is from the reference point.
- property Camera.axes: IVectorGeometryToolAxes#
Get or set camera’s axes of rotation.
- property Camera.constrained_up_axis: ConstrainedUpAxis#
Get or set the axis to constrain the up vector to.
- property Camera.allow_rotation_over_constrained_up_axis: bool#
Get or set whether the camera can rotate over the constrained up axis. For example, if true the camera would be able to flip over the North Pole and view the globe upside down.
- property Camera.field_of_view: float#
Get or set field of view. The field of view is applied to the larger of the window dimensions. For example, if the window width was 640 and the height was 480, the field of view applies to the horizontal…
- property Camera.far_near_plane_ratio: float#
Get or set the value that is used to compute subdivisions of the viewing frustum. A large value will be faster but lose z-value precision. A small value will have better precision but perform slower…
- property Camera.distance_per_radius: float#
Return the distance that the Camera’s Position should be from the ReferencePoint in order to ensure that a sphere with a 1 meter radius centered at the ReferencePoint fits entirely in the view frustum.
- property Camera.snapshot: CameraSnapshot#
Get the camera snapshot settings.
- property Camera.video_recording: CameraVideoRecording#
Get the camera video recorder.
- property Camera.pixel_size_per_distance: float#
Get the approximate number of meters covered by a pixel that is 1 meter away from the camera. This is commonly multiplied by the distance from the camera to an object to compute the approximate number of meters covered by a pixel of the object.
- property Camera.position_reference_frame: IVectorGeometryToolSystem#
Get the reference frame that the position is returned in. This reference frame is composed of the camera’s from point and the axes.
- property Camera.reference_point_reference_frame: IVectorGeometryToolSystem#
Get the reference frame that the reference point is returned in. This reference frame is composed of the camera’s to point and the axes.
Method detail#
- Camera.visibility_test(self, reference_frame: IVectorGeometryToolSystem, sphere: BoundingSphere) Visibility #
Get the visibility of a sphere against the view frustum and any occluding central bodies.
- Parameters:
reference_frame :
IVectorGeometryToolSystem
sphere :
BoundingSphere
- Returns:
Visibility
- Camera.cartographic_to_window(self, central_body: str, position: list) list #
Convert a cartographic position to a pixel coordinate relative to the globe control. This method can throw an exception. Returns an array containing the pixel coordinate (in the order x, y) of the cartographic position relative to the globe control…
- Camera.try_cartographic_to_window(self, central_body: str, position: list) list #
Convert a cartographic position to a pixel coordinate relative to the globe control. This method does not throw an exception.
- Camera.window_to_cartographic(self, central_body: str, position: list) list #
Convert a pixel coordinate relative to the globe control to a cartographic position. For speed, terrain is not considered; if the pixel coordinate does not intersect the ellipsoid, an exception is thrown. Returns the cartographic position…
- Camera.try_window_to_cartographic(self, central_body: str, position: list) list #
Convert a pixel coordinate relative to the globe control to a cartographic position. For speed, terrain is not considered. This method does not throw an exception.
- Camera.view_central_body(self, central_body: str, axes: IVectorGeometryToolAxes) None #
Zoom to a central body and use the specified axes for rotation. The reference point is set to the center of the central body and the camera’s position is set so the entire central body is visible.
- Camera.view_extent(self, central_body: str, extent: list) None #
Zooms to a cartographic extent on the centralBody. The camera will be looking straight down at the extent, with the up vector pointing toward local north. The axes is set to an east-north-up axes at the center of extent.
- Camera.view_rectangular_extent(self, central_body: str, west: float, south: float, east: float, north: float) None #
Zooms to a rectangular extent composed of west, south, east, north on the centralBody. The camera will be looking straight down at the extent, with the up vector pointing toward local north…
- Camera.view_with_up_axis(self, axes: IVectorGeometryToolAxes, camera_position: IVectorGeometryToolPoint, reference_point: IVectorGeometryToolPoint, up_axis: list) None #
View from a point to a point. Sets the camera’s position and the reference point the camera is looking at.
- Camera.view(self, axes: IVectorGeometryToolAxes, camera_position: IVectorGeometryToolPoint, reference_point: IVectorGeometryToolPoint) None #
View from a point to a point. Sets the camera’s position and the reference point the camera is looking at.
- Parameters:
axes :
IVectorGeometryToolAxes
camera_position :
IVectorGeometryToolPoint
reference_point :
IVectorGeometryToolPoint
- Returns:
- Camera.view_direction_with_up_axis(self, axes: IVectorGeometryToolAxes, camera_position: IVectorGeometryToolPoint, direction: IVectorGeometryToolVector, up_axis: list) None #
View from a point to a direction. Sets the camera’s position and the direction vector indicating where the camera is looking.
- Camera.view_direction(self, axes: IVectorGeometryToolAxes, camera_position: IVectorGeometryToolPoint, direction: IVectorGeometryToolVector) None #
View from a point to a direction. Sets the camera’s position and the direction vector indicating where the camera is looking.
- Parameters:
axes :
IVectorGeometryToolAxes
camera_position :
IVectorGeometryToolPoint
direction :
IVectorGeometryToolVector
- Returns:
- Camera.view_offset_with_up_axis(self, axes: IVectorGeometryToolAxes, reference_point: IVectorGeometryToolPoint, offset: list, up_axis: list) None #
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the offset.
- Camera.view_offset(self, axes: IVectorGeometryToolAxes, reference_point: IVectorGeometryToolPoint, offset: list) None #
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the offset.
- Camera.view_offset_direction_with_up_axis(self, axes: IVectorGeometryToolAxes, reference_point: IVectorGeometryToolPoint, direction: IVectorGeometryToolVector, up_axis: list) None #
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the direction vector.
- Camera.view_offset_direction(self, axes: IVectorGeometryToolAxes, reference_point: IVectorGeometryToolPoint, direction: IVectorGeometryToolVector) None #
Set the camera’s reference point - the point the camera is looking at. The camera’s position is the reference point translated by the direction vector.
- Parameters:
axes :
IVectorGeometryToolAxes
reference_point :
IVectorGeometryToolPoint
direction :
IVectorGeometryToolVector
- Returns: