gtkmm: Gsk::PathPoint Class Reference

gtkmm 4.23.2

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Gsk::PathPoint Class Reference

Represents a point on a path. More...

`#include <gskmm/pathpoint.h>`

## Public Member Functions
| PathPoint (const PathPoint & other) noexcept
PathPoint & | operator= (const PathPoint & other) noexcept
| PathPoint (PathPoint && other) noexcept
PathPoint & | operator= (PathPoint && other) noexcept
| PathPoint ()
| PathPoint (const GskPathPoint * gobject)
GskPathPoint * | gobj ()
| Provides access to the underlying C instance.
const GskPathPoint * | gobj () const
| Provides access to the underlying C instance.
bool | equal (const PathPoint & point2) const
| Returns whether the two path points refer to the same location on all paths.
int | compare (const PathPoint & point2) const
| Returns whether point1 is before or after point2.
Gdk::Graphene::Point | get_position (const Glib::RefPtr< const Path > & path) const
| Gets the position of the point.
Gdk::Graphene::Vec2 | get_tangent (const Glib::RefPtr< const Path > & path, PathDirection direction) const
| Gets the tangent of the path at this point.
float | get_rotation (const Glib::RefPtr< const Path > & path, PathDirection direction) const
| Gets the direction of the tangent at a given point.
std::pair< float, Gdk::Graphene::Point > | get_curvature (const Glib::RefPtr< const Path > & path, PathDirection direction) const
| Calculates the curvature of the path at this point.
float | get_distance (const Glib::RefPtr< const PathMeasure > & measure) const
| Returns the distance from the beginning of the path to the point.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Attributes
GskPathPoint | gobject_

## Related Symbols
(Note that these are not member symbols.)
Gsk::PathPoint & | wrap (GskPathPoint * object)
const Gsk::PathPoint & | wrap (const GskPathPoint * object)

## Detailed Description

Represents 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 Gsk::PathPoint, use Gsk::Path::get_closest_point(), Gsk::Path::get_start_point(), Gsk::Path::get_end_point() or Gsk::PathMeasure::get_point().

Note that Gsk::PathPoint 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 Gsk::PathPoint is used.

Since gtkmm 4.24

## Constructor & Destructor Documentation

## ◆ PathPoint() [1/4]

Gsk::PathPoint::PathPoint | ( | const PathPoint & | other | ) |
| noexcept

## ◆ PathPoint() [2/4]

Gsk::PathPoint::PathPoint | ( | PathPoint && | other | ) |
| noexcept

## ◆ PathPoint() [3/4]

Gsk::PathPoint::PathPoint | ( |  | ) |

## ◆ PathPoint() [4/4]

Gsk::PathPoint::PathPoint | ( | const GskPathPoint * | gobject | ) |
| explicit

## Member Function Documentation

## ◆ compare()

int Gsk::PathPoint::compare | ( | const PathPoint & | point2 | ) | const

Returns whether point1 is before or after point2.

Since gtkmm 4.24

Parameters

  point2 | Another path point.

Returns
  -1 if point1 is before point2, 1 if point1 is after point2, 0 if they are equal.

## ◆ equal()

bool Gsk::PathPoint::equal | ( | const PathPoint & | point2 | ) | const

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 is_closed() to find out if the start- and endpoint of a concrete path refer to the same location.

Return: true if point1 and point2 are equal

Since gtkmm 4.24

Parameters

  point2 | Another path point.

## ◆ get_curvature()

std::pair< float, Gdk::Graphene::Point > Gsk::PathPoint::get_curvature | ( | const Glib::RefPtr< const Path > & | path,
|  | PathDirection | direction ) const

Calculates the curvature of the path at this point.

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 set to 0, 0.

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)"> </picture>

Since gtkmm 4.24

Parameters

  path | The path that this point is on.
  direction | The direction for which to return the curvature.

Returns
  {curvature, center} The curvature of the path at this point and the center of the osculating circle.

## ◆ get_distance()

float Gsk::PathPoint::get_distance | ( | const Glib::RefPtr< const PathMeasure > & | measure | ) | const

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

Since gtkmm 4.24

Parameters

  measure | A path measure for the path.

Returns
  The distance of point.

## ◆ get_position()

Gdk::Graphene::Point Gsk::PathPoint::get_position | ( | const Glib::RefPtr< const Path > & | path | ) | const

Gets the position of the point.

Since gtkmm 4.24

Parameters

  path | The path that this point is on.

Returns
  The coordinates of the point.

## ◆ get_rotation()

float Gsk::PathPoint::get_rotation | ( | const Glib::RefPtr< const Path > & | path,
|  | PathDirection | direction ) const

Gets the direction of the tangent at a given point.

This is a convenience variant of get_tangent() that returns the angle between the tangent and the X axis. The angle can e.g. be used in gtk_snapshot_rotate().

Since gtkmm 4.24

Parameters

  path | The path that point is on.
  direction | The direction for which to return the rotation.

Returns
  The angle between the tangent and the X axis, in degrees.

## ◆ get_tangent()

Gdk::Graphene::Vec2 Gsk::PathPoint::get_tangent | ( | const Glib::RefPtr< const Path > & | path,
|  | PathDirection | direction ) const

Gets the tangent of the path at this 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 the tangent is set to 0, 0.

If you want to orient something in the direction of the path, get_rotation() may be more convenient to use.

Since gtkmm 4.24

Parameters

  path | The path that this point is on.
  direction | The direction for which to return the tangent.

Returns
  The tangent at this point.

## ◆ get_type()

GType Gsk::PathPoint::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GskPathPoint * Gsk::PathPoint::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GskPathPoint * Gsk::PathPoint::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ operator=() [1/2]

PathPoint & Gsk::PathPoint::operator= | ( | const PathPoint & | other | ) |
| noexcept

## ◆ operator=() [2/2]

PathPoint & Gsk::PathPoint::operator= | ( | PathPoint && | other | ) |
| noexcept

## Friends And Related Symbol Documentation

## ◆ wrap() [1/2]

const Gsk::PathPoint & wrap | ( | const GskPathPoint * | object | ) |
| related

Parameters

  object | The C instance

Returns
  A C++ instance that wraps this C instance.

## ◆ wrap() [2/2]

Gsk::PathPoint & wrap | ( | GskPathPoint * | object | ) |
| related

Parameters

  object | The C instance

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

## ◆ gobject_

GskPathPoint Gsk::PathPoint::gobject_
| protected