gtkmm 4.23.2
Gdk::Graphene::Point Class Reference

A point with 2 coordinates. More...

#include <gdkmm/graphene_point.h>

Public Member Functions

 Point ()
 Constructs an invalid object.
 Point (graphene_point_t * castitem, bool make_a_copy=false)
 Point (const Point & src)
Pointoperator= (const Point & src)
 Point (Point && other) noexcept
Pointoperator= (Point && other) noexcept
 ~Point () noexcept
void swap (Point & other) noexcept
graphene_point_t * gobj ()
const graphene_point_t * gobj () const
graphene_point_t * gobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
 Point (float x, float y)
 Point (const Vec2 & src)
 operator bool () const
 Checks if this instance is valid.
float get_x () const
void set_x (const float & value)
float get_y () const
void set_y (const float & value)
bool equal (const Point & b) const
 Checks if the two points a and b point to the same coordinates.
std::array< float, 3 > distance (const Point & b) const
 Computes the distance between this point and point b.
bool near (const Point & b, float epsilon) const
 Checks whether the two points a and b are within the threshold of epsilon.
Point interpolate (const Point & b, double factor) const
 Linearly interpolates the coordinates of this point and point b using the given factor.

Protected Attributes

graphene_point_t * gobject_

(Note that these are not member symbols.)

void swap (Point & lhs, Point & rhs) noexcept
Gdk::Graphene::Point wrap (graphene_point_t * object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

A point with 2 coordinates.

Gdk::Graphene::Point is a data structure capable of describing a point with two coordinates.

Since gtkmm 4.12

Constructor & Destructor Documentation

◆ Point() [1/6]

Gdk::Graphene::Point::Point ( )

Constructs an invalid object.

E.g. for output arguments to methods. There is not much you can do with the object before it has been assigned a valid value.

◆ Point() [2/6]

Gdk::Graphene::Point::Point ( graphene_point_t * castitem,
bool make_a_copy = false )
explicit

◆ Point() [3/6]

Gdk::Graphene::Point::Point ( const Point & src)

◆ Point() [4/6]

Gdk::Graphene::Point::Point ( Point && other)
noexcept

◆ ~Point()

Gdk::Graphene::Point::~Point ( )
noexcept

◆ Point() [5/6]

Gdk::Graphene::Point::Point ( float x,
float y )

◆ Point() [6/6]

Gdk::Graphene::Point::Point ( const Vec2 & src)
explicit

Member Function Documentation

◆ distance()

std::array< float, 3 > Gdk::Graphene::Point::distance ( const Point & b) const

Computes the distance between this point and point b.

Since gtkmm 4.24
Parameters
bA Gdk::Graphene::Point.
Returns
A 3-element array.
  • Element 0: The distance between the two points.
  • Element 1: Distance component on the X axis.
  • Element 2: Distance component on the Y axis.

◆ equal()

bool Gdk::Graphene::Point::equal ( const Point & b) const

Checks if the two points a and b point to the same coordinates.

This function accounts for floating point fluctuations; if you want to control the fuzziness of the match, you can use near() instead.

Since gtkmm 4.12
Parameters
bA #graphene_point_t.
Returns
true if the points have the same coordinates.

◆ get_x()

float Gdk::Graphene::Point::get_x ( ) const

◆ get_y()

float Gdk::Graphene::Point::get_y ( ) const

◆ gobj() [1/2]

graphene_point_t * Gdk::Graphene::Point::gobj ( )
inline

◆ gobj() [2/2]

const graphene_point_t * Gdk::Graphene::Point::gobj ( ) const
inline

◆ gobj_copy()

graphene_point_t * Gdk::Graphene::Point::gobj_copy ( ) const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

◆ interpolate()

Point Gdk::Graphene::Point::interpolate ( const Point & b,
double factor ) const

Linearly interpolates the coordinates of this point and point b using the given factor.

Since gtkmm 4.24
Parameters
bA Gdk::Graphene::Point.
factorThe linear interpolation factor.
Returns
The interpolated point.

◆ near()

bool Gdk::Graphene::Point::near ( const Point & b,
float epsilon ) const

Checks whether the two points a and b are within the threshold of epsilon.

Since gtkmm 4.12
Parameters
bA #graphene_point_t.
epsilonThreshold between the two points.
Returns
true if the distance is within epsilon.

◆ operator bool()

Gdk::Graphene::Point::operator bool ( ) const
explicit

Checks if this instance is valid.

It is valid if and only if it contains a value. For instance,

if (point)
do_something()

◆ operator=() [1/2]

Point & Gdk::Graphene::Point::operator= ( const Point & src)

◆ operator=() [2/2]

Point & Gdk::Graphene::Point::operator= ( Point && other)
noexcept

◆ set_x()

void Gdk::Graphene::Point::set_x ( const float & value)

◆ set_y()

void Gdk::Graphene::Point::set_y ( const float & value)

◆ swap()

void Gdk::Graphene::Point::swap ( Point & other)
noexcept

◆ swap()

void swap ( Point & lhs,
Point & rhs )
related
Parameters
lhsThe left-hand side
rhsThe right-hand side

◆ wrap()

Gdk::Graphene::Point wrap ( graphene_point_t * object,
bool take_copy = false )
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

Member Data Documentation

◆ gobject_

graphene_point_t* Gdk::Graphene::Point::gobject_
protected