N-Point3D

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

Gnome::Graphene::N-Point3D

Description

A point with three components: X, Y, and Z.

#------------------------------------------------------------------------------- #--[Record Structure Documentation]--------------------------------------------- #-------------------------------------------------------------------------------

Record N-Point3D

class N-Point3D:auth<github:MARTIMM>:api<2> is export is repr('CStruct') {
has gfloat $.x;
    has gfloat $.y;
    has gfloat $.z;
  }
  • x; the X coordinate

  • y; the Y coordinate

  • z; the Z coordinate

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

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

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

Methods

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

cross

Computes the cross product of the two given #graphene_point3d_t.

method cross ( CArray[N-Point3D] $b, CArray[N-Point3D] $res )
  • $b; a #graphene_point3d_t.

  • $res; return location for the cross product.

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

distance

Computes the distance between the two given #graphene_point3d_t.

method distance ( CArray[N-Point3D] $b, CArray[N-Vec3] $delta --> Num )
  • $b; a #graphene_point3d_t.

  • $delta; return location for the distance components on the X, Y, and Z axis.

Return value; the distance between two points.

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

dot

Computes the dot product of the two given #graphene_point3d_t.

method dot ( CArray[N-Point3D] $b --> Num )
  • $b; a #graphene_point3d_t.

Return value; the value of the dot product.

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

equal This function is not yet available

Checks whether two given points are equal.

method equal ( CArray[N-Point3D] $b )
  • $b; a #graphene_point3d_t.

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

free

Frees the resources allocated via .alloc().

method free ( )

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

init

Initializes a #graphene_point3d_t with the given coordinates.

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

  • $y; the Y coordinate of the point.

  • $z; the Z coordinate of the point.

Return value; the initialized #graphene_point3d_t.

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

init-from-point

Initializes a #graphene_point3d_t using the coordinates of another #graphene_point3d_t.

method init-from-point ( CArray[N-Point3D] $src --> CArray[N-Point3D] )
  • $src; a #graphene_point3d_t.

Return value; the initialized point.

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

init-from-vec3

Initializes a #graphene_point3d_t using the components of a #graphene_vec3_t.

method init-from-vec3 ( CArray[N-Vec3] $v --> CArray[N-Point3D] )
  • $v; a #graphene_vec3_t.

Return value; the initialized #graphene_point3d_t.

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

interpolate

Linearly interpolates each component of $a and $b using the provided $factor, and places the result in $res.

method interpolate ( CArray[N-Point3D] $b, Num() $factor, CArray[N-Point3D] $res )
  • $b; a #graphene_point3d_t.

  • $factor; the interpolation factor.

  • $res; the return location for the interpolated #graphene_point3d_t.

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

length

Computes the length of the vector represented by the coordinates of the given #graphene_point3d_t.

method length (--> Num )

Return value; the length of the vector represented by the point.

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

near This function is not yet available

Checks whether the two points are near each other, within an $epsilon factor.

method near ( CArray[N-Point3D] $b, Num() $epsilon )
  • $b; a #graphene_point3d_t.

  • $epsilon; fuzzyness factor.

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

normalize

Computes the normalization of the vector represented by the coordinates of the given #graphene_point3d_t.

method normalize ( CArray[N-Point3D] $res )
  • $res; return location for the normalized #graphene_point3d_t.

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

normalize-viewport This function is not yet available

Normalizes the coordinates of a #graphene_point3d_t using the given viewport and clipping planes.

The coordinates of the resulting #graphene_point3d_t will be in the [ -1, 1 ] range.

method normalize-viewport ( CArray[N-Rect]  $viewport, Num() $z-near, Num() $z-far, CArray[N-Point3D] $res )
  • $viewport; a #graphene_rect_t representing a viewport.

  • $z-near; the coordinate of the near clipping plane, or 0 for the default near clipping plane.

  • $z-far; the coordinate of the far clipping plane, or 1 for the default far clipping plane.

  • $res; the return location for the normalized #graphene_point3d_t.

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

scale

Scales the coordinates of the given #graphene_point3d_t by the given $factor.

method scale ( Num() $factor, CArray[N-Point3D] $res )
  • $factor; the scaling factor.

  • $res; return location for the scaled point.

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

to-vec3

Stores the coordinates of a #graphene_point3d_t into a #graphene_vec3_t.

method to-vec3 ( CArray[N-Vec3] $v )
  • $v; return location for a #graphene_vec3_t.

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

Functions

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

zero

Retrieves a constant point with all three coordinates set to 0.

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

Return value; a zero 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.