About all my projects
NO_TITLE

NO_TITLE

Gnome::Graphene::N-Sphere

Description

A sphere, represented by its center and radius.

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-Sphere.

The contents of the newly allocated structure are undefined.

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

Methods

contains-point

Checks whether the given $point is contained in the volume of a Gnome::Graphene::N-Sphere.

method contains-point ( N-Object $point --> gboolean )
  • $point; a graphene_point3d_t

Return value; true if the sphere contains the point.

distance

Computes the distance of the given $point from the surface of a Gnome::Graphene::N-Sphere.

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

Return value; the distance of the point.

equal

Checks whether two Gnome::Graphene::N-Sphere are equal.

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

Return value; true if the spheres are equal.

free

Frees the resources allocated by .alloc().

method free ( )

get-bounding-box

Computes the bounding box capable of containing the given Gnome::Graphene::N-Sphere.

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

get-center

Retrieves the coordinates of the center of a Gnome::Graphene::N-Sphere.

method get-center ( N-Object $center )
  • $center; return location for the coordinates of the center

get-radius

Retrieves the radius of a Gnome::Graphene::N-Sphere.

method get-radius (--> Num )

Return value; No documentation about its value and use.

init

Initializes the given Gnome::Graphene::N-Sphere with the given $center and $radius.

method init ( N-Object $center, Num() $radius --> N-Object )
  • $center; the coordinates of the center of the sphere, or undefined for a center in (0, 0, 0)

  • $radius; the radius of the sphere.

Return value; the initialized Gnome::Graphene::N-Sphere.

init-from-points This function is not yet available

Initializes the given Gnome::Graphene::N-Sphere using the given array of 3D coordinates so that the sphere includes them.

The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all $points.

method init-from-points ( …, N-Object $points, N-Object $center --> N-Object )
  • n-points; the number of graphene_point3d_t in the $points array. Note that each argument must be specified as a type followed by its value!

  • $points; an array of graphene_point3d_t

  • $center; the center of the sphere

Return value; the initialized Gnome::Graphene::N-Sphere.

init-from-vectors This function is not yet available

Initializes the given Gnome::Graphene::N-Sphere using the given array of 3D coordinates so that the sphere includes them.

The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all $vectors.

method init-from-vectors ( …, N-Object $vectors, N-Object $center --> N-Object )
  • n-vectors; the number of graphene_vec3_t in the $vectors array. Note that each argument must be specified as a type followed by its value!

  • $vectors; an array of graphene_vec3_t

  • $center; the center of the sphere

Return value; the initialized Gnome::Graphene::N-Sphere.

is-empty

Checks whether the sphere has a zero radius.

method is-empty (--> gboolean )

Return value; true if the sphere is empty.

translate

Translates the center of the given Gnome::Graphene::N-Sphere using the $point coordinates as the delta of the translation.

method translate ( N-Object $point, N-Object $res )
  • $point; the coordinates of the translation

  • $res; return location for the translated sphere