:right-sidebar: True PathPoint =================================================================== .. currentmodule:: gi.repository.Gsk .. versionadded:: 4.14 .. class:: PathPoint(*args, **kwargs) :no-contents-entry: ``GskPathPoint`` is an opaque type representing a point on a path. It can be queried for properties of the path at that point, such as its tangent or its curvature. To obtain a ``GskPathPoint``\, use :obj:`~gi.repository.Gsk.Path.get_closest_point`\, :obj:`~gi.repository.Gsk.Path.get_start_point`\, :obj:`~gi.repository.Gsk.Path.get_end_point` or :obj:`~gi.repository.Gsk.PathMeasure.get_point`\. Note that ``GskPathPoint`` structs are meant to be stack-allocated, and don't hold a reference to the path object they are obtained from. It is the callers responsibility to keep a reference to the path as long as the ``GskPathPoint`` is used. Methods ------- .. rst-class:: interim-class .. class:: PathPoint :no-index: .. method:: compare(point2: ~gi.repository.Gsk.PathPoint) -> int Returns whether ``point1`` is before or after ``point2``\. .. versionadded:: 4.14 :param point2: another ``GskPathPoint`` .. method:: equal(point2: ~gi.repository.Gsk.PathPoint) -> bool Returns whether the two path points refer to the same location on all paths. Note that the start- and endpoint of a closed contour will compare nonequal according to this definition. Use :obj:`~gi.repository.Gsk.Path.is_closed` to find out if the start- and endpoint of a concrete path refer to the same location. .. versionadded:: 4.14 :param point2: another ``GskPathPoint`` .. method:: free() -> None Frees a path point copied by :obj:`~gi.repository.Gsk.PathPoint.copy`\. .. versionadded:: 4.14 .. method:: get_curvature(path: ~gi.repository.Gsk.Path, direction: ~gi.repository.Gsk.PathDirection) -> ~typing.Tuple[float, ~gi.repository.Graphene.Point | None] Calculates the curvature of the path at the point. Optionally, returns the center of the osculating circle as well. The curvature is the inverse of the radius of the osculating circle. Lines have a curvature of zero (indicating an osculating circle of infinite radius. In this case, the ``center`` is not modified. Circles with a radius of zero have ``INFINITY`` as curvature Note that certain points on a path may not have a single curvature, such as sharp turns. At such points, there are two curvatures -- the (limit of) the curvature of the path going into the point, and the (limit of) the curvature of the path coming out of it. The ``direction`` argument lets you choose which one to get. .. image:: https://docs.gtk.org/gsk4/curvature-light.png .. versionadded:: 4.14 :param path: the path that ``point`` is on :param direction: the direction for which to return the curvature .. method:: get_distance(measure: ~gi.repository.Gsk.PathMeasure) -> float Returns the distance from the beginning of the path to ``point``\. .. versionadded:: 4.14 :param measure: a ``GskPathMeasure`` for the path .. method:: get_position(path: ~gi.repository.Gsk.Path) -> ~gi.repository.Graphene.Point Gets the position of the point. .. versionadded:: 4.14 :param path: the path that ``point`` is on .. method:: get_rotation(path: ~gi.repository.Gsk.Path, direction: ~gi.repository.Gsk.PathDirection) -> float Gets the direction of the tangent at a given point. This is a convenience variant of :obj:`~gi.repository.Gsk.PathPoint.get_tangent` that returns the angle between the tangent and the X axis. The angle can e.g. be used in `gtk_snapshot_rotate() <../gtk4/method.Snapshot.rotate.html>`__\. .. versionadded:: 4.14 :param path: the path that ``point`` is on :param direction: the direction for which to return the rotation .. method:: get_tangent(path: ~gi.repository.Gsk.Path, direction: ~gi.repository.Gsk.PathDirection) -> ~gi.repository.Graphene.Vec2 Gets the tangent of the path at the point. Note that certain points on a path may not have a single tangent, such as sharp turns. At such points, there are two tangents -- the direction of the path going into the point, and the direction coming out of it. The ``direction`` argument lets you choose which one to get. If the path is just a single point (e.g. a circle with radius zero), then ``tangent`` is set to ``0, 0``\. If you want to orient something in the direction of the path, :obj:`~gi.repository.Gsk.PathPoint.get_rotation` may be more convenient to use. .. versionadded:: 4.14 :param path: the path that ``point`` is on :param direction: the direction for which to return the tangent