klampt.vis.glviewport module
- class klampt.vis.glviewport.GLViewport[source]
Bases:
Viewport
A class describing an OpenGL camera view. Extends the capabilities of klampt.Viewport with a camera controller and some Mac OpenGL information.
- x,y,w,h,n,f,fx,fy,cx,cy,ori,xform
the image box, projection, clipping planes, intrinsics, and orientation.
- Type:
from Viewport
- screenDeviceScale
if not 1, multiply screen pixel coordinates by this to get OpenGL pixel coordinates (usually Mac Retina displays)
- Type:
float
- controller
an orbit camera controlling the target, zoom, and orientation of the “trackball” (see
orbit
)
- set_transform(T, convention='standard')[source]
Sets the pose of the camera, with T given in world coordinates.
If convention = ‘openGL’, the Z axis of T is the backward direction of the camera, with Y pointing up and X pointing to the right.
If convention = ‘standard’, the Z axis of T is the forward direction of the camera, with Y pointing down and X pointing to the right
- Return type:
None
- get_transform(convention='standard')[source]
Gets the pose of the camera, with T given in world coordinates.
If convention = ‘openGL’, the Z axis of T is the backward direction of the camera, with Y pointing up and X pointing to the right.
If convention = ‘standard’, the Z axis of T is the forward direction of the camera, with Y pointing down and X pointing to the right
- Return type:
Tuple
[Sequence
[float
],Sequence
[float
]]
- fit(center, radius)[source]
Fits the viewport to an object filling a sphere of a certain center and radius
- Return type:
None
- click_ray(x, y)[source]
Returns a pair of 3-tuples indicating the ray source and direction in world coordinates for a screen-coordinate point (x,y) with y indicating top-down pixel coordinates.
- Return type:
Tuple
[Sequence
[float
],Sequence
[float
]]
- project(pt, clip=True)[source]
Given a point in world space, returns the (x,y,z) coordinates of the projected pixel. z is given in absolute coordinates, while x,y are given in pixel values.
If clip=True and the point is out of the viewing volume, then None is returned. Otherwise, if the point is exactly at the focal plane then the middle of the viewport is returned.
- Return type:
Sequence
[float
]
- save_file(fn)[source]
Saves to a viewport txt file. The file format is compatible with the RobotTest, RobotPose, and SimTest apps.
- Return type:
None