next up previous contents index
Next: Double Line Segments ( Up: Simple Geometry Previous: Integer Rectangles ( IRect   Contents   Index


Double Points ( DPoint )

Definition

An instance dp of type DPoint is a point (a, b), where a and b are doubles. We call a the x-coordinate of dp and b the y-coordinate of dp.

#include < AGD/DPoint.h >

Creation

DPoint dp creates an instance dp of type DPoint initialized to the point (0, 0).

DPoint dp(double x, double y) creates an instance dp of type DPoint initialized to the point (x, y).

DPoint dp(const DPoint& p) creates an instance dp of type DPoint initialized to the point dp.

Operations

double dp.xcoord() returns the x-coordinate of dp.

double dp.ycoord() returns the y-coordinate of dp.

void dp.xcoord(double x) sets the x-coordinate of dp to x.

void dp.ycoord(double y) sets the y-coordinate of dp to y.

DPoint& dp.inc_x(double dx) increments the x-coordinate of dp by dx. Returns a reference to dp.

DPoint& dp.inc_y(double dy) increments the y-coordinate of dp by dy. Returns a reference to dp.

bool dp == const DPoint& p Test for equality.

bool dp != const DPoint& p Test for inequality.

DPoint dp + const DPoint& dp1 returns the addition (of coordinates).

DPoint dp - const DPoint& dp1 returns the subtraction (of coordinates).

DPoint& dp += const DPoint& dp1 adds dp1 to dp. Returns a reference to dp.

DPoint& dp -= const DPoint& dp1 subtracts dp1 from dp. Returns a reference to dp.

DPoint double x * const DPoint& dp
    returns the multiplication of dp with the scalar x.

ostream& ostream& O << const DPoint& dp
    writes dp to output stream O.

istream& istream& I >> DPoint& dp reads the coordinates of dp (two double numbers) from input stream I.


next up previous contents index
Next: Double Line Segments ( Up: Simple Geometry Previous: Integer Rectangles ( IRect   Contents   Index

© Copyright 1998-2001, Algorithmic Solutions Software GmbH. All rights reserved.
2001-08-13