:right-sidebar: True Point3D =================================================================== .. currentmodule:: gi.repository.Graphene .. versionadded:: 1.0 .. class:: Point3D(*args, **kwargs) :no-contents-entry: A point with three components: X, Y, and Z. Constructors ------------ .. rst-class:: interim-class .. class:: Point3D :no-index: .. classmethod:: alloc() -> ~gi.repository.Graphene.Point3D Allocates a :obj:`~gi.repository.Graphene.Point3D` structure. .. versionadded:: 1.0 Methods ------- .. rst-class:: interim-class .. class:: Point3D :no-index: .. method:: cross(b: ~gi.repository.Graphene.Point3D) -> ~gi.repository.Graphene.Point3D Computes the cross product of the two given :obj:`~gi.repository.Graphene.Point3D`\. .. versionadded:: 1.0 :param b: a :obj:`~gi.repository.Graphene.Point3D` .. method:: distance(b: ~gi.repository.Graphene.Point3D) -> ~typing.Tuple[float, ~gi.repository.Graphene.Vec3] Computes the distance between the two given :obj:`~gi.repository.Graphene.Point3D`\. .. versionadded:: 1.4 :param b: a :obj:`~gi.repository.Graphene.Point3D` .. method:: dot(b: ~gi.repository.Graphene.Point3D) -> float Computes the dot product of the two given :obj:`~gi.repository.Graphene.Point3D`\. .. versionadded:: 1.0 :param b: a :obj:`~gi.repository.Graphene.Point3D` .. method:: equal(b: ~gi.repository.Graphene.Point3D) -> bool Checks whether two given points are equal. .. versionadded:: 1.0 :param b: a :obj:`~gi.repository.Graphene.Point3D` .. method:: free() -> None Frees the resources allocated via :func:`~gi.repository.Graphene.Point3D.alloc`. .. versionadded:: 1.0 .. method:: init(x: float, y: float, z: float) -> ~gi.repository.Graphene.Point3D Initializes a :obj:`~gi.repository.Graphene.Point3D` with the given coordinates. .. versionadded:: 1.0 :param x: the X coordinate of the point :param y: the Y coordinate of the point :param z: the Z coordinate of the point .. method:: init_from_point(src: ~gi.repository.Graphene.Point3D) -> ~gi.repository.Graphene.Point3D Initializes a :obj:`~gi.repository.Graphene.Point3D` using the coordinates of another :obj:`~gi.repository.Graphene.Point3D`\. .. versionadded:: 1.0 :param src: a :obj:`~gi.repository.Graphene.Point3D` .. method:: init_from_vec3(v: ~gi.repository.Graphene.Vec3) -> ~gi.repository.Graphene.Point3D Initializes a :obj:`~gi.repository.Graphene.Point3D` using the components of a :obj:`~gi.repository.Graphene.Vec3`\. .. versionadded:: 1.0 :param v: a :obj:`~gi.repository.Graphene.Vec3` .. method:: interpolate(b: ~gi.repository.Graphene.Point3D, factor: float) -> ~gi.repository.Graphene.Point3D Linearly interpolates each component of ``a`` and ``b`` using the provided ``factor``\, and places the result in ``res``\. .. versionadded:: 1.0 :param b: a :obj:`~gi.repository.Graphene.Point3D` :param factor: the interpolation factor .. method:: length() -> float Computes the length of the vector represented by the coordinates of the given :obj:`~gi.repository.Graphene.Point3D`\. .. versionadded:: 1.0 .. method:: near(b: ~gi.repository.Graphene.Point3D, epsilon: float) -> bool Checks whether the two points are near each other, within an ``epsilon`` factor. .. versionadded:: 1.0 :param b: a :obj:`~gi.repository.Graphene.Point3D` :param epsilon: fuzzyness factor .. method:: normalize() -> ~gi.repository.Graphene.Point3D Computes the normalization of the vector represented by the coordinates of the given :obj:`~gi.repository.Graphene.Point3D`\. .. versionadded:: 1.0 .. method:: normalize_viewport(viewport: ~gi.repository.Graphene.Rect, z_near: float, z_far: float) -> ~gi.repository.Graphene.Point3D Normalizes the coordinates of a :obj:`~gi.repository.Graphene.Point3D` using the given viewport and clipping planes. The coordinates of the resulting :obj:`~gi.repository.Graphene.Point3D` will be in the [ -1, 1 ] range. .. versionadded:: 1.4 :param viewport: a :obj:`~gi.repository.Graphene.Rect` representing a viewport :param z_near: the coordinate of the near clipping plane, or 0 for the default near clipping plane :param z_far: the coordinate of the far clipping plane, or 1 for the default far clipping plane .. method:: scale(factor: float) -> ~gi.repository.Graphene.Point3D Scales the coordinates of the given :obj:`~gi.repository.Graphene.Point3D` by the given ``factor``\. .. versionadded:: 1.0 :param factor: the scaling factor .. method:: to_vec3() -> ~gi.repository.Graphene.Vec3 Stores the coordinates of a :obj:`~gi.repository.Graphene.Point3D` into a :obj:`~gi.repository.Graphene.Vec3`\. .. versionadded:: 1.0 .. classmethod:: zero() -> ~gi.repository.Graphene.Point3D Retrieves a constant point with all three coordinates set to 0. .. versionadded:: 1.0 Fields ------ .. rst-class:: interim-class .. class:: Point3D :no-index: .. attribute:: x The X coordinate .. attribute:: y The Y coordinate .. attribute:: z The Z coordinate