.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2025 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.Point2D:
==========================================================================================================================================
|phoenix_title| **wx.Point2D**
==========================================================================================================================================
`Point2DDouble` represents a point in a ``2D`` (Cartesian) coordinate system, with additional vector operations available.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.Point2D.__init__` Initializes to zero the x and y members.
:meth:`~wx.Point2D.Get` Get() . (x,y)
:meth:`~wx.Point2D.GetCrossProduct` Returns the cross product, where the products of the Y values of this point and ``are`` subtracted from the X products.
:meth:`~wx.Point2D.GetDistance` Returns the distance between this point and ``pt`` .
:meth:`~wx.Point2D.GetDistanceSquare` Returns the squared distance between this point and ``pt`` .
:meth:`~wx.Point2D.GetDotProduct` Returns the dot (i.e., scalar) product, where the products of the X and Y values of this point and ``are`` added.
:meth:`~wx.Point2D.GetFloor` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
:meth:`~wx.Point2D.GetIM` Returns an immutable representation of the ``wx.Point2D`` object, based on ``namedtuple``.
:meth:`~wx.Point2D.GetRounded` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
:meth:`~wx.Point2D.GetVectorAngle` Returns the principal value of the arc tangent of the Y and X values, expressed in degrees.
:meth:`~wx.Point2D.GetVectorLength` Returns the hypotenuse, where the X and Y coordinates of the point represent the lengths of the base and height sides of a right triangle.
:meth:`~wx.Point2D.Normalize` Sets the vector length to 1.0, preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle).
:meth:`~wx.Point2D.SetVectorAngle` Repositions the X and Y coordinates based on the provided angle's degrees.
:meth:`~wx.Point2D.SetVectorLength` Sets the vector length to ``length`` , preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle).
:meth:`~wx.Point2D.__bool__`
:meth:`~wx.Point2D.__getitem__`
:meth:`~wx.Point2D.__len__`
:meth:`~wx.Point2D.__nonzero__`
:meth:`~wx.Point2D.__reduce__`
:meth:`~wx.Point2D.__repr__`
:meth:`~wx.Point2D.__setitem__`
:meth:`~wx.Point2D.__str__`
:meth:`~wx.Point2D.__ne__` Returns the reflection (i.e., negation) of this point.
:meth:`~wx.Point2D.__iadd__` Returns the reflection (i.e., negation) of this point.
:meth:`~wx.Point2D.__sub__` Returns the reflection (i.e., negation) of this point.
:meth:`~wx.Point2D.__isub__` Returns the reflection (i.e., negation) of this point.
:meth:`~wx.Point2D.__eq__` Returns the reflection (i.e., negation) of this point.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.Point2D.Floor` See :meth:`~wx.Point2D.GetFloor`
:attr:`~wx.Point2D.IM` See :meth:`~wx.Point2D.GetIM`
:attr:`~wx.Point2D.Rounded` See :meth:`~wx.Point2D.GetRounded`
:attr:`~wx.Point2D.VectorAngle` See :meth:`~wx.Point2D.GetVectorAngle` and :meth:`~wx.Point2D.SetVectorAngle`
:attr:`~wx.Point2D.VectorLength` See :meth:`~wx.Point2D.GetVectorLength` and :meth:`~wx.Point2D.SetVectorLength`
:attr:`~wx.Point2D.m_x` A public C++ attribute of type `~wx.Double` . X coordinate of this point.
:attr:`~wx.Point2D.m_y` A public C++ attribute of type `~wx.Double` . Y coordinate of this point.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.Point2D(object)
**Possible constructors**::
Point2DDouble() -> None
Point2DDouble(x, y) -> None
Point2DDouble(pt) -> None
Point2DDouble(pt) -> None
Point2DDouble represents a point in a ``2D`` (Cartesian) coordinate
system, with additional vector operations available.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self)`
Initializes to zero the x and y members.
:rtype: `None`
:html:`
`
**__init__** `(self, x, y)`
Initializes the point with the given coordinates.
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:rtype: `None`
:html:`
`
**__init__** `(self, pt)`
Initializes the point from another point.
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `None`
:html:`
`
**__init__** `(self, pt)`
Initializes the point from another point.
:param `pt`:
:type `pt`: wx.Point
:rtype: `None`
:html:`
`
.. method:: Get(self)
Get() . (x,y)
Return the x and y properties as a tuple.
:rtype: `Any`
.. method:: GetCrossProduct(self, vec)
Returns the cross product, where the products of the Y values of this point and ``are`` subtracted from the X products.
This represents another vector that is at right angles to both points.
:param `vec`:
:type `vec`: Point2DDouble
:rtype: `float`
.. method:: GetDistance(self, pt)
Returns the distance between this point and ``pt`` .
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `float`
.. method:: GetDistanceSquare(self, pt)
Returns the squared distance between this point and ``pt`` .
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `float`
.. method:: GetDotProduct(self, vec)
Returns the dot (i.e., scalar) product, where the products of the X and Y values of this point and ``are`` added.
:param `vec`:
:type `vec`: Point2DDouble
:rtype: `float`
.. method:: GetFloor(self)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
:rtype: :ref:`wx.Point`
.. method:: GetIM(self)
Returns an immutable representation of the ``wx.Point2D`` object, based on ``namedtuple``.
This new object is hashable and can be used as a dictionary key,
be added to sets, etc. It can be converted back into a real ``wx.Point2D``
with a simple statement like this: ``obj = wx.Point2D(imObj)``.
.. method:: GetRounded(self)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
:rtype: :ref:`wx.Point`
.. method:: GetVectorAngle(self)
Returns the principal value of the arc tangent of the Y and X values, expressed in degrees.
:rtype: `float`
.. method:: GetVectorLength(self)
Returns the hypotenuse, where the X and Y coordinates of the point represent the lengths of the base and height sides of a right triangle.
:rtype: `float`
.. method:: Normalize(self)
Sets the vector length to 1.0, preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle).
:rtype: `None`
.. method:: SetVectorAngle(self, degrees)
Repositions the X and Y coordinates based on the provided angle's degrees.
:param `degrees`:
:type `degrees`: wx.Double
:rtype: `None`
.. method:: SetVectorLength(self, length)
Sets the vector length to ``length`` , preserving the right angle and altering the X and Y values (which represent the base and height sides of a right triangle).
:param `length`:
:type `length`: wx.Double
:rtype: `None`
.. method:: __bool__(self)
.. method:: __getitem__(self, idx)
.. method:: __len__(self)
.. method:: __nonzero__(self)
.. method:: __reduce__(self)
.. method:: __repr__(self)
.. method:: __setitem__(self, idx, val)
.. method:: __str__(self)
.. method:: __ne__(self, pt)
Returns the reflection (i.e., negation) of this point.
For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `bool`
.. method:: __iadd__(self, pt)
Returns the reflection (i.e., negation) of this point.
For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `Point2DDouble`
.. method:: __sub__(self)
Returns the reflection (i.e., negation) of this point.
For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).
:rtype: `Point2DDouble`
.. method:: __isub__(self, pt)
Returns the reflection (i.e., negation) of this point.
For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `Point2DDouble`
.. method:: __eq__(self, pt)
Returns the reflection (i.e., negation) of this point.
For example, (2, 4) on a Cartesian coordinate system will become (-2, -4).
:param `pt`:
:type `pt`: Point2DDouble
:rtype: `bool`
.. attribute:: Floor
See :meth:`~wx.Point2D.GetFloor`
.. attribute:: IM
See :meth:`~wx.Point2D.GetIM`
.. attribute:: Rounded
See :meth:`~wx.Point2D.GetRounded`
.. attribute:: VectorAngle
See :meth:`~wx.Point2D.GetVectorAngle` and :meth:`~wx.Point2D.SetVectorAngle`
.. attribute:: VectorLength
See :meth:`~wx.Point2D.GetVectorLength` and :meth:`~wx.Point2D.SetVectorLength`
.. attribute:: m_x
A public C++ attribute of type `~wx.Double` . X coordinate of this point.
.. attribute:: m_y
A public C++ attribute of type `~wx.Double` . Y coordinate of this point.