package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gsk/Ocgtk_gsk/Gsk/Wrappers/Path_point/index.html

Module Wrappers.Path_point

type t = [ `path_point ] Gobject.obj

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, method@Gsk.PathPoint.get_rotation may be more convenient to use.

val get_rotation : t -> [ `path ] Gobject.obj -> Gsk_enums.pathdirection -> float

Gets the direction of the tangent at a given point.

This is a convenience variant of method@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).

val get_position : t -> [ `path ] Gobject.obj -> Ocgtk_graphene.Graphene.Wrappers.Point.t

Gets the position of the point.

val get_distance : t -> [ `path_measure ] Gobject.obj -> float

Returns the distance from the beginning of the path to @point.

val get_curvature : t -> [ `path ] Gobject.obj -> Gsk_enums.pathdirection -> float * Ocgtk_graphene.Graphene.Wrappers.Point.t option

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.

<picture> <source srcset="curvature-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Osculating circle" src="curvature-light.png"> </picture>

val equal : t -> t -> 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 method@Gsk.Path.is_closed to find out if the start- and endpoint of a concrete path refer to the same location.

val compare : t -> t -> int

Returns whether @point1 is before or after @point2.