+++ /dev/null
-#ifndef __CIRCLE_H__
-#define __CIRCLE_H__
-
-#include "atomicentity.h"
-
-/**
- * Holds the data that defines a circle.
- */
-class CircleData
-{
- public:
- CircleData()
- {
- }
-
- CircleData(const Vector & center, double radius)
- {
- this->center = center;
- this->radius = radius;
- }
-
- void reset()
- {
- center = Vector(false);
- radius = 0.0;
- }
-
- bool isValid()
- {
- return (center.valid && radius > RS_TOLERANCE);
- }
-
- friend class Circle;
-
- friend std::ostream & operator<<(std::ostream & os, const CircleData & ad)
- {
- os << "(" << ad.center << "/" << ad.radius << ")";
- return os;
- }
-
- public:
- Vector center;
- double radius;
-};
-
-/**
- * Class for a circle entity.
- *
- * @author Andrew Mustun
- */
-class Circle: public AtomicEntity
-{
- public:
- Circle(EntityContainer * parent, const CircleData & d);
- virtual ~Circle();
-
- virtual Entity * clone();
- virtual RS2::EntityType rtti() const;
- virtual bool isEdge() const;
- CircleData getData();
- virtual VectorSolutions getRefPoints();
- virtual Vector getStartpoint() const;
- virtual Vector getEndpoint() const;
- double getDirection1() const;
- double getDirection2() const;
- Vector getCenter();
- void setCenter(const Vector & c);
- double getRadius();
- void setRadius(double r);
- double getAngleLength() const;
- virtual double getLength();
-
- bool createFromCR(const Vector & c, double r);
- bool createFrom2P(const Vector & p1, const Vector & p2);
- bool createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3);
- virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true,
- double * dist = NULL, Entity ** entity = NULL);
- virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
- virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
- virtual Vector getNearestDist(double distance, bool startp);
- virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
-
- virtual void move(Vector offset);
- virtual void rotate(Vector center, double angle);
- virtual void scale(Vector center, Vector factor);
- virtual void mirror(Vector axisPoint1, Vector axisPoint2);
- virtual void moveRef(const Vector & ref, const Vector & offset);
- virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
-
- friend std::ostream & operator<<(std::ostream & os, const Circle & a);
-
- virtual void calculateBorders();
-
- protected:
- CircleData data;
-};
-
-#endif