N-Ray

#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------

Gnome::Graphene::N-Ray

Description

A ray emitted from an origin in a given direction.

The contents of the Gnome::Graphene::N-Ray structure are private, and should not be modified directly.

#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

#-------------------------------------------------------------------------------

alloc

Allocates a new Gnome::Graphene::N-Ray structure.

The contents of the returned structure are undefined.

method alloc ( --> Gnome::Graphene::Ray \)

#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

Methods

#-------------------------------------------------------------------------------

equal

Checks whether the two given Gnome::Graphene::N-Ray are equal.

method equal ( N-Object $b --> gboolean )
  • $b; a Gnome::Graphene::N-Ray

Return value; true if the given rays are equal.

#-------------------------------------------------------------------------------

free

Frees the resources allocated by .alloc().

method free ( )

#-------------------------------------------------------------------------------

get-closest-point-to-point

Computes the point on the given Gnome::Graphene::N-Ray that is closest to the given point $p.

method get-closest-point-to-point ( N-Object $p, N-Object $res )
  • $p; a graphene_point3d_t

  • $res; return location for the closest point3d

#-------------------------------------------------------------------------------

get-direction

Retrieves the direction of the given Gnome::Graphene::N-Ray.

method get-direction ( N-Object $direction )
  • $direction; return location for the direction

#-------------------------------------------------------------------------------

get-distance-to-plane

Computes the distance of the origin of the given Gnome::Graphene::N-Ray from the given plane.

If the ray does not intersect the plane, this function returns INFINITY.

method get-distance-to-plane ( N-Object $p --> Num )
  • $p; a Gnome::Graphene::N-Plane

Return value; the distance of the origin of the ray from the plane.

#-------------------------------------------------------------------------------

get-distance-to-point

Computes the distance of the closest approach between the given Gnome::Graphene::N-Ray $r 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.

method get-distance-to-point ( N-Object $p --> Num )
  • $p; a graphene_point3d_t

Return value; the distance of the point.

#-------------------------------------------------------------------------------

get-origin

Retrieves the origin of the given Gnome::Graphene::N-Ray.

method get-origin ( N-Object $origin )
  • $origin; return location for the origin

#-------------------------------------------------------------------------------

get-position-at

Retrieves the coordinates of a point at the distance $t along the given Gnome::Graphene::N-Ray.

method get-position-at ( Num() $t, N-Object $position )
  • $t; the distance along the ray.

  • $position; return location for the position

#-------------------------------------------------------------------------------

init

Initializes the given Gnome::Graphene::N-Ray using the given $origin and $direction values.

method init ( N-Object $origin, N-Object $direction --> N-Object )
  • $origin; the origin of the ray

  • $direction; the direction vector

Return value; the initialized ray.

#-------------------------------------------------------------------------------

init-from-ray

Initializes the given Gnome::Graphene::N-Ray using the origin and direction values of another Gnome::Graphene::N-Ray.

method init-from-ray ( N-Object $src --> N-Object )
  • $src; a Gnome::Graphene::N-Ray

Return value; the initialized ray.

#-------------------------------------------------------------------------------

init-from-vec3

Initializes the given Gnome::Graphene::N-Ray using the given vectors.

method init-from-vec3 ( N-Object $origin, N-Object $direction --> N-Object )
  • $origin; a graphene_vec3_t

  • $direction; a graphene_vec3_t

Return value; the initialized ray.

#-------------------------------------------------------------------------------

intersect-box

Intersects the given Gnome::Graphene::N-Ray $r with the given Gnome::Graphene::N-Box $b.

method intersect-box ( N-Object $b, Num() $t-out --> graphene_ray_intersection_kind_t )
  • $b; a Gnome::Graphene::N-Box

  • $t-out; (transfer ownership: full) the distance of the point on the ray that intersects the box.

Return value; the type of intersection.

#-------------------------------------------------------------------------------

intersect-sphere

Intersects the given Gnome::Graphene::N-Ray $r with the given Gnome::Graphene::N-Sphere $s.

method intersect-sphere ( N-Object $s, Num() $t-out --> graphene_ray_intersection_kind_t )
  • $s; a Gnome::Graphene::N-Sphere

  • $t-out; (transfer ownership: full) the distance of the point on the ray that intersects the sphere.

Return value; the type of intersection.

#-------------------------------------------------------------------------------

intersect-triangle

Intersects the given Gnome::Graphene::N-Ray $r with the given Gnome::Graphene::N-Triangle $t.

method intersect-triangle ( N-Object $t, Num() $t-out --> graphene_ray_intersection_kind_t )
  • $t; a Gnome::Graphene::N-Triangle

  • $t-out; (transfer ownership: full) the distance of the point on the ray that intersects the triangle.

Return value; the type of intersection.

#-------------------------------------------------------------------------------

intersects-box

Checks whether the given Gnome::Graphene::N-Ray $r intersects the given Gnome::Graphene::N-Box $b.

See also: .intersect-box()

method intersects-box ( N-Object $b --> gboolean )
  • $b; a Gnome::Graphene::N-Box

Return value; true if the ray intersects the box.

#-------------------------------------------------------------------------------

intersects-sphere

Checks if the given Gnome::Graphene::N-Ray $r intersects the given Gnome::Graphene::N-Sphere $s.

See also: .intersect-sphere()

method intersects-sphere ( N-Object $s --> gboolean )
  • $s; a Gnome::Graphene::N-Sphere

Return value; true if the ray intersects the sphere.

#-------------------------------------------------------------------------------

intersects-triangle

Checks whether the given Gnome::Graphene::N-Ray $r intersects the given Gnome::Graphene::N-Triangle $b.

See also: .intersect-triangle()

method intersects-triangle ( N-Object $t --> gboolean )
  • $t; a Gnome::Graphene::N-Triangle

Return value; true if the ray intersects the triangle.

Gnome::Graphene v0.1.11

Graphene is a library of data types commonly used to implement 2D-in-3D or full 3D canvases

Authors

  • Marcel Timmerman

License

Artistic-2.0

Dependencies

Gnome::GObject:api<2>Gnome::Glib:api<2>Gnome::N:api<2>

Test Dependencies

Provides

  • Gnome::Graphene::N-Box
  • Gnome::Graphene::N-Euler
  • Gnome::Graphene::N-Frustum
  • Gnome::Graphene::N-Matrix
  • Gnome::Graphene::N-Plane
  • Gnome::Graphene::N-Point
  • Gnome::Graphene::N-Point3D
  • Gnome::Graphene::N-Quad
  • Gnome::Graphene::N-Quaternion
  • Gnome::Graphene::N-Ray
  • Gnome::Graphene::N-Rect
  • Gnome::Graphene::N-Size
  • Gnome::Graphene::N-Sphere
  • Gnome::Graphene::N-Triangle
  • Gnome::Graphene::N-Vec2
  • Gnome::Graphene::N-Vec3
  • Gnome::Graphene::N-Vec4
  • Gnome::Graphene::T-box
  • Gnome::Graphene::T-config
  • Gnome::Graphene::T-euler
  • Gnome::Graphene::T-frustum
  • Gnome::Graphene::T-matrix
  • Gnome::Graphene::T-plane
  • Gnome::Graphene::T-point
  • Gnome::Graphene::T-point3d
  • Gnome::Graphene::T-quad
  • Gnome::Graphene::T-quaternion
  • Gnome::Graphene::T-ray
  • Gnome::Graphene::T-rect
  • Gnome::Graphene::T-size
  • Gnome::Graphene::T-sphere
  • Gnome::Graphene::T-triangle
  • Gnome::Graphene::T-vec

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.