About all my projects
NO_TITLE

NO_TITLE

Gnome::Graphene::N-Plane

Description

A 2D plane that extends infinitely in a 3D volume.

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

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-Plane structure.

The contents of the returned structure are undefined.

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

Methods

distance

Computes the distance of $point from a Gnome::Graphene::N-Plane.

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

Return value; the distance of the given graphene_point3d_t from the plane.

equal

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

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

Return value; true if the given planes are equal.

free

Frees the resources allocated by .alloc().

method free ( )

get-constant

Retrieves the distance along the normal vector of the given Gnome::Graphene::N-Plane from the origin.

method get-constant (--> Num )

Return value; the constant value of the plane.

get-normal

Retrieves the normal vector pointing towards the origin of the given Gnome::Graphene::N-Plane.

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

init

Initializes the given Gnome::Graphene::N-Plane using the given $normal vector and $constant values.

method init ( N-Object $normal, Num() $constant --> N-Object )
  • $normal; a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default

  • $constant; the distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane.

Return value; the initialized plane.

init-from-plane

Initializes the given Gnome::Graphene::N-Plane using the normal vector and constant of another Gnome::Graphene::N-Plane.

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

Return value; the initialized plane.

init-from-point

Initializes the given Gnome::Graphene::N-Plane using the given normal vector and an arbitrary co-planar point.

method init-from-point ( N-Object $normal, N-Object $point --> N-Object )
  • $normal; a normal vector defining the plane pointing towards the origin

  • $point; a graphene_point3d_t

Return value; the initialized plane.

init-from-points

Initializes the given Gnome::Graphene::N-Plane using the 3 provided co-planar points.

The winding order is counter-clockwise, and determines which direction the normal vector will point.

method init-from-points ( N-Object $a, N-Object $b, N-Object $c --> N-Object )
  • $a; a graphene_point3d_t

  • $b; a graphene_point3d_t

  • $c; a graphene_point3d_t

Return value; the initialized plane.

init-from-vec4

Initializes the given Gnome::Graphene::N-Plane using the components of the given graphene_vec4_t vector.

method init-from-vec4 ( N-Object $src --> N-Object )
  • $src; a graphene_vec4_t containing the normal vector in its first three components, and the distance in its fourth component

Return value; the initialized plane.

negate

Negates the normal vector and constant of a Gnome::Graphene::N-Plane, effectively mirroring the plane across the origin.

method negate ( N-Object $res )
  • $res; return location for the negated plane

normalize

Normalizes the vector of the given Gnome::Graphene::N-Plane, and adjusts the constant accordingly.

method normalize ( N-Object $res )
  • $res; return location for the normalized plane

transform

Transforms a Gnome::Graphene::N-Plane $p using the given $matrix and $normal-matrix.

If $normal-matrix is undefined, a transformation matrix for the plane normal will be computed from $matrix. If you are transforming multiple planes using the same $matrix it's recommended to compute the normal matrix beforehand to avoid incurring in the cost of recomputing it every time.

method transform ( N-Object $matrix, N-Object $normal-matrix, N-Object $res )
  • $matrix; a Gnome::Graphene::N-Matrix

  • $normal-matrix; a Gnome::Graphene::N-Matrix

  • $res; the transformed plane