Point3D

Added in version 1.0.

class Point3D(*args, **kwargs)

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

Constructors

class Point3D
classmethod alloc() Point3D

Allocates a Point3D structure.

Added in version 1.0.

Methods

class Point3D
cross(b: Point3D) Point3D

Computes the cross product of the two given Point3D.

Added in version 1.0.

Parameters:

b – a Point3D

distance(b: Point3D) tuple[float, Vec3]

Computes the distance between the two given Point3D.

Added in version 1.4.

Parameters:

b – a Point3D

dot(b: Point3D) float

Computes the dot product of the two given Point3D.

Added in version 1.0.

Parameters:

b – a Point3D

equal(b: Point3D) bool

Checks whether two given points are equal.

Added in version 1.0.

Parameters:

b – a Point3D

free() None

Frees the resources allocated via alloc().

Added in version 1.0.

init(x: float, y: float, z: float) Point3D

Initializes a Point3D with the given coordinates.

Added in version 1.0.

Parameters:
  • x – the X coordinate of the point

  • y – the Y coordinate of the point

  • z – the Z coordinate of the point

init_from_point(src: Point3D) Point3D

Initializes a Point3D using the coordinates of another Point3D.

Added in version 1.0.

Parameters:

src – a Point3D

init_from_vec3(v: Vec3) Point3D

Initializes a Point3D using the components of a Vec3.

Added in version 1.0.

Parameters:

v – a Vec3

interpolate(b: Point3D, factor: float) Point3D

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

Added in version 1.0.

Parameters:
  • b – a Point3D

  • factor – the interpolation factor

length() float

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

Added in version 1.0.

near(b: Point3D, epsilon: float) bool

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

Added in version 1.0.

Parameters:
  • b – a Point3D

  • epsilon – fuzzyness factor

normalize() Point3D

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

Added in version 1.0.

normalize_viewport(viewport: Rect, z_near: float, z_far: float) Point3D

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

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

Added in version 1.4.

Parameters:
  • viewport – a Rect 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

scale(factor: float) Point3D

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

Added in version 1.0.

Parameters:

factor – the scaling factor

to_vec3() Vec3

Stores the coordinates of a Point3D into a Vec3.

Added in version 1.0.

zero() Point3D

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

Added in version 1.0.

Fields

class Point3D
x

The X coordinate

y

The Y coordinate

z

The Z coordinate