N-Plane

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

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]------------------------------------------------------- #-------------------------------------------------------------------------------

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]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

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

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.