Panda3D
Public Member Functions | Static Public Member Functions

Point3 Class Reference

This is a three-component point in space (as opposed to a three-component vector, which represents a direction and a distance). More...

Inheritance diagram for Point3:
VBase3

List of all members.

Public Member Functions

 Point3 ()
 Point3 (VBase3 const copy)
 Point3 (float x, float y, float z)
 Point3 (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)
 addZ (float value)
bool almostEqual (VBase3 const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (VBase3 const other, float threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo (VBase3 const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo (VBase3 const other, float threshold)
 Sorts vectors lexicographically, componentwise.
Point3 cross (VBase3 const other)
 crossInto (VBase3 const other)
float dot (VBase3 const other)
 fill (float fill_value)
 Sets each element of the vector to the indicated fill_value.
VBase3 fmax (VBase3 const other)
VBase3 fmin (VBase3 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 three data elements in the vector.
unsigned int getHash (float threshold)
 Returns a suitable hash for phash_map.
unsigned int getHash ()
 Returns a suitable hash for phash_map.
int getNumComponents ()
 Returns the number of elements in the vector, three.
VBase3 getStandardizedHpr ()
 Try to un-spin the hpr to a standard form.
float getX ()
Point2 getXy ()
 Returns a 2-component vector that shares just the first two components of this vector.
Point2 getXz ()
 Returns a 2-component vector that shares just the first and last components of this vector.
float getY ()
Point2 getYz ()
 Returns a 2-component vector that shares just the last two components of this vector.
float getZ ()
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!= (VBase3 const other)
Point3 operator* (float scalar)
VBase3 operator*= (float scalar)
VBase3 operator+ (VBase3 const other)
Point3 operator+ (Vec3 const other)
VBase3 operator+= (VBase3 const other)
Point3 operator- (Vec3 const other)
VBase3 operator- (VBase3 const other)
Vec3 operator- (Point3 const other)
Point3 operator- ()
VBase3 operator-= (VBase3 const other)
Point3 operator/ (float scalar)
VBase3 operator/= (float scalar)
bool operator< (VBase3 const other)
 This performs a lexicographical comparison.
Point3 operator= (VBase3 const copy)
Point3 operator= (float fill_value)
bool operator== (VBase3 const other)
float operator[] (int i)
 operator[] (int i)
 output (ostream out)
Point3 project (VBase3 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, float z)
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)
 setZ (float value)

Static Public Member Functions

static TypeHandle getClassType ()
static Point3 origin (CoordinateSystem cs)
 Returns the origin of the indicated coordinate system.
static Point3 origin ()
 Returns the origin of the indicated coordinate system.
static Point3 rfu (float right, float fwd, float up)
 Returns a point described by right, forward, up displacements from the origin, wherever that maps to in the given coordinate system.
static Point3 rfu (float right, float fwd, float up, CoordinateSystem cs)
 Returns a point described by right, forward, up displacements from the origin, wherever that maps to in the given coordinate system.
static int size ()
 Returns 3: the number of components of a LVecBase3.
static Point3 const unitX ()
 Returns a unit X point.
static Point3 const unitY ()
 Returns a unit Y point.
static Point3 const unitZ ()
 Returns a unit Z point.
static Point3 const zero ()
 Returns a zero-length point.

Detailed Description

This is a three-component point in space (as opposed to a three-component vector, which represents a direction and a distance).

Some of the methods are slightly different between LPoint3 and LVector3; in particular, subtraction of two points yields a vector, while addition of a vector and a point yields a point.


Constructor & Destructor Documentation

Point3 ( )
Point3 ( VBase3 const  copy)
Point3 ( float  fill_value)
Point3 ( float  x,
float  y,
float  z 
)

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]
addZ ( float  value) [inherited]
bool almostEqual ( VBase3 const  other) [inherited]

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

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

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

int compareTo ( VBase3 const  other) [inherited]

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

int compareTo ( VBase3 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).

Point3 cross ( VBase3 const  other)

Reimplemented from VBase3.

crossInto ( VBase3 const  other) [inherited]
float dot ( VBase3 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.

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

This is used to implement swizzle masks.

Reimplemented from VBase3.

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

Reimplemented from VBase3.

getData ( ) [inherited]

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

The remaining elements occupy the next positions 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, three.

VBase3 getStandardizedHpr ( ) [inherited]

Try to un-spin the hpr to a standard form.

Like all standards, someone decides between many arbitrary possible standards. This function assumes that 0 and 360 are the same, as is 720 and -360. Also 180 and -180 are the same. Another example is -90 and 270. Each element will be in the range -180.0 to 179.99999. The original usage of this function is for human readable output.

It doesn't work so well for asserting that foo_hpr is roughly equal to bar_hpr. Try using LQuaternionf.is_same_direction() for that. See Also: get_standardized_rotation, LQuaternion.is_same_direction

float getX ( ) [inherited]
Point2 getXy ( )

Returns a 2-component vector that shares just the first two components of this vector.

Reimplemented from VBase3.

Point2 getXz ( )

Returns a 2-component vector that shares just the first and last components of this vector.

Reimplemented from VBase3.

float getY ( ) [inherited]
Point2 getYz ( )

Returns a 2-component vector that shares just the last two components of this vector.

Reimplemented from VBase3.

float getZ ( ) [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!= ( VBase3 const  other) [inherited]
Point3 operator* ( float  scalar)

Reimplemented from VBase3.

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

Reimplemented from VBase3.

Point3 operator+ ( Vec3 const  other)
VBase3 operator+= ( VBase3 const  other) [inherited]
Point3 operator- ( Vec3 const  other)
VBase3 operator- ( VBase3 const  other)

Reimplemented from VBase3.

Point3 operator- ( )

Reimplemented from VBase3.

Vec3 operator- ( Point3 const  other)
VBase3 operator-= ( VBase3 const  other) [inherited]
Point3 operator/ ( float  scalar)

Reimplemented from VBase3.

VBase3 operator/= ( float  scalar) [inherited]
bool operator< ( VBase3 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().

Point3 operator= ( float  fill_value)

Reimplemented from VBase3.

Point3 operator= ( VBase3 const  copy)

Reimplemented from VBase3.

bool operator== ( VBase3 const  other) [inherited]
operator[] ( int  i) [inherited]
float operator[] ( int  i) [inherited]
static Point3 origin ( ) [static]

Returns the origin of the indicated coordinate system.

This is always 0, 0, 0 with all of our existing coordinate systems; it's hard to imagine it ever being different.

static Point3 origin ( CoordinateSystem  cs) [static]

Returns the origin of the indicated coordinate system.

This is always 0, 0, 0 with all of our existing coordinate systems; it's hard to imagine it ever being different.

output ( ostream  out) [inherited]
Point3 project ( VBase3 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 VBase3.

pythonRepr ( ostream  out,
string  class_name 
)

Reimplemented from VBase3.

PyObject reduce ( PyObject  self) [inherited]

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

static Point3 rfu ( float  right,
float  fwd,
float  up,
CoordinateSystem  cs 
) [static]

Returns a point described by right, forward, up displacements from the origin, wherever that maps to in the given coordinate system.

static Point3 rfu ( float  right,
float  fwd,
float  up 
) [static]

Returns a point described by right, forward, up displacements from the origin, wherever that maps to in the given coordinate system.

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

This is used to implement write masks.

Reimplemented from VBase3.

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

Returns 3: the number of components of a LVecBase3.

static Point3 const unitX ( ) [static]

Returns a unit X point.

Reimplemented from VBase3.

static Point3 const unitY ( ) [static]

Returns a unit Y point.

Reimplemented from VBase3.

static Point3 const unitZ ( ) [static]

Returns a unit Z point.

Reimplemented from VBase3.

static Point3 const zero ( ) [static]

Returns a zero-length point.

Reimplemented from VBase3.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties