About all my projects
NO_TITLE

NO_TITLE

Gnome::Graphene::N-Point3D

Description

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

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

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

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

zero

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

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

Return value; a zero point.