differt.rt.fermat_path_on_planar_mirrors#
- fermat_path_on_planar_mirrors(from_vertices, to_vertices, mirror_vertices, mirror_normals, **kwargs)[source]#
Return the ray paths between pairs of vertices, that reflect on a given list of mirrors in between.
- Parameters:
from_vertices (
Float[ArrayLike, '*#batch 3']) – An array offromvertices, i.e., vertices from which the ray paths start. In a radio communications context, this is usually an array of transmitters.to_vertices (
Float[ArrayLike, '*#batch 3']) – An array oftovertices, i.e., vertices to which the ray paths end. In a radio communications context, this is usually an array of receivers.mirror_vertices (
Float[ArrayLike, '*#batch num_mirrors 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 num_mirrors 3']) –An array of mirror normals, where each normal has a unit length and is perpendicular to the corresponding mirror.
Note
Unlike with the Image method, the normals do not actually have to be unit vectors. However, we keep the same documentation so it is easier for the user to move from one method to the other.
kwargs (
Any) – Keyword arguments passed tofermat_path_on_linear_objects.
- Return type:
- Returns:
An array of ray paths obtained using Fermat’s principle.
Note
The paths do not contain the starting and ending vertices.
You can easily create the complete ray paths using
assemble_paths:paths = fermat_path_on_planar_mirrors(...) full_paths = assemble_paths( from_vertices, paths, to_vertices, )
Examples
The following example is the same as for the
image_method, but using the Fermat principle.>>> from differt.geometry import TriangleMesh, normalize, assemble_paths >>> from differt.plotting import draw_markers, draw_paths, reuse >>> from differt.rt import fermat_path_on_planar_mirrors >>> >>> from_vertex = jnp.array([+2.0, -1.0, +0.0]) >>> to_vertex = jnp.array([+2.0, +4.0, +0.0]) >>> mirror_vertices = jnp.array([ ... [3.0, 3.0, 0.0], ... [4.0, 3.4, 0.0], ... ]) >>> mirror_normals = jnp.array([ ... [+1.0, -1.0, +0.0], ... [-1.0, +0.0, +0.0], ... ]) >>> mirror_normals, _ = normalize(mirror_normals) >>> path = fermat_path_on_planar_mirrors( ... from_vertex, ... to_vertex, ... mirror_vertices, ... mirror_normals, ... ) >>> with reuse(backend="plotly") as fig: ... TriangleMesh.plane( ... mirror_vertices[0], normal=mirror_normals[0], rotate=-0.954 ... ).plot(color="red") ... TriangleMesh.plane( ... mirror_vertices[1], normal=mirror_normals[1] ... ).plot(color="red") ... ... full_path = assemble_paths( ... from_vertex, ... path, ... to_vertex, ... ) ... draw_paths(full_path, marker={"color": "green"}, name="Final path") ... markers = jnp.vstack((from_vertex, to_vertex)) ... draw_markers( ... markers, ... labels=["BS", "UE"], ... marker={"color": "black"}, ... name="BS/UE", ... ) ... fig.update_layout(scene_aspectmode="data") >>> fig