Graphene.Ray¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
direction |
r |
||
origin |
r |
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Graphene.Ray¶
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.New in version 1.4.
- classmethod alloc()¶
- Returns:
the newly allocated
Graphene.Ray
. UseGraphene.Ray.free
() to free the resources allocated by this function- Return type:
Allocates a new
Graphene.Ray
structure.The contents of the returned structure are undefined.
New in version 1.4.
- equal(b)¶
- Parameters:
b (
Graphene.Ray
) – aGraphene.Ray
- Returns:
true
if the given rays are equal- Return type:
Checks whether the two given
Graphene.Ray
are equal.New in version 1.4.
- free()¶
Frees the resources allocated by
Graphene.Ray.alloc
().New in version 1.4.
- get_closest_point_to_point(p)¶
- Parameters:
p (
Graphene.Point3D
) – aGraphene.Point3D
- Returns:
return location for the closest point3d
- Return type:
res:
Graphene.Point3D
Computes the point on the given
Graphene.Ray
that is closest to the given point p.New in version 1.4.
- get_direction()¶
- Returns:
return location for the direction
- Return type:
direction:
Graphene.Vec3
Retrieves the direction of the given
Graphene.Ray
.New in version 1.4.
- get_distance_to_plane(p)¶
- Parameters:
p (
Graphene.Plane
) – aGraphene.Plane
- Returns:
the distance of the origin of the ray from the plane
- Return type:
Computes the distance of the origin of the given
Graphene.Ray
from the given plane.If the ray does not intersect the plane, this function returns
INFINITY
.New in version 1.4.
- get_distance_to_point(p)¶
- Parameters:
p (
Graphene.Point3D
) – aGraphene.Point3D
- Returns:
the distance of the point
- Return type:
Computes the distance of the closest approach between the given
Graphene.Ray
self and the point p.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.
New in version 1.4.
- get_origin()¶
- Returns:
return location for the origin
- Return type:
origin:
Graphene.Point3D
Retrieves the origin of the given
Graphene.Ray
.New in version 1.4.
- get_position_at(t)¶
- Parameters:
t (
float
) – the distance along the ray- Returns:
return location for the position
- Return type:
position:
Graphene.Point3D
Retrieves the coordinates of a point at the distance t along the given
Graphene.Ray
.New in version 1.4.
- init(origin, direction)¶
- Parameters:
origin (
Graphene.Point3D
orNone
) – the origin of the raydirection (
Graphene.Vec3
orNone
) – the direction vector
- Returns:
the initialized ray
- Return type:
Initializes the given
Graphene.Ray
using the given origin and direction values.New in version 1.4.
- init_from_ray(src)¶
- Parameters:
src (
Graphene.Ray
) – aGraphene.Ray
- Returns:
the initialized ray
- Return type:
Initializes the given
Graphene.Ray
using the origin and direction values of anotherGraphene.Ray
.New in version 1.4.
- init_from_vec3(origin, direction)¶
- Parameters:
origin (
Graphene.Vec3
orNone
) – aGraphene.Vec3
direction (
Graphene.Vec3
orNone
) – aGraphene.Vec3
- Returns:
the initialized ray
- Return type:
Initializes the given
Graphene.Ray
using the given vectors.New in version 1.4.
- intersect_box(b)¶
- Parameters:
b (
Graphene.Box
) – aGraphene.Box
- Returns:
the type of intersection
- t_out:
the distance of the point on the ray that intersects the box
- Return type:
(
Graphene.RayIntersectionKind
, t_out:float
)
Intersects the given
Graphene.Ray
self with the givenGraphene.Box
b.New in version 1.10.
- intersect_sphere(s)¶
- Parameters:
s (
Graphene.Sphere
) – aGraphene.Sphere
- Returns:
the type of intersection
- t_out:
the distance of the point on the ray that intersects the sphere
- Return type:
(
Graphene.RayIntersectionKind
, t_out:float
)
Intersects the given
Graphene.Ray
self with the givenGraphene.Sphere
s.New in version 1.10.
- intersect_triangle(t)¶
- Parameters:
t (
Graphene.Triangle
) – aGraphene.Triangle
- Returns:
the type of intersection
- t_out:
the distance of the point on the ray that intersects the triangle
- Return type:
(
Graphene.RayIntersectionKind
, t_out:float
)
Intersects the given
Graphene.Ray
self with the givenGraphene.Triangle
t.New in version 1.10.
- intersects_box(b)¶
- Parameters:
b (
Graphene.Box
) – aGraphene.Box
- Returns:
true
if the ray intersects the box- Return type:
Checks whether the given
Graphene.Ray
self intersects the givenGraphene.Box
b.See also:
Graphene.Ray.intersect_box
()New in version 1.10.
- intersects_sphere(s)¶
- Parameters:
s (
Graphene.Sphere
) – aGraphene.Sphere
- Returns:
true
if the ray intersects the sphere- Return type:
Checks if the given
Graphene.Ray
self intersects the givenGraphene.Sphere
s.See also:
Graphene.Ray.intersect_sphere
()New in version 1.10.
- intersects_triangle(t)¶
- Parameters:
t (
Graphene.Triangle
) – aGraphene.Triangle
- Returns:
true
if the ray intersects the triangle- Return type:
Checks whether the given
Graphene.Ray
self intersects the givenGraphene.Triangle
b.See also:
Graphene.Ray.intersect_triangle
()New in version 1.10.