X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Fvector.cpp;h=0a98ba1fbcf015e6eac4f84c8494dafa75c0279c;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=a9213b6cf6c38833e7db492580cb2fd57018c09c;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/base/vector.cpp b/src/base/vector.cpp index a9213b6..0a98ba1 100644 --- a/src/base/vector.cpp +++ b/src/base/vector.cpp @@ -3,7 +3,9 @@ // 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 // @@ -14,15 +16,16 @@ #include "vector.h" -#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); } @@ -31,7 +34,7 @@ Vector::Vector() */ Vector::Vector(double vx, double vy, double vz) { - //RS_DEBUG->print("Vector::Vector"); + //DEBUG->print("Vector::Vector"); set(vx, vy, vz); } @@ -51,7 +54,7 @@ Vector::Vector(double vx, double vy, double vz) */ Vector::Vector(bool valid) { - //RS_DEBUG->print("Vector::Vector"); + //DEBUG->print("Vector::Vector"); set(0.0, 0.0, 0.0); this->valid = valid; } @@ -61,7 +64,7 @@ Vector::Vector(bool valid) */ Vector::~Vector() { - //RS_DEBUG->print("Vector::~Vector"); + //DEBUG->print("Vector::~Vector"); } /** @@ -97,7 +100,7 @@ double Vector::angle() const 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; @@ -138,7 +141,7 @@ double Vector::magnitude() const } 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; @@ -194,20 +197,20 @@ Vector Vector::move(Vector offset) */ 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; } @@ -246,8 +249,8 @@ Vector Vector::scale(Vector center, Vector factor) 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);