Ray#
Added in version 1.4.
- class Ray(*args, **kwargs)#
A ray emitted from an origin in a given direction.
The contents of the graphene_ray_t
structure are private, and should not
be modified directly.
Constructors#
Methods#
- class Ray
- equal(b: Ray) bool #
Checks whether the two given
Ray
are equal.Added in version 1.4.
- Parameters:
b – a
Ray
- get_closest_point_to_point(p: Point3D) Point3D #
Computes the point on the given
Ray
that is closest to the given pointp
.Added in version 1.4.
- Parameters:
p – a
Point3D
- get_distance_to_plane(p: Plane) float #
Computes the distance of the origin of the given
Ray
from the given plane.If the ray does not intersect the plane, this function returns
INFINITY
.Added in version 1.4.
- Parameters:
p – a
Plane
- get_distance_to_point(p: Point3D) float #
Computes the distance of the closest approach between the given
Ray
r
and the pointp
.The closest approach to a ray from a point is the distance between the point and the projection of the point on the ray itself.
Added in version 1.4.
- Parameters:
p – a
Point3D
- get_position_at(t: float) Point3D #
Retrieves the coordinates of a point at the distance
t
along the givenRay
.Added in version 1.4.
- Parameters:
t – the distance along the ray
- init(origin: Point3D | None = None, direction: Vec3 | None = None) Ray #
Initializes the given
Ray
using the givenorigin
anddirection
values.Added in version 1.4.
- Parameters:
origin – the origin of the ray
direction – the direction vector
- init_from_ray(src: Ray) Ray #
Initializes the given
Ray
using the origin and direction values of anotherRay
.Added in version 1.4.
- Parameters:
src – a
Ray
- init_from_vec3(origin: Vec3 | None = None, direction: Vec3 | None = None) Ray #
Initializes the given
Ray
using the given vectors.Added in version 1.4.
- intersect_box(b: Box) Tuple[RayIntersectionKind, float] #
Intersects the given
Ray
r
with the givenBox
b
.Added in version 1.10.
- Parameters:
b – a
Box
- intersect_sphere(s: Sphere) Tuple[RayIntersectionKind, float] #
Intersects the given
Ray
r
with the givenSphere
s
.Added in version 1.10.
- Parameters:
s – a
Sphere
- intersect_triangle(t: Triangle) Tuple[RayIntersectionKind, float] #
Intersects the given
Ray
r
with the givenTriangle
t
.Added in version 1.10.
- Parameters:
t – a
Triangle
- intersects_box(b: Box) bool #
Checks whether the given
Ray
r
intersects the givenBox
b
.See also:
intersect_box()
Added in version 1.10.
- Parameters:
b – a
Box