Graphene.Point3D

Fields

Name

Type

Access

Description

x

float

r/w

the X coordinate

y

float

r/w

the Y coordinate

z

float

r/w

the Z coordinate

Methods

class

alloc ()

class

zero ()

cross (b)

distance (b)

dot (b)

equal (b)

free ()

init (x, y, z)

init_from_point (src)

init_from_vec3 (v)

interpolate (b, factor)

length ()

near (b, epsilon)

normalize ()

normalize_viewport (viewport, z_near, z_far)

scale (factor)

to_vec3 ()

Details

class Graphene.Point3D

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

New in version 1.0.

classmethod alloc()
Returns:

the newly allocated structure. Use Graphene.Point3D.free() to free the resources allocated by this function.

Return type:

Graphene.Point3D

Allocates a Graphene.Point3D structure.

New in version 1.0.

classmethod zero()
Returns:

a zero point

Return type:

Graphene.Point3D

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

New in version 1.0.

cross(b)
Parameters:

b (Graphene.Point3D) – a Graphene.Point3D

Returns:

return location for the cross product

Return type:

res: Graphene.Point3D

Computes the cross product of the two given Graphene.Point3D.

New in version 1.0.

distance(b)
Parameters:

b (Graphene.Point3D) – a Graphene.Point3D

Returns:

the distance between two points

delta:

return location for the distance components on the X, Y, and Z axis

Return type:

(float, delta: Graphene.Vec3)

Computes the distance between the two given Graphene.Point3D.

New in version 1.4.

dot(b)
Parameters:

b (Graphene.Point3D) – a Graphene.Point3D

Returns:

the value of the dot product

Return type:

float

Computes the dot product of the two given Graphene.Point3D.

New in version 1.0.

equal(b)
Parameters:

b (Graphene.Point3D) – a Graphene.Point3D

Returns:

true if the points are equal

Return type:

bool

Checks whether two given points are equal.

New in version 1.0.

free()

Frees the resources allocated via Graphene.Point3D.alloc().

New in version 1.0.

init(x, y, z)
Parameters:
  • x (float) – the X coordinate of the point

  • y (float) – the Y coordinate of the point

  • z (float) – the Z coordinate of the point

Returns:

the initialized Graphene.Point3D

Return type:

Graphene.Point3D

Initializes a Graphene.Point3D with the given coordinates.

New in version 1.0.

init_from_point(src)
Parameters:

src (Graphene.Point3D) – a Graphene.Point3D

Returns:

the initialized point

Return type:

Graphene.Point3D

Initializes a Graphene.Point3D using the coordinates of another Graphene.Point3D.

New in version 1.0.

init_from_vec3(v)
Parameters:

v (Graphene.Vec3) – a Graphene.Vec3

Returns:

the initialized Graphene.Point3D

Return type:

Graphene.Point3D

Initializes a Graphene.Point3D using the components of a Graphene.Vec3.

New in version 1.0.

interpolate(b, factor)
Parameters:
Returns:

the return location for the interpolated Graphene.Point3D

Return type:

res: Graphene.Point3D

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

New in version 1.0.

length()
Returns:

the length of the vector represented by the point

Return type:

float

Computes the length of the vector represented by the coordinates of the given Graphene.Point3D.

New in version 1.0.

near(b, epsilon)
Parameters:
Returns:

true if the points are near each other

Return type:

bool

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

New in version 1.0.

normalize()
Returns:

return location for the normalized Graphene.Point3D

Return type:

res: Graphene.Point3D

Computes the normalization of the vector represented by the coordinates of the given Graphene.Point3D.

New in version 1.0.

normalize_viewport(viewport, z_near, z_far)
Parameters:
  • viewport (Graphene.Rect) – a Graphene.Rect representing a viewport

  • z_near (float) – the coordinate of the near clipping plane, or 0 for the default near clipping plane

  • z_far (float) – the coordinate of the far clipping plane, or 1 for the default far clipping plane

Returns:

the return location for the normalized Graphene.Point3D

Return type:

res: Graphene.Point3D

Normalizes the coordinates of a Graphene.Point3D using the given viewport and clipping planes.

The coordinates of the resulting Graphene.Point3D will be in the [ -1, 1 ] range.

New in version 1.4.

scale(factor)
Parameters:

factor (float) – the scaling factor

Returns:

return location for the scaled point

Return type:

res: Graphene.Point3D

Scales the coordinates of the given Graphene.Point3D by the given factor.

New in version 1.0.

to_vec3()
Returns:

return location for a Graphene.Vec3

Return type:

v: Graphene.Vec3

Stores the coordinates of a Graphene.Point3D into a Graphene.Vec3.

New in version 1.0.