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
Rayare equal.Added in version 1.4.
- Parameters:
b – a
Ray
- get_closest_point_to_point(p: Point3D) Point3D#
Computes the point on the given
Raythat 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
Rayfrom 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
Rayrand 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
talong 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
Rayusing the givenoriginanddirectionvalues.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
Rayusing 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
Rayusing the given vectors.Added in version 1.4.
- intersect_box(b: Box) tuple[RayIntersectionKind, float]#
Intersects the given
Rayrwith the givenBoxb.Added in version 1.10.
- Parameters:
b – a
Box
- intersect_sphere(s: Sphere) tuple[RayIntersectionKind, float]#
Intersects the given
Rayrwith the givenSpheres.Added in version 1.10.
- Parameters:
s – a
Sphere
- intersect_triangle(t: Triangle) tuple[RayIntersectionKind, float]#
Intersects the given
Rayrwith the givenTrianglet.Added in version 1.10.
- Parameters:
t – a
Triangle
- intersects_box(b: Box) bool#
Checks whether the given
Rayrintersects the givenBoxb.See also:
intersect_box()Added in version 1.10.
- Parameters:
b – a
Box