BPoint Class Reference

#include <Point.h>

List of all members.


Detailed Description

BPoint objects represent points on a two-dimensional coordinate grid.

See also:
Using BPoint

Data Members

float x
The coordinate value measured horizontally along the x-axis.
float y
The coordinate value measured vertically along the y-axis.


Public Member Functions

 BPoint ()
 BPoint (float X, float Y)
 BPoint (const BPoint &pt)
BPointoperator= (const BPoint &from)
void Set (float X, float Y)
void ConstrainTo (BRect rect)
void PrintToStream () const
BPoint operator- () const
BPoint operator+ (const BPoint &) const
BPoint operator- (const BPoint &) const
BPointoperator+= (const BPoint &)
BPointoperator-= (const BPoint &)
BPoint operator * (const float f) const
BPoint operator/ (const float f) const
BPointoperator *= (const float f)
BPointoperator/= (const float f)
bool operator!= (const BPoint &) const
bool operator== (const BPoint &) const

Public Attributes

float x
float y


Constructor & Destructor Documentation

BPoint  )  [inline]
 

BPoint float  X,
float  Y
[inline]
 

BPoint const BPoint pt  )  [inline]
 


Member Function Documentation

void ConstrainTo BRect  rect  ) 
 

Ensures that the BPoint lies within rect. If it's already contained in the rectangle, the BPoint is unchanged; otherwise, it's moved to the rect's nearest edge.

Parameters:
rect Rectangle to test
See also:
BRect::Contains()

BPoint operator * const float  f  )  const
 

BPoint & operator *= const float  f  ) 
 

bool operator!= const BPoint pt  )  const
 

Inequality operator.

Parameters:
pt Point to test
Returns:
true if the two objects' points don't coincide.

BPoint operator+ const BPoint pt  )  const
 

Addition operator.

Creates and returns a new BPoint that adds the two operands together. The new object's x coordinate is the sum of the operands' x values; its y value is the sum of the operands' y values.

Parameters:
pt Point add to Point

BPoint & operator+= const BPoint pt  ) 
 

Addition and assignment operator

Adds the operands together and stores the result in the left operand.

Parameters:
pt Operand to add

BPoint operator- const BPoint pt  )  const
 

Subtraction operator.

Creates and returns a new BPoint that subtracts the right operand from the left. The new object's x coordinate is the difference between the operands' x values; its y value is the difference between the operands' y values.

Parameters:
pt Point to subtract
Returns:
A new Point wit the subtraction result

BPoint operator-  )  const
 

BPoint & operator-= const BPoint pt  ) 
 

Subtraction and assignment operator

Performs the subtraction and stores the result in the left operand.

Parameters:
pt Point to subtract
Returns:
Pont with subraction result

BPoint operator/ const float  f  )  const
 

BPoint & operator/= const float  f  ) 
 

BPoint & operator= const BPoint from  )  [inline]
 

bool operator== const BPoint pt  )  const
 

Equality operator.

Parameters:
pt Point to test
Returns:
true if the two objects' point exactly coincide.

void PrintToStream void   )  const
 

Prints the BPoint's coordinates to standard output in the form:

BPoint(x, y)

void Set float  X,
float  Y
[inline]
 


Member Data Documentation

float x
 

float y
 


Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.