:right-sidebar: True Box =================================================================== .. currentmodule:: gi.repository.Graphene .. versionadded:: 1.2 .. class:: Box(*args, **kwargs) :no-contents-entry: A 3D box, described as the volume between a minimum and a maximum vertices. Constructors ------------ .. rst-class:: interim-class .. class:: Box :no-index: .. classmethod:: alloc() -> ~gi.repository.Graphene.Box Allocates a new :obj:`~gi.repository.Graphene.Box`\. The contents of the returned structure are undefined. .. versionadded:: 1.2 Methods ------- .. rst-class:: interim-class .. class:: Box :no-index: .. method:: contains_box(b: ~gi.repository.Graphene.Box) -> bool Checks whether the :obj:`~gi.repository.Graphene.Box` ``a`` contains the given :obj:`~gi.repository.Graphene.Box` ``b``\. .. versionadded:: 1.2 :param b: a :obj:`~gi.repository.Graphene.Box` .. method:: contains_point(point: ~gi.repository.Graphene.Point3D) -> bool Checks whether ``box`` contains the given ``point``\. .. versionadded:: 1.2 :param point: the coordinates to check .. classmethod:: empty() -> ~gi.repository.Graphene.Box A degenerate :obj:`~gi.repository.Graphene.Box` that can only be expanded. The returned value is owned by Graphene and should not be modified or freed. .. versionadded:: 1.2 .. method:: equal(b: ~gi.repository.Graphene.Box) -> bool Checks whether the two given boxes are equal. .. versionadded:: 1.2 :param b: a :obj:`~gi.repository.Graphene.Box` .. method:: expand(point: ~gi.repository.Graphene.Point3D) -> ~gi.repository.Graphene.Box Expands the dimensions of ``box`` to include the coordinates at ``point``\. .. versionadded:: 1.2 :param point: the coordinates of the point to include .. method:: expand_scalar(scalar: float) -> ~gi.repository.Graphene.Box Expands the dimensions of ``box`` by the given ``scalar`` value. If ``scalar`` is positive, the :obj:`~gi.repository.Graphene.Box` will grow; if ``scalar`` is negative, the :obj:`~gi.repository.Graphene.Box` will shrink. .. versionadded:: 1.2 :param scalar: a scalar value .. method:: expand_vec3(vec: ~gi.repository.Graphene.Vec3) -> ~gi.repository.Graphene.Box Expands the dimensions of ``box`` to include the coordinates of the given vector. .. versionadded:: 1.2 :param vec: the coordinates of the point to include, as a :obj:`~gi.repository.Graphene.Vec3` .. method:: free() -> None Frees the resources allocated by :func:`~gi.repository.Graphene.Box.alloc`. .. versionadded:: 1.2 .. method:: get_bounding_sphere() -> ~gi.repository.Graphene.Sphere Computes the bounding :obj:`~gi.repository.Graphene.Sphere` capable of containing the given :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 .. method:: get_center() -> ~gi.repository.Graphene.Point3D Retrieves the coordinates of the center of a :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 .. method:: get_depth() -> float Retrieves the size of the ``box`` on the Z axis. .. versionadded:: 1.2 .. method:: get_height() -> float Retrieves the size of the ``box`` on the Y axis. .. versionadded:: 1.2 .. method:: get_max() -> ~gi.repository.Graphene.Point3D Retrieves the coordinates of the maximum point of the given :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 .. method:: get_min() -> ~gi.repository.Graphene.Point3D Retrieves the coordinates of the minimum point of the given :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 .. method:: get_size() -> ~gi.repository.Graphene.Vec3 Retrieves the size of the box on all three axes, and stores it into the given ``size`` vector. .. versionadded:: 1.2 .. method:: get_vertices() -> list[~gi.repository.Graphene.Vec3] Computes the vertices of the given :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 .. method:: get_width() -> float Retrieves the size of the ``box`` on the X axis. .. versionadded:: 1.2 .. classmethod:: infinite() -> ~gi.repository.Graphene.Box A degenerate :obj:`~gi.repository.Graphene.Box` that cannot be expanded. The returned value is owned by Graphene and should not be modified or freed. .. versionadded:: 1.2 .. method:: init(min: ~gi.repository.Graphene.Point3D | None = None, max: ~gi.repository.Graphene.Point3D | None = None) -> ~gi.repository.Graphene.Box Initializes the given :obj:`~gi.repository.Graphene.Box` with two vertices. .. versionadded:: 1.2 :param min: the coordinates of the minimum vertex :param max: the coordinates of the maximum vertex .. method:: init_from_box(src: ~gi.repository.Graphene.Box) -> ~gi.repository.Graphene.Box Initializes the given :obj:`~gi.repository.Graphene.Box` with the vertices of another :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 :param src: a :obj:`~gi.repository.Graphene.Box` .. method:: init_from_points(points: list[~gi.repository.Graphene.Point3D]) -> ~gi.repository.Graphene.Box Initializes the given :obj:`~gi.repository.Graphene.Box` with the given array of vertices. If ``n_points`` is 0, the returned box is initialized with :func:`~gi.repository.Graphene.Box.empty`. .. versionadded:: 1.2 :param points: an array of :obj:`~gi.repository.Graphene.Point3D` .. method:: init_from_vec3(min: ~gi.repository.Graphene.Vec3 | None = None, max: ~gi.repository.Graphene.Vec3 | None = None) -> ~gi.repository.Graphene.Box Initializes the given :obj:`~gi.repository.Graphene.Box` with two vertices stored inside :obj:`~gi.repository.Graphene.Vec3`\. .. versionadded:: 1.2 :param min: the coordinates of the minimum vertex :param max: the coordinates of the maximum vertex .. method:: init_from_vectors(vectors: list[~gi.repository.Graphene.Vec3]) -> ~gi.repository.Graphene.Box Initializes the given :obj:`~gi.repository.Graphene.Box` with the given array of vertices. If ``n_vectors`` is 0, the returned box is initialized with :func:`~gi.repository.Graphene.Box.empty`. .. versionadded:: 1.2 :param vectors: an array of :obj:`~gi.repository.Graphene.Vec3` .. method:: intersection(b: ~gi.repository.Graphene.Box) -> ~typing.Tuple[bool, ~gi.repository.Graphene.Box] Intersects the two given :obj:`~gi.repository.Graphene.Box`\. If the two boxes do not intersect, ``res`` will contain a degenerate box initialized with :func:`~gi.repository.Graphene.Box.empty`. .. versionadded:: 1.2 :param b: a :obj:`~gi.repository.Graphene.Box` .. classmethod:: minus_one() -> ~gi.repository.Graphene.Box A :obj:`~gi.repository.Graphene.Box` with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0). The returned value is owned by Graphene and should not be modified or freed. .. versionadded:: 1.2 .. classmethod:: one() -> ~gi.repository.Graphene.Box A :obj:`~gi.repository.Graphene.Box` with the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1). The returned value is owned by Graphene and should not be modified or freed. .. versionadded:: 1.2 .. classmethod:: one_minus_one() -> ~gi.repository.Graphene.Box A :obj:`~gi.repository.Graphene.Box` with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1). The returned value is owned by Graphene and should not be modified or freed. .. versionadded:: 1.2 .. method:: union(b: ~gi.repository.Graphene.Box) -> ~gi.repository.Graphene.Box Unions the two given :obj:`~gi.repository.Graphene.Box`\. .. versionadded:: 1.2 :param b: the box to union to ``a`` .. classmethod:: zero() -> ~gi.repository.Graphene.Box A :obj:`~gi.repository.Graphene.Box` with both the minimum and maximum vertices set at (0, 0, 0). The returned value is owned by Graphene and should not be modified or freed. .. versionadded:: 1.2 Fields ------ .. rst-class:: interim-class .. class:: Box :no-index: .. attribute:: max .. attribute:: min