Stefan Schuermans
implement scaling
Stefan Schuermans commited 5dbde65 at 2013-07-06 20:31:45
/* drawing (DXF) to G-code (NGC) converter
* Copyright 2013 Stefan Schuermans <stefan@schuermans.info>
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
*/
#ifndef POINT_H
#define POINT_H
/// point in 2D space
class Point {
public:
Point();
Point(double x, double y);
double abs_sq() const;
double abs() const;
Point operator-() const;
Point operator+(const Point &that) const;
Point operator-(const Point &that) const;
Point operator*(double factor) const;
Point operator/(double factor) const;
Point &operator+=(const Point &that);
Point &operator-=(const Point &that);
Point &operator*=(double factor);
Point &operator/=(double factor);
/**
* @brief check if point is equal to another one
* @param[in] that other point
* @param[in] eqDist maximum distance of two points to be considered equal
*/
bool equals(const Point &that, double eqDist) const;
/**
* @brief rotate around origin
* @param[in] rad angle in radians
* @return rotated point
*/
Point rotate(double rad) const;
/**
* @brief scale differently in X and Y direction
* @param[in] fx scale factor in X direction
* @param[in] fy scale factor in Y direction
* @return scaled point
*/
Point scale_xy(double fx, double fy) const;
double mX; ///< x coordinate
double mY; ///< y coordinate
};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX