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_tstructure 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.Raystructure.The contents of the returned structure are undefined.
New in version 1.4.
- equal(b)¶
- Parameters:
b (
Graphene.Ray) – aGraphene.Ray- Returns:
trueif the given rays are equal- Return type:
Checks whether the two given
Graphene.Rayare 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.Raythat 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.Rayfrom 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.Rayself 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.Point3DorNone) – the origin of the raydirection (
Graphene.Vec3orNone) – the direction vector
- Returns:
the initialized ray
- Return type:
Initializes the given
Graphene.Rayusing 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.Rayusing the origin and direction values of anotherGraphene.Ray.New in version 1.4.
- init_from_vec3(origin, direction)¶
- Parameters:
origin (
Graphene.Vec3orNone) – aGraphene.Vec3direction (
Graphene.Vec3orNone) – aGraphene.Vec3
- Returns:
the initialized ray
- Return type:
Initializes the given
Graphene.Rayusing 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.Rayself with the givenGraphene.Boxb.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.Rayself with the givenGraphene.Spheres.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.Rayself with the givenGraphene.Trianglet.New in version 1.10.
- intersects_box(b)¶
- Parameters:
b (
Graphene.Box) – aGraphene.Box- Returns:
trueif the ray intersects the box- Return type:
Checks whether the given
Graphene.Rayself intersects the givenGraphene.Boxb.See also:
Graphene.Ray.intersect_box()New in version 1.10.
- intersects_sphere(s)¶
- Parameters:
s (
Graphene.Sphere) – aGraphene.Sphere- Returns:
trueif the ray intersects the sphere- Return type:
Checks if the given
Graphene.Rayself intersects the givenGraphene.Spheres.See also:
Graphene.Ray.intersect_sphere()New in version 1.10.
- intersects_triangle(t)¶
- Parameters:
t (
Graphene.Triangle) – aGraphene.Triangle- Returns:
trueif the ray intersects the triangle- Return type:
Checks whether the given
Graphene.Rayself intersects the givenGraphene.Triangleb.See also:
Graphene.Ray.intersect_triangle()New in version 1.10.