Panda3D
Public Member Functions | Static Public Member Functions

Point2 Class Reference

This is a two-component point in space. More...

Inheritance diagram for Point2:
VBase2

List of all members.

Public Member Functions

 Point2 ()
 Point2 (VBase2 const copy)
 Point2 (float x, float y)
 Point2 (float fill_value)
unsigned int addHash (unsigned int hash)
 Adds the vector into the running hash.
unsigned int addHash (unsigned int hash, float threshold)
 Adds the vector into the running hash.
 addToCell (int i, float value)
 addX (float value)
 addY (float value)
bool almostEqual (VBase2 const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (VBase2 const other, float threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo (VBase2 const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo (VBase2 const other, float threshold)
 Sorts vectors lexicographically, componentwise.
float dot (VBase2 const other)
 fill (float fill_value)
 Sets each element of the vector to the indicated fill_value.
VBase2 fmax (VBase2 const other)
VBase2 fmin (VBase2 const other)
PyObject getattr (string attr_name)
 This is used to implement swizzle masks.
float getCell (int i)
 getData ()
 Returns the address of the first of the two data elements in the vector.
unsigned int getHash ()
 Returns a suitable hash for phash_map.
unsigned int getHash (float threshold)
 Returns a suitable hash for phash_map.
int getNumComponents ()
 Returns the number of elements in the vector, two.
float getX ()
float getY ()
bool isNan ()
 Returns true if any component of the vector is not-a-number, false otherwise.
float length ()
 Returns the length of the vector, by the Pythagorean theorem.
float lengthSquared ()
 Returns the square of the vector's length, cheap and easy.
bool normalize ()
 Normalizes the vector in place.
 operator new (unsigned int size)
bool operator!= (VBase2 const other)
Point2 operator* (float scalar)
VBase2 operator*= (float scalar)
VBase2 operator+ (VBase2 const other)
Point2 operator+ (Vec2 const other)
VBase2 operator+= (VBase2 const other)
Point2 operator- ()
Vec2 operator- (Point2 const other)
VBase2 operator- (VBase2 const other)
Point2 operator- (Vec2 const other)
VBase2 operator-= (VBase2 const other)
Point2 operator/ (float scalar)
VBase2 operator/= (float scalar)
bool operator< (VBase2 const other)
 This performs a lexicographical comparison.
Point2 operator= (VBase2 const copy)
Point2 operator= (float fill_value)
bool operator== (VBase2 const other)
 operator[] (int i)
float operator[] (int i)
 output (ostream out)
Point2 project (VBase2 const onto)
 Returns a new vector representing the projection of this vector onto another one.
 pythonRepr (ostream out, string class_name)
PyObject reduce (PyObject self)
 This special Python method is implement to provide support for the pickle module.
 set (float x, float y)
int setattr (PyObject self, string attr_name, PyObject assign)
 This is used to implement write masks.
 setCell (int i, float value)
 setitem (int i, float v)
 setX (float value)
 setY (float value)

Static Public Member Functions

static TypeHandle getClassType ()
static int size ()
 Returns 2: the number of components of a LVecBase2.
static Point2 const unitX ()
 Returns a unit X point.
static Point2 const unitY ()
 Returns a unit Y point.
static Point2 const zero ()
 Returns a zero-length point.

Detailed Description

This is a two-component point in space.


Constructor & Destructor Documentation

Point2 ( )
Point2 ( VBase2 const  copy)
Point2 ( float  fill_value)
Point2 ( float  x,
float  y 
)

Member Function Documentation

unsigned int addHash ( unsigned int  hash) [inherited]

Adds the vector into the running hash.

unsigned int addHash ( unsigned int  hash,
float  threshold 
) [inherited]

Adds the vector into the running hash.

addToCell ( int  i,
float  value 
) [inherited]
addX ( float  value) [inherited]
addY ( float  value) [inherited]
bool almostEqual ( VBase2 const  other) [inherited]

Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.

bool almostEqual ( VBase2 const  other,
float  threshold 
) [inherited]

Returns true if two vectors are memberwise equal within a specified tolerance.

int compareTo ( VBase2 const  other) [inherited]

This flavor of compare_to uses a default threshold value based on the numeric type.

int compareTo ( VBase2 const  other,
float  threshold 
) [inherited]

Sorts vectors lexicographically, componentwise.

Returns a number less than 0 if this vector sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent (within the indicated tolerance).

float dot ( VBase2 const  other) [inherited]
fill ( float  fill_value) [inherited]

Sets each element of the vector to the indicated fill_value.

This is particularly useful for initializing to zero.

VBase2 fmax ( VBase2 const  other) [inherited]
VBase2 fmin ( VBase2 const  other) [inherited]
PyObject getattr ( string  attr_name)

This is used to implement swizzle masks.

Reimplemented from VBase2.

float getCell ( int  i) [inherited]
static TypeHandle getClassType ( ) [static]

Reimplemented from VBase2.

getData ( ) [inherited]

Returns the address of the first of the two data elements in the vector.

The next element occupies the next position consecutively in memory.

unsigned int getHash ( ) [inherited]

Returns a suitable hash for phash_map.

unsigned int getHash ( float  threshold) [inherited]

Returns a suitable hash for phash_map.

int getNumComponents ( ) [inherited]

Returns the number of elements in the vector, two.

float getX ( ) [inherited]
float getY ( ) [inherited]
bool isNan ( ) [inherited]

Returns true if any component of the vector is not-a-number, false otherwise.

float length ( ) [inherited]

Returns the length of the vector, by the Pythagorean theorem.

float lengthSquared ( ) [inherited]

Returns the square of the vector's length, cheap and easy.

bool normalize ( ) [inherited]

Normalizes the vector in place.

Returns true if the vector was normalized, false if it was a zero-length vector.

operator new ( unsigned int  size) [inherited]
bool operator!= ( VBase2 const  other) [inherited]
Point2 operator* ( float  scalar)

Reimplemented from VBase2.

VBase2 operator*= ( float  scalar) [inherited]
VBase2 operator+ ( VBase2 const  other)

Reimplemented from VBase2.

Point2 operator+ ( Vec2 const  other)
VBase2 operator+= ( VBase2 const  other) [inherited]
Point2 operator- ( )

Reimplemented from VBase2.

Vec2 operator- ( Point2 const  other)
VBase2 operator- ( VBase2 const  other)

Reimplemented from VBase2.

Point2 operator- ( Vec2 const  other)
VBase2 operator-= ( VBase2 const  other) [inherited]
Point2 operator/ ( float  scalar)

Reimplemented from VBase2.

VBase2 operator/= ( float  scalar) [inherited]
bool operator< ( VBase2 const  other) [inherited]

This performs a lexicographical comparison.

It's of questionable mathematical meaning, but sometimes has a practical purpose for sorting unique vectors, especially in an STL container. Also see compare_to().

Point2 operator= ( VBase2 const  copy)

Reimplemented from VBase2.

Point2 operator= ( float  fill_value)

Reimplemented from VBase2.

bool operator== ( VBase2 const  other) [inherited]
float operator[] ( int  i) [inherited]
operator[] ( int  i) [inherited]
output ( ostream  out) [inherited]
Point2 project ( VBase2 const  onto)

Returns a new vector representing the projection of this vector onto another one.

The resulting vector will be a scalar multiple of onto.

Reimplemented from VBase2.

pythonRepr ( ostream  out,
string  class_name 
)

Reimplemented from VBase2.

PyObject reduce ( PyObject  self) [inherited]

This special Python method is implement to provide support for the pickle module.

set ( float  x,
float  y 
) [inherited]
int setattr ( PyObject  self,
string  attr_name,
PyObject  assign 
)

This is used to implement write masks.

Reimplemented from VBase2.

setCell ( int  i,
float  value 
) [inherited]
setitem ( int  i,
float  v 
) [inherited]
setX ( float  value) [inherited]
setY ( float  value) [inherited]
static int size ( ) [static, inherited]

Returns 2: the number of components of a LVecBase2.

static Point2 const unitX ( ) [static]

Returns a unit X point.

Reimplemented from VBase2.

static Point2 const unitY ( ) [static]

Returns a unit Y point.

Reimplemented from VBase2.

static Point2 const zero ( ) [static]

Returns a zero-length point.

Reimplemented from VBase2.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties