Main Page | Namespace List | Class List | File List | Namespace Members | Class Members

grid::Point Struct Reference

A class represent a point in a 2-dimensional space. More...

#include <grid.hh>

List of all members.

Public Member Functions

 Point ()
 Create a point.

 Point (float x, float y)
 Create a point (x, y).

Pointrot90 ()
 Rotate the point 90 degrees.

Point get_rot90 () const
 Return the point rotated 90 degrees.

float dot (const Point &p) const
 Compute dot product.

Pointadd (const Point &p, float scale=1)
 Add another point to the point.

Point get_add (const Point &p, float scale=1) const
 Return the result of adding another point from the point.

Pointsub (const Point &p, float scale=1)
 Substract another point from the point.

Point get_sub (const Point &p, float scale=1) const
 Return the result of subtracting another point from the point.

Pointscale (float scale)
 Scale the point.

float angle () const
 Compute the angle of the vector in radians.

float length () const
 Compute the length of the vector.

Pointnormalize (float length)
 Normalize the length of the vector.


Public Attributes

float x
 Coordinate of the point.

float y
 Coordinate of the point.


Detailed Description

A class represent a point in a 2-dimensional space.


Constructor & Destructor Documentation

grid::Point::Point float  x,
float  y
[inline]
 

Create a point (x, y).

Parameters:
x = the x-coordinate
y = the y-coordinate


Member Function Documentation

Point& grid::Point::add const Point p,
float  scale = 1
[inline]
 

Add another point to the point.

Parameters:
p = the point to add
scale = the scale for p

float grid::Point::angle  )  const [inline]
 

Compute the angle of the vector in radians.

Note:
The angle of (0,0) is also defined. See the man page of atan2 for details.
Returns:
= the angle

float grid::Point::dot const Point p  )  const [inline]
 

Compute dot product.

Parameters:
p = the point to compute the dot product with
Returns:
the dot product

Point grid::Point::get_add const Point p,
float  scale = 1
const [inline]
 

Return the result of adding another point from the point.

Parameters:
p = the point to add
scale = the scale for p

Point grid::Point::get_rot90  )  const [inline]
 

Return the point rotated 90 degrees.

Returns:
The original point rotated 90 degrees.

Point grid::Point::get_sub const Point p,
float  scale = 1
const [inline]
 

Return the result of subtracting another point from the point.

Parameters:
p = the point to substract
scale = the scale for p

float grid::Point::length  )  const [inline]
 

Compute the length of the vector.

Returns:
the length

Point& grid::Point::normalize float  length  )  [inline]
 

Normalize the length of the vector.

Parameters:
length = the new length of the vector

Point& grid::Point::scale float  scale  )  [inline]
 

Scale the point.

Parameters:
scale = the scale

Point& grid::Point::sub const Point p,
float  scale = 1
[inline]
 

Substract another point from the point.

Parameters:
p = the point to substract
scale = the scale for p


The documentation for this struct was generated from the following file:
Generated on Wed Feb 16 08:42:26 2005 for Gocam by doxygen 1.3.4