N-Point

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

Gnome::Graphene::N-Point

Description

A point with two coordinates.

#------------------------------------------------------------------------------- #--[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-Point structure.

The coordinates of the returned point are (0, 0).

It's possible to chain this function with .init() or .init-from-point(), e.g.:

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

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

Methods

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

distance

Computes the distance between $a and $b.

method distance ( CArray[N-Point] $b, Num() $d-x, Num() $d-y --> Num )
  • $b; a Gnome::Graphene::N-Point.

  • $d-x; (transfer ownership: full) distance component on the X axis.

  • $d-y; (transfer ownership: full) distance component on the Y axis.

Return value; the distance between the two points.

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

equal This function is not yet available

Checks if the two points $a and $b point to the same coordinates.

This function accounts for floating point fluctuations; if you want to control the fuzziness of the match, you can use .near() instead.

method equal ( CArray[N-Point] $b )
  • $b; a Gnome::Graphene::N-Point.

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

free

Frees the resources allocated by .alloc().

method free ( )

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

init

Initializes $p to the given $x and $y coordinates.

It's safe to call this function multiple times.

method init ( Num() $x, Num() $y --> CArray[N-Point] )
  • $x; the X coordinate.

  • $y; the Y coordinate.

Return value; the initialized point.

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

init-from-point

Initializes $p with the same coordinates of $src.

method init-from-point ( CArray[N-Point] $src --> CArray[N-Point] )
  • $src; the Gnome::Graphene::N-Point to use.

Return value; the initialized point.

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

init-from-vec2

Initializes $p with the coordinates inside the given graphene_vec2_t.

method init-from-vec2 ( CArray[N-Vec2] $src --> CArray[N-Point] )
  • $src; a graphene_vec2_t.

Return value; the initialized point.

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

interpolate

Linearly interpolates the coordinates of $a and $b using the given $factor.

method interpolate ( CArray[N-Point] $b, Num() $factor, CArray[N-Point] $res )
  • $b; a Gnome::Graphene::N-Point.

  • $factor; the linear interpolation factor.

  • $res; return location for the interpolated point.

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

near This function is not yet available

Checks whether the two points $a and $b are within the threshold of $epsilon.

method near ( CArray[N-Point] $b, Num() $epsilon )
  • $b; a Gnome::Graphene::N-Point.

  • $epsilon; threshold between the two points.

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

to-vec2

Stores the coordinates of the given Gnome::Graphene::N-Point into a graphene_vec2_t.

method to-vec2 ( CArray[N-Vec2] $v )
  • $v; return location for the vertex.

#------------------------------------------------------------------------------- #--[Functions]------------------------------------------------------------------ #-------------------------------------------------------------------------------

Functions

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

zero

Returns a point fixed at (0, 0).

method zero (--> CArray[N-Point] )

Return value; a fixed point.

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.