Annchienta::Point Class Reference

Holds a Point. More...

List of all members.

Public Member Functions

void convert (PointType newtype)
float distance (Point other) const
PointType getPointType () const
bool isEnclosedBy (Point *leftTop, Point *rightBottom)
float noTypeCheckSquaredDistance (Point *other) const
Pointoperator= (const Point &other)
 Point (const Point &other)
 Point (PointType type=TilePoint, float x=0, float y=0, float z=0)
void setType (PointType type)
Point to (PointType newtype) const
 ~Point ()

Public Attributes

float x
float y
float z

Private Attributes

PointType type


Detailed Description

Holds a Point.

This class is used for holding Points. You can manipulate the coordinates directly.

Example:

 import annchienta
 point = annchienta.Point( annchienta.TilePoint, 2, 2 )
 point.x = point.y = point.z = 0

Their are different types of point, I therefore recommend you read the PointType documentation.

Converting between types is easy, just use the to() and convert() functions.

Example:

 import annchienta
 videoManager = annchienta.getVideoManager()
 point = annchienta.Point( annchienta.TilePoint, 2, 2 )
 point.convert( ScreenPoint )
 videoManager.drawLine( point.x, point.y, 0, 0 )

Constructor & Destructor Documentation

Annchienta::Point::Point ( PointType  type = TilePoint,
float  x = 0,
float  y = 0,
float  z = 0 
)

Creates a new Point with the given coordinates. The Z coordinate is not used most of the time. For more information, see PointType

Parameters:
type Type of the Point, see PointType
x X coordinate of the point.
y Y coordinate of the point.
z Z coordinate of the point, not needed in most concrete cases.

Annchienta::Point::Point ( const Point other  ) 

A copy constructor that creates a new Point based on a Point that already exists.

Annchienta::Point::~Point (  ) 


Member Function Documentation

void Annchienta::Point::convert ( PointType  newtype  ) 

This function converts this Point to a Point of another type.

Parameters:
newtype The new PointType for this Point.

float Annchienta::Point::distance ( Point  other  )  const

Calculate the distance to another Point.

Parameters:
other The other Point.
Returns:
The distance to the other Point.

PointType Annchienta::Point::getPointType (  )  const

Returns:
The PointType for this Point.

bool Annchienta::Point::isEnclosedBy ( Point leftTop,
Point rightBottom 
)

Returns True if this Point lies in the rectangular area defined by leftTop and rightBottom. This does not take the Z coordinate into account.

Parameters:
leftTop Left top of the rectangle.
rightBottom Right bottom of the rectangle.

float Annchienta::Point::noTypeCheckSquaredDistance ( Point other  )  const

Returns the squared distance to another Point. This function does not check the other's point type and takes a pointer as argument, making this a very fast (but sometimes unreliable) function.

Parameters:
other The other Point.
Returns:
The distance to the other Point.
Warning:
Only use this if you're sure about the Point types.

Point& Annchienta::Point::operator= ( const Point other  ) 

Assingment operator.

Note:
Not available in Python.

void Annchienta::Point::setType ( PointType  type  ) 

Set the PointType, whithout actually converting the Point. Use convert().

Parameters:
type The new type for this Point.
Note:
Not available in Python.

Point Annchienta::Point::to ( PointType  newtype  )  const

This function is similar to the convert function, but this one will make no changes to this Point, returning a new Point instead.

Parameters:
newtype The new PointType for this Point.
Returns:
A converted Point.


Member Data Documentation


Generated on Wed Feb 4 16:31:47 2009 for Annchienta by  doxygen 1.5.7.1