gradoptics.transforms.look_at_transform

class gradoptics.transforms.look_at_transform.LookAtTransform(viewing_direction, pos, up=tensor([0., 0., 1.]))

Bases: gradoptics.transforms.base_transform.BaseTransform

Transform that orients an object so that it is oriented towards a given direction.

References: Physically based rendering, section 2.7.7 The look-at transform.

__init__(viewing_direction, pos, up=tensor([0., 0., 1.]))

Given a viewing direction in world-space, computes the 4x4 transform matrix to move a point from object-space to world-space and from world-space to object-space

Parameters
  • viewing_direction – viewing direction of the object (torch.tensor)

  • pos – position of the object (torch.tensor)

  • up – a vector that orients the object with respect to the viewing direction (torch.tensor). For example, if up=torch.tensor([0, 0, 1]) the top of the object will point upwards. If up=torch.tensor([0, 0, -1]), the top of the object will point downwards.