// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
//
// JLH = James L. Hammons <jlhamm@acm.org>
//
#include "vector.h"
-#include "rs.h" // For RS_MIN/MAXDOUBLE (!)
-#include "rs_debug.h"
-#include "rs_math.h"
+#include "enums.h" // For RS_MIN/MAXDOUBLE (!)
+#include "debug.h"
+#include "mathextra.h"
/**
* Constructor for a point with default coordinates.
*/
Vector::Vector()
{
- //RS_DEBUG->print("Vector::Vector");
+ //DEBUG->print("Vector::Vector");
set(0.0, 0.0, 0.0);
}
*/
Vector::Vector(double vx, double vy, double vz)
{
- //RS_DEBUG->print("Vector::Vector");
+ //DEBUG->print("Vector::Vector");
set(vx, vy, vz);
}
*/
Vector::Vector(bool valid)
{
- //RS_DEBUG->print("Vector::Vector");
+ //DEBUG->print("Vector::Vector");
set(0.0, 0.0, 0.0);
this->valid = valid;
}
*/
Vector::~Vector()
{
- //RS_DEBUG->print("Vector::~Vector");
+ //DEBUG->print("Vector::~Vector");
}
/**
if (m > 1.0e-6)
{
double dp = dotP(*this, Vector(1.0, 0.0));
- RS_DEBUG->print("Vector::angle: dp/m: %f/%f", dp, m);
+ DEBUG->print("Vector::angle: dp/m: %f/%f", dp, m);
if (dp / m >= 1.0)
ret = 0.0;
}
else
{
- ret = sqrt(RS_Math::pow(x, 2) + RS_Math::pow(y, 2) + RS_Math::pow(z, 2));
+ ret = sqrt(Math::pow(x, 2) + Math::pow(y, 2) + Math::pow(z, 2));
}
return ret;
*/
Vector Vector::rotate(double ang)
{
- RS_DEBUG->print("Vector::rotate: angle: %f", ang);
+ DEBUG->print("Vector::rotate: angle: %f", ang);
double r = magnitude();
- RS_DEBUG->print("Vector::rotate: r: %f", r);
+ DEBUG->print("Vector::rotate: r: %f", r);
double a = angle() + ang;
- RS_DEBUG->print("Vector::rotate: a: %f", a);
+ DEBUG->print("Vector::rotate: a: %f", a);
x = cos(a) * r;
y = sin(a) * r;
- RS_DEBUG->print("Vector::rotate: x/y: %f/%f", x, y);
+ DEBUG->print("Vector::rotate: x/y: %f/%f", x, y);
return *this;
}
Vector Vector::mirror(Vector axisPoint1, Vector axisPoint2)
{
/*
- RS_ConstructionLine axis(NULL,
- RS_ConstructionLineData(axisPoint1, axisPoint2));
+ ConstructionLine axis(NULL,
+ ConstructionLineData(axisPoint1, axisPoint2));
Vector xp = axis.getNearestPointOnEntity(*this);
xp = xp - (*this);