Stores a single point. More...
| point( ) | |
| point( point p ) | |
| point(int x,int y) | |
| double | distanceTo(point p2) |
| double | distanceToLine(point p1, point p2) |
| double | distanceToLineAbs(point p1, point p2) |
| double | length() |
| void | set(int x, int y) |
| void | setX(int x) |
| void | setY(int y) |
| int | x() |
| int | y() |
A point is a value type for one coordinate: two 32-bit integers x and y in database units. Multiply by databaseunits on drawingField to convert to metres. The usual path from geometry is cell addBox (or another add method) to an element, then getPoints to a pointArray, then point(i) for a vertex. Interactive macros can also wait with getMousePoint on layout; drawingField::point records coordinates for later box, path, or polygon. Distances (distanceTo, distanceToLine, length) are double. Copy, pass, and store a point like a small struct; it is not a window object and has no parent pointer.
Example:
point p(10000, 20000);
p.setX(15000);
int x = p.x();
int y = p.y();
double d = p.distanceTo(point(0, 0));
Creates a point at the origin (0, 0).
Creates a point containing a copy of p.
Constructs a point with coordinates x and y.
Returns: the Euclidean distance to p2, in database units.
Returns: the shortest distance to the infinite line through p1 and p2. The value is negative if this point is to the left of the directed segment from p1 to p2.
| Parameter: | |
|---|---|
| p1 | p1 |
| p2 | p2 |
Returns: the shortest distance to the line through p1 and p2. The value is always positive or zero.
| Parameter: | |
|---|---|
| p1 | p1 |
| p2 | p2 |
Returns: the distance from this point to the origin.
Sets both the x and y coordinates.
Sets the x coordinate.
Sets the y coordinate.
Returns: the x coordinate of the point.
Returns: the y coordinate of the point.