:right-sidebar: True Plane =================================================================== .. currentmodule:: gi.repository.Graphene .. versionadded:: 1.2 .. class:: Plane(*args, **kwargs) :no-contents-entry: A 2D plane that extends infinitely in a 3D volume. The contents of the ``graphene_plane_t`` are private, and should not be modified directly. Constructors ------------ .. rst-class:: interim-class .. class:: Plane :no-index: .. classmethod:: alloc() -> ~gi.repository.Graphene.Plane Allocates a new :obj:`~gi.repository.Graphene.Plane` structure. The contents of the returned structure are undefined. .. versionadded:: 1.2 Methods ------- .. rst-class:: interim-class .. class:: Plane :no-index: .. method:: distance(point: ~gi.repository.Graphene.Point3D) -> float Computes the distance of ``point`` from a :obj:`~gi.repository.Graphene.Plane`\. .. versionadded:: 1.2 :param point: a :obj:`~gi.repository.Graphene.Point3D` .. method:: equal(b: ~gi.repository.Graphene.Plane) -> bool Checks whether the two given :obj:`~gi.repository.Graphene.Plane` are equal. .. versionadded:: 1.2 :param b: a :obj:`~gi.repository.Graphene.Plane` .. method:: free() -> None Frees the resources allocated by :func:`~gi.repository.Graphene.Plane.alloc`. .. versionadded:: 1.2 .. method:: get_constant() -> float Retrieves the distance along the normal vector of the given :obj:`~gi.repository.Graphene.Plane` from the origin. .. versionadded:: 1.2 .. method:: get_normal() -> ~gi.repository.Graphene.Vec3 Retrieves the normal vector pointing towards the origin of the given :obj:`~gi.repository.Graphene.Plane`\. .. versionadded:: 1.2 .. method:: init(normal: ~gi.repository.Graphene.Vec3 | None, constant: float) -> ~gi.repository.Graphene.Plane Initializes the given :obj:`~gi.repository.Graphene.Plane` using the given ``normal`` vector and ``constant`` values. .. versionadded:: 1.2 :param normal: a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default :param constant: the distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane .. method:: init_from_plane(src: ~gi.repository.Graphene.Plane) -> ~gi.repository.Graphene.Plane Initializes the given :obj:`~gi.repository.Graphene.Plane` using the normal vector and constant of another :obj:`~gi.repository.Graphene.Plane`\. .. versionadded:: 1.2 :param src: a :obj:`~gi.repository.Graphene.Plane` .. method:: init_from_point(normal: ~gi.repository.Graphene.Vec3, point: ~gi.repository.Graphene.Point3D) -> ~gi.repository.Graphene.Plane Initializes the given :obj:`~gi.repository.Graphene.Plane` using the given normal vector and an arbitrary co-planar point. .. versionadded:: 1.2 :param normal: a normal vector defining the plane pointing towards the origin :param point: a :obj:`~gi.repository.Graphene.Point3D` .. method:: init_from_points(a: ~gi.repository.Graphene.Point3D, b: ~gi.repository.Graphene.Point3D, c: ~gi.repository.Graphene.Point3D) -> ~gi.repository.Graphene.Plane Initializes the given :obj:`~gi.repository.Graphene.Plane` using the 3 provided co-planar points. The winding order is counter-clockwise, and determines which direction the normal vector will point. .. versionadded:: 1.2 :param a: a :obj:`~gi.repository.Graphene.Point3D` :param b: a :obj:`~gi.repository.Graphene.Point3D` :param c: a :obj:`~gi.repository.Graphene.Point3D` .. method:: init_from_vec4(src: ~gi.repository.Graphene.Vec4) -> ~gi.repository.Graphene.Plane Initializes the given :obj:`~gi.repository.Graphene.Plane` using the components of the given :obj:`~gi.repository.Graphene.Vec4` vector. .. versionadded:: 1.2 :param src: a :obj:`~gi.repository.Graphene.Vec4` containing the normal vector in its first three components, and the distance in its fourth component .. method:: negate() -> ~gi.repository.Graphene.Plane Negates the normal vector and constant of a :obj:`~gi.repository.Graphene.Plane`\, effectively mirroring the plane across the origin. .. versionadded:: 1.2 .. method:: normalize() -> ~gi.repository.Graphene.Plane Normalizes the vector of the given :obj:`~gi.repository.Graphene.Plane`\, and adjusts the constant accordingly. .. versionadded:: 1.2 .. method:: transform(matrix: ~gi.repository.Graphene.Matrix, normal_matrix: ~gi.repository.Graphene.Matrix | None = None) -> ~gi.repository.Graphene.Plane Transforms a :obj:`~gi.repository.Graphene.Plane` ``p`` using the given ``matrix`` and ``normal_matrix``\. If ``normal_matrix`` is :const:`None`, a transformation matrix for the plane normal will be computed from ``matrix``\. If you are transforming multiple planes using the same ``matrix`` it's recommended to compute the normal matrix beforehand to avoid incurring in the cost of recomputing it every time. .. versionadded:: 1.10 :param matrix: a :obj:`~gi.repository.Graphene.Matrix` :param normal_matrix: a :obj:`~gi.repository.Graphene.Matrix` Fields ------ .. rst-class:: interim-class .. class:: Plane :no-index: .. attribute:: constant .. attribute:: normal