/**
* Default constructor.
*/
-RS_Circle::RS_Circle(RS_EntityContainer * parent, const RS_CircleData & d):
- RS_AtomicEntity(parent), data(d)
+Circle::Circle(EntityContainer * parent, const CircleData & d):
+ AtomicEntity(parent), data(d)
{
calculateBorders();
}
-/*virtual*/ RS_Circle::~RS_Circle()
+/*virtual*/ Circle::~Circle()
{
}
-/*virtual*/ RS_Entity * RS_Circle::clone()
+/*virtual*/ Entity * Circle::clone()
{
- RS_Circle * c = new RS_Circle(*this);
+ Circle * c = new Circle(*this);
c->initId();
return c;
}
/** @return RS2::EntityCircle */
-/*virtual*/ RS2::EntityType RS_Circle::rtti() const
+/*virtual*/ RS2::EntityType Circle::rtti() const
{
return RS2::EntityCircle;
}
/** @return true */
-/*virtual*/ bool RS_Circle::isEdge() const
+/*virtual*/ bool Circle::isEdge() const
{
return true;
}
/** @return Copy of data that defines the circle. **/
-RS_CircleData RS_Circle::getData()
+CircleData Circle::getData()
{
return data;
}
-VectorSolutions RS_Circle::getRefPoints()
+VectorSolutions Circle::getRefPoints()
{
Vector v1(data.radius, 0.0);
Vector v2(0.0, data.radius);
return ret;
}
-/*virtual*/ Vector RS_Circle::getStartpoint() const
+/*virtual*/ Vector Circle::getStartpoint() const
{
return data.center + Vector(data.radius, 0.0);
}
-/*virtual*/ Vector RS_Circle::getEndpoint() const
+/*virtual*/ Vector Circle::getEndpoint() const
{
return data.center + Vector(data.radius, 0.0);
}
* @return Direction 1. The angle at which the arc starts at
* the startpoint.
*/
-double RS_Circle::getDirection1() const
+double Circle::getDirection1() const
{
return M_PI / 2.0;
}
* @return Direction 2. The angle at which the arc starts at
* the endpoint.
*/
-double RS_Circle::getDirection2() const
+double Circle::getDirection2() const
{
return M_PI / 2.0 * 3.0;
}
/** @return The center point (x) of this arc */
-Vector RS_Circle::getCenter()
+Vector Circle::getCenter()
{
return data.center;
}
/** Sets new center. */
-void RS_Circle::setCenter(const Vector & c)
+void Circle::setCenter(const Vector & c)
{
data.center = c;
}
/** @return The radius of this arc */
-double RS_Circle::getRadius()
+double Circle::getRadius()
{
return data.radius;
}
/** Sets new radius. */
-void RS_Circle::setRadius(double r)
+void Circle::setRadius(double r)
{
data.radius = r;
}
-void RS_Circle::calculateBorders()
+void Circle::calculateBorders()
{
Vector r(data.radius, data.radius, 0.0);
minV = data.center - r;
/**
* @return Angle length in rad.
*/
-double RS_Circle::getAngleLength() const
+double Circle::getAngleLength() const
{
return 2 * M_PI;
}
/**
* @return Length of the circle which is the circumference.
*/
-double RS_Circle::getLength()
+double Circle::getLength()
{
return 2 * M_PI * data.radius;
}
* @param c Center.
* @param r Radius
*/
-bool RS_Circle::createFromCR(const Vector & c, double r)
+bool Circle::createFromCR(const Vector & c, double r)
{
if (fabs(r) > RS_TOLERANCE)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFromCR(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFromCR(): "
"Cannot create a circle with radius 0.0.");
return false;
}
* @param p1 1st point.
* @param p2 2nd point.
*/
-bool RS_Circle::createFrom2P(const Vector & p1, const Vector & p2)
+bool Circle::createFrom2P(const Vector & p1, const Vector & p2)
{
if (p1.distanceTo(p2) > RS_TOLERANCE)
{
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom2P(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFrom2P(): "
"Cannot create a circle with radius 0.0.");
return false;
}
* @param p2 2nd point.
* @param p3 3rd point.
*/
-bool RS_Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3)
+bool Circle::createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3)
{
if (p1.distanceTo(p2) > RS_TOLERANCE
&& p2.distanceTo(p3) > RS_TOLERANCE
a2 = p2.angleTo(p3) + M_PI / 2.0;
dir2.setPolar(100.0, a2);
- RS_ConstructionLineData d1(mp1, mp1 + dir1);
- RS_ConstructionLineData d2(mp2, mp2 + dir2);
- RS_ConstructionLine midLine1(NULL, d1);
- RS_ConstructionLine midLine2(NULL, d2);
+ ConstructionLineData d1(mp1, mp1 + dir1);
+ ConstructionLineData d2(mp2, mp2 + dir2);
+ ConstructionLine midLine1(NULL, d1);
+ ConstructionLine midLine2(NULL, d2);
VectorSolutions sol =
- RS_Information::getIntersection(&midLine1, &midLine2);
+ Information::getIntersection(&midLine1, &midLine2);
data.center = sol.get(0);
data.radius = data.center.distanceTo(p3);
return true;
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): "
"Cannot create a circle with inf radius.");
return false;
}
}
else
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "RS_Circle::createFrom3P(): "
+ DEBUG->print(Debug::D_WARNING, "Circle::createFrom3P(): "
"Cannot create a circle with radius 0.0.");
return false;
}
/**
* @return Always an invalid vector.
*/
-Vector RS_Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist)
+Vector Circle::getNearestEndpoint(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, RS_Entity ** entity)
+Vector Circle::getNearestPointOnEntity(const Vector & coord, bool /*onEntity*/, double * dist, Entity ** entity)
{
Vector vec(false);
return vec;
}
-Vector RS_Circle::getNearestCenter(const Vector & coord, double * dist)
+Vector Circle::getNearestCenter(const Vector & coord, double * dist)
{
if (dist != NULL)
*dist = coord.distanceTo(data.center);
return data.center;
}
-Vector RS_Circle::getNearestMiddle(const Vector & /*coord*/, double * dist)
+Vector Circle::getNearestMiddle(const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
+Vector Circle::getNearestDist(double /*distance*/, const Vector & /*coord*/, double * dist)
{
if (dist != NULL)
*dist = RS_MAXDOUBLE;
return Vector(false);
}
-Vector RS_Circle::getNearestDist(double /*distance*/, bool /*startp*/)
+Vector Circle::getNearestDist(double /*distance*/, bool /*startp*/)
{
return Vector(false);
}
-double RS_Circle::getDistanceToPoint(const Vector & coord, RS_Entity * * entity, RS2::ResolveLevel, double)
+double Circle::getDistanceToPoint(const Vector & coord, Entity * * entity, RS2::ResolveLevel, double)
{
if (entity != NULL)
*entity = this;
return fabs((coord - data.center).magnitude() - data.radius);
}
-void RS_Circle::move(Vector offset)
+void Circle::move(Vector offset)
{
data.center.move(offset);
calculateBorders();
}
-void RS_Circle::rotate(Vector center, double angle)
+void Circle::rotate(Vector center, double angle)
{
data.center.rotate(center, angle);
calculateBorders();
}
-void RS_Circle::scale(Vector center, Vector factor)
+void Circle::scale(Vector center, Vector factor)
{
data.center.scale(center, factor);
data.radius *= factor.x;
calculateBorders();
}
-void RS_Circle::mirror(Vector axisPoint1, Vector axisPoint2)
+void Circle::mirror(Vector axisPoint1, Vector axisPoint2)
{
data.center.mirror(axisPoint1, axisPoint2);
calculateBorders();
}
-void RS_Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
+void Circle::draw(PaintInterface * painter, GraphicView * view, double /*patternOffset*/)
{
if (painter == NULL || view == NULL)
return;
}
// Pattern:
- RS_LineTypePattern * pat;
+ LineTypePattern * pat;
if (isSelected())
pat = &patternSelected;
return;
// Pen to draw pattern is always solid:
- RS_Pen pen = painter->getPen();
+ Pen pen = painter->getPen();
pen.setLineType(RS2::SolidLine);
painter->setPen(pen);
}
}
-void RS_Circle::moveRef(const Vector & ref, const Vector & offset)
+void Circle::moveRef(const Vector & ref, const Vector & offset)
{
Vector v1(data.radius, 0.0);
Vector v2(0.0, data.radius);
/**
* Dumps the circle's data to stdout.
*/
-std::ostream & operator<<(std::ostream & os, const RS_Circle & a)
+std::ostream & operator<<(std::ostream & os, const Circle & a)
{
os << " Circle: " << a.data << "\n";
return os;
}
-