Point

class Point

a point or vector in 3D space specified by its coordinates (x, y, z)

Subclassed by ocl::CCPoint, ocl::CLPoint

Public Functions

Point()

create a point at (0,0,0)

Point(double x, double y, double z)

create a point at (x,y,z)

Point(double x, double y)

create a point at (x,y,0)

Point(const Point &p)

create a point at p

inline virtual ~Point()

destructor. empty.

double dot(const Point &p) const

dot product

Point cross(const Point &p) const

cross product

double norm() const

norm of vector, or distance from (0,0,0) to *this

void normalize()

scales vector so that norm()==1.0

double xyDistance(const Point &p) const

distance from Point to another Point p in the XY plane

double xyNorm() const

length of vector in the XY plane

void xyNormalize()

normalize so that length xyNorm == 1.0

Point xyPerp() const

return perpendicular in the xy plane, rotated 90 degree to the left

void z_projectOntoEdge(const Point &p1, const Point &p2)

move *this along z-axis so it lies on p1-p2 line-segment

void xyRotate(double cosa, double sina)

rotate point in the xy-plane by angle theta inputs are cos(theta) and sin(theta)

void xyRotate(double angle)

rotate point in xy-plane bu angle theta (radians or degrees??)

void xRotate(double theta)

rotate around x-axis

void yRotate(double theta)

rotate around y-axis

void zRotate(double theta)

rotate around z-axis

double xyDistanceToLine(const Point &p1, const Point &p2) const

distance from Point to infinite line through p1 and p2. In the XY plane.

Point closestPoint(const Point &p1, const Point &p2) const

return closest Point to line through p1 and p2. in 3D.

return Point on p1-p2 line which is closest in 3D to this.

Point xyClosestPoint(const Point &p1, const Point &p2) const

return closest Point to line through p1 and p2. Works in the XY plane.

return Point on p1-p2 line which is closest in XY-plane to this

bool isRight(const Point &p1, const Point &p2) const

returns true if point is right of line through p1 and p2 (works in the XY-plane)

bool isInside(const Triangle &t) const

returns true if Point *this is inside Triangle t

bool isInside(const Point &p1, const Point &p2) const

return true if Point within line segment p1-p2

bool xParallel() const

return true if the x and y components are both zero.

bool yParallel() const

return true if vector parallel to y-axis

bool zParallel() const

return true if vector parallel to z-axis

Point &operator=(const Point &p)

assignment

Point &operator+=(const Point &p)

addition

Point &operator-=(const Point &p)

subtraction

const Point operator+(const Point &p) const

addition

const Point operator-(const Point &p) const

subtraction

Point &operator*=(const double &a)

scalar multiplication

const Point operator*(const double &a) const

Point * scalar.

bool operator==(const Point &p) const

equality

bool operator!=(const Point &p) const

inequality

std::string str() const

string repr

Public Members

double x

X coordinate.

double y

Y coordinate.

double z

Z coordinate.

Friends

friend std::ostream &operator<<(std::ostream &stream, const Point &p)

string repr