Gnash  0.8.11dev
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
gnash::geometry::Point2d Class Reference

2D Point class More...

#include <Point2d.h>

Public Member Functions

constexpr Point2d ()
 Construct a Point2d with default x and y coordinates. More...
 
constexpr Point2d (std::int32_t cx, std::int32_t cy)
 Construct a Point2d with given x and y ordinates. More...
 
 Point2d (const Point2d &p0, const Point2d &p1, float t)
 Construct a Point2d as an interpolation of the given input points. More...
 
Point2dsetTo (const std::int32_t cx, const std::int32_t cy)
 Set coordinates to given values. More...
 
Point2dsetTo (const Point2d &p0, const Point2d &p1, float t)
 Set coordinates to the ones of the interpolation between the given input points. More...
 
std::int64_t squareDistance (const Point2d &p) const
 Return square distance between this and the given point. More...
 
std::int32_t distance (const Point2d &p) const
 Return distance between this and the given point. More...
 
bool operator== (const Point2d &p) const
 
bool operator!= (const Point2d &p) const
 

Static Public Member Functions

static std::int64_t squareDistance (const Point2d &p0, const Point2d &p1)
 Return square distance between two given points. More...
 

Public Attributes

std::int32_t x
 The x coordinate. More...
 
std::int32_t y
 The y coordinate. More...
 

Detailed Description

2D Point class

A point which contains a x and a y coorinate in TWIPS.

Constructor & Destructor Documentation

§ Point2d() [1/3]

constexpr gnash::geometry::Point2d::Point2d ( )
inline

Construct a Point2d with default x and y coordinates.

§ Point2d() [2/3]

constexpr gnash::geometry::Point2d::Point2d ( std::int32_t  cx,
std::int32_t  cy 
)
inline

Construct a Point2d with given x and y ordinates.

§ Point2d() [3/3]

gnash::geometry::Point2d::Point2d ( const Point2d p0,
const Point2d p1,
float  t 
)
inline

Construct a Point2d as an interpolation of the given input points.

Parameters
p0first point
p1second point
tinterpolation factor, between 0 and 1

Member Function Documentation

§ distance()

std::int32_t gnash::geometry::Point2d::distance ( const Point2d p) const
inline

Return distance between this and the given point.

References squareDistance().

Referenced by gnash::renderer::opengl::trace_curve().

§ operator!=()

bool gnash::geometry::Point2d::operator!= ( const Point2d p) const
inline

References gnash::key::p.

§ operator==()

bool gnash::geometry::Point2d::operator== ( const Point2d p) const
inline

References x, and y.

§ setTo() [1/2]

Point2d& gnash::geometry::Point2d::setTo ( const std::int32_t  cx,
const std::int32_t  cy 
)
inline

Set coordinates to given values.

Returns
a reference to this instance

§ setTo() [2/2]

Point2d& gnash::geometry::Point2d::setTo ( const Point2d p0,
const Point2d p1,
float  t 
)
inline

Set coordinates to the ones of the interpolation between the given input points.

Parameters
p0first point
p1second point
tinterpolation factor, between 0 and 1
Returns
a reference to this instance

References gnash::key::t, x, and y.

§ squareDistance() [1/2]

static std::int64_t gnash::geometry::Point2d::squareDistance ( const Point2d p0,
const Point2d p1 
)
inlinestatic

Return square distance between two given points.

References x, and y.

Referenced by distance(), squareDistance(), gnash::Edge::squareDistancePtCurve(), and gnash::Edge::squareDistancePtSeg().

§ squareDistance() [2/2]

std::int64_t gnash::geometry::Point2d::squareDistance ( const Point2d p) const
inline

Return square distance between this and the given point.

References squareDistance().

Member Data Documentation

§ x

std::int32_t gnash::geometry::Point2d::x

§ y

std::int32_t gnash::geometry::Point2d::y

The documentation for this class was generated from the following file: