Reference ‐ Ray3D - 62firelight/manimRT-490 GitHub Wiki
A 3D arrow representing a ray.
Args:
-
start
: The originating position of the ray. -
direction
: The direction of the ray. -
length
: The length of the ray. -
thickness
: The thickness of the ray. -
color
: The color of the ray.
__init__(
start: 'ndarray' = array([-1., 0., 0.]),
direction: 'ndarray' = array([1., 0., 0.]),
length: 'float' = 1,
thickness: 'float' = 0.02,
color: 'ParsableManimColor' = ManimColor('#FFFFFF'),
**kwargs
) → None
get_equation(homogeneous_coordinates=False, decimal_places=1) → str
Write a LaTeX equation for this ray.
Args:
-
homogeneous_coordinates
: Determine if homogeneous coordinates should be used when displaying the equation. -
decimal_places
: How many decimal places to round to when displaying the equation.
Returns: A string formatted as LaTeX representing the ray's equation.
get_light_vector(
hit_point_index: 'int',
light_source: 'RTPointLightSource'
) → list
Calculates the "light vector," a unit vector that starts from a given hit point and points towards a light source within the scene.
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray. -
light_source
: The light source mobject that the unit vector will point towards.
Returns: An array representing the light vector.
get_reflected_light_vector(
hit_point_index: 'int',
light_source: 'RTPointLightSource'
) → list
Calculates the "reflected light vector," which is a light vector that reflects through the normal at a given hit point.
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray. -
light_source
: The light source mobject that the light vector will point towards.
Returns: An array representing the reflected light vector.
get_reflected_ray(
hit_point_index: 'int',
camera: 'Mobject',
length: 'float' = 1,
thickness: 'float' = 0.02,
color: 'ParsableManimColor' = ManimColor('#FFFFFF')
) → Ray3D
Calculates a mobject version of the "reflected ray," which is the viewer vector reflected through the normal.
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray. -
camera
: The camera mobject that the viewer vector starts from. -
length
: The length of the reflected ray. -
thickness
: The thickness of the reflected ray. -
color
: The color of the reflected ray.
Returns: A Ray3D Mobject representing the reflected vector.
get_reflected_vector(hit_point_index: 'int', camera: 'Mobject') → list
Calculates the "reflected vector," which is the viewer vector reflected through the normal.
Not to be confused with the reflected light vector, which is the light vector reflected through the normal.
The reflected vector is used for simulating reflected surfaces in a ray tracer, while the reflected light vector may be used for the Phong illumination model.
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray. -
camera
: The camera mobject that the viewer vector starts from.
Returns: An array representing the reflected vector.
get_refracted_ray(
object: 'Mobject',
length: 'float' = 1,
refractive_index: 'float' = 1,
thickness: 'float' = 0.02,
color: 'ParsableManimColor' = ManimColor('#FFFFFF')
) → Ray3D
Calculates a "refracted ray," a ray that bends when it passes over to another medium (e.g. air to water).
Args:
-
object
: The boundary between medium 1 and medium 2. -
length
: The length of the refracted ray. -
refractive_index
: The refractive index of medium 1. -
thickness
: The thickness of the refracted ray. -
color
: The color of the refracted ray.
Returns: A Ray3D Mobject representing the refracted ray.
get_shadow_ray(
hit_point_index: 'int',
light_source: 'RTPointLightSource',
thickness: 'float' = 0.02,
color: 'ParsableManimColor' = ManimColor('#FFFFFF')
) → Ray3D
Create a "shadow ray," a ray that starts from a given hit point and points towards a light source.
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray. -
light_source
: The light source Mobject that the shadow ray will point towards. -
thickness
: The thickness of the shadow ray. -
color
: The color of the shadow ray.
Returns: A Ray3D Mobject representing a shadow ray.
get_unit_normal(hit_point_index: 'int') → Ray3D
Gets the unit normal at a specific hit point along the ray.
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray.
Returns: A Ray3D Mobject representing the unit normal at the given hit point along the ray.
get_viewer_vector(hit_point_index: 'int', camera: 'Mobject') → list
Calculates the "viewer vector," a unit vector that starts from a given hit point and points towards the observer of a scene (i.e. a virtual camera)
Args:
-
hit_point_index
: The index number of the hit point. For example, 0 would be the first hit point along the ray. -
camera
: The virtual camera that the viewer vector will point towards.
Returns: An array representing the viewer vector.
This file was automatically generated via lazydocs.