differt.rt.image_of_vertices_with_respect_to_mirrors#
- image_of_vertices_with_respect_to_mirrors(vertices, mirror_vertices, mirror_normals)[source]#
Return the image of vertices with respect to mirrors.
- Parameters:
vertices (
Float[ArrayLike, '*#batch 3']) – An array of vertices that will be mirrored.mirror_vertices (
Float[ArrayLike, '*#batch 3']) – An array of mirror vertices. For each mirror, any vertex on the infinite plane that describes the mirror is considered to be a valid vertex.mirror_normals (
Float[ArrayLike, '*#batch 3']) – An array of mirror normals, where each normal has a unit length and is perpendicular to the corresponding mirror.
- Return type:
- Returns:
An array of image vertices.
Examples
In the following example, we show how to compute the images of a batch of random vertices. Here, normal vectors do not have a unit length, but they should have if you want an interpretable result.
>>> from differt.rt import ( ... image_of_vertices_with_respect_to_mirrors, ... ) >>> >>> key = jax.random.key(0) >>> ( ... key0, ... key1, ... key2, ... ) = jax.random.split(key, 3) >>> *batch, num_mirrors = (10, 20, 30) >>> vertices = jax.random.uniform( ... key0, ... (*batch, 1, 3), # 1 so that it can broadcast with mirrors' shape ... ) >>> mirror_vertices = jax.random.uniform( ... key1, ... (num_mirrors, 3), ... ) >>> mirror_normals = jax.random.uniform( ... key2, ... (num_mirrors, 3), ... ) >>> images = image_of_vertices_with_respect_to_mirrors( ... vertices, ... mirror_vertices, ... mirror_normals, ... ) >>> images.shape (10, 20, 30, 3)