From 9cf19f475c8bfbb21f564e85b13a302ca020ebc2 Mon Sep 17 00:00:00 2001 From: James Turk Date: Thu, 3 Mar 2005 09:25:19 +0000 Subject: [PATCH] surface code audit --- include/math/Circle.hpp | 23 +++++++++++++++++++---- include/math/Rect.hpp | 16 ++++++++++++++-- include/math/Vector2.hpp | 3 +-- include/math/math.hpp | 17 +++++++++++++---- include/util/ConfigFile.hpp | 11 ++++++----- include/util/FileBuffer.hpp | 3 +-- include/util/RandGen.hpp | 15 ++++++++------- include/util/Singleton.hpp | 24 ++++++++++++++++++------ include/util/VersionInfo.hpp | 8 +++++--- include/video/Pen.hpp | 13 +++++++------ src/audio/AudioCore.cpp | 15 +++++++++------ src/math/Circle.cpp | 16 ++++++++++++++-- src/math/Rect.cpp | 9 ++++++++- src/math/math.cpp | 4 ++-- src/util/ConfigFile.cpp | 6 ++---- src/util/RandGen.cpp | 8 +++++--- src/util/VersionInfo.cpp | 28 ++++++++++++++++++++-------- src/video/Pen.cpp | 17 +++++++++-------- 18 files changed, 161 insertions(+), 75 deletions(-) diff --git a/include/math/Circle.hpp b/include/math/Circle.hpp index 20011d9..b84a1ef 100644 --- a/include/math/Circle.hpp +++ b/include/math/Circle.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Circle.hpp,v 1.1 2005/02/27 09:00:13 cozman Exp $ +// $Id: Circle.hpp,v 1.2 2005/03/03 09:25:19 cozman Exp $ #ifndef PHOTON_MATH_CIRCLE_HPP #define PHOTON_MATH_CIRCLE_HPP @@ -22,7 +22,8 @@ class Rect; // Class: Circle // Defines geometric entity known as a circle. // -// A plane curve everywhere equidistant from a given fixed point, the center. +// A plane curve everywhere equidistant from a given fixed point, the center. +// // // Operators: // - Circle == Circle @@ -115,12 +116,26 @@ public: // Group: Accessors public: // Function: getCenter - // Get center coordinate. + // Get center . // // Returns: - // Center coordinate. + // Center point. Point2 getCenter() const; + // Function: getCenterX + // Get center x coordinate. + // + // Returns: + // Center x coordinate. + scalar getCenterX() const; + + // Function: getCenterY + // Get center y coordinate. + // + // Returns: + // Center y coordinate. + scalar getCenterY() const; + // Function: getRadius // Get radius of Circle. // diff --git a/include/math/Rect.hpp b/include/math/Rect.hpp index f82b7ec..992803e 100644 --- a/include/math/Rect.hpp +++ b/include/math/Rect.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Rect.hpp,v 1.1 2005/02/27 09:00:13 cozman Exp $ +// $Id: Rect.hpp,v 1.2 2005/03/03 09:25:19 cozman Exp $ #ifndef PHOTON_MATH_RECT_HPP #define PHOTON_MATH_RECT_HPP @@ -16,11 +16,13 @@ namespace photon { namespace math { + +class Circle; // Class: Rect // Defines geometric entity known as a rectangle. // -// A four-sided plane figure with four right angles. +// A four-sided plane figure with four right angles. // // Operators: // - Rect == Rect @@ -105,6 +107,16 @@ public: // True if Rect intersects rect, false otherwise. bool intersects(const Rect &rect) const; + // Function: intersects + // Check for intersection between the and . + // + // Parameters: + // circle - with which to check for intersection. + // + // Returns: + // True if Rect intersects circle, false otherwise. + bool intersects(const Circle &circle) const; + // Function: contains // Check if a point is contained within the Rect. // diff --git a/include/math/Vector2.hpp b/include/math/Vector2.hpp index 827f703..cbb8ac6 100644 --- a/include/math/Vector2.hpp +++ b/include/math/Vector2.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Vector2.hpp,v 1.2 2005/03/01 07:51:23 cozman Exp $ +// $Id: Vector2.hpp,v 1.3 2005/03/03 09:25:19 cozman Exp $ #ifndef PHOTON_MATH_VECTOR2_HPP #define PHOTON_MATH_VECTOR2_HPP @@ -158,7 +158,6 @@ public: // Angle of vector (in degrees). scalar getAngleDeg() const; - // Function: getAngleRad // Angle of vector in radians, angle is calculated with respect to positive // X axis. diff --git a/include/math/math.hpp b/include/math/math.hpp index 4701615..a0b1524 100644 --- a/include/math/math.hpp +++ b/include/math/math.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: math.hpp,v 1.3 2005/03/02 10:55:54 cozman Exp $ +// $Id: math.hpp,v 1.4 2005/03/03 09:25:19 cozman Exp $ #ifndef PHOTON_MATH_MATH_HPP #define PHOTON_MATH_MATH_HPP @@ -24,7 +24,10 @@ class Vector2; // Title: Math Utilities // Group: Constants -const scalar Pi=3.1415926535897932384626433832795; + +// Constant: PI +// Defined constant for pi: 3.1415926535897932384626433832795 +const scalar PI=3.1415926535897932384626433832795; // Group: Generic @@ -62,7 +65,7 @@ bool scalarCompare(scalar val1, scalar val2, scalar epsilon=0.000001); // // Returns: // Scalar distance between the two points. -scalar distance(Vector2 v1, Vector2 v2); +scalar distance(const Vector2& v1, const Vector2& v2); // Group: Degrees/Radians @@ -74,6 +77,9 @@ scalar distance(Vector2 v1, Vector2 v2); // // Returns: // Radian equivalent of 'degrees'. +// +// See Also: +// scalar degToRad(scalar degrees); // Function: radToDeg @@ -84,9 +90,12 @@ scalar degToRad(scalar degrees); // // Returns: // Degree equivalent of 'radians' +// +// See Also: +// scalar radToDeg(scalar radians); -//template implementation +// clamp template implementation template T clamp(T val, C low, C high) diff --git a/include/util/ConfigFile.hpp b/include/util/ConfigFile.hpp index 9475190..4fc673b 100644 --- a/include/util/ConfigFile.hpp +++ b/include/util/ConfigFile.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: ConfigFile.hpp,v 1.2 2005/02/16 06:58:05 cozman Exp $ +// $Id: ConfigFile.hpp,v 1.3 2005/03/03 09:25:19 cozman Exp $ #ifndef PHOTON_UTIL_CONFIGFILE_HPP #define PHOTON_UTIL_CONFIGFILE_HPP @@ -122,6 +122,7 @@ public: const std::string& var, varType defVal) const; +// behind the scenes utils private: static std::string cleanString(const std::string& str); static std::string bracketString(const std::string& str); @@ -164,14 +165,14 @@ ConfigFile::setVariable(const std::string& sec, { layout_.push_back( NamedSection( secBrac, Section() ) ); - //search again, assert that it now exists + // search again secIter = std::find_if( layout_.begin(), layout_.end(), - std::bind2nd(StrPairEq(), secBrac) ); - assert(secIter != layout_.end()); + std::bind2nd(StrPairEq(), + secBrac) ); } - //search for variable + // search for variable varIter = std::find_if( secIter->second.begin(), secIter->second.end(), std::bind2nd(StrPairEq(), var) ); diff --git a/include/util/FileBuffer.hpp b/include/util/FileBuffer.hpp index 1e807b6..13c7548 100644 --- a/include/util/FileBuffer.hpp +++ b/include/util/FileBuffer.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: FileBuffer.hpp,v 1.2 2005/02/16 06:58:06 cozman Exp $ +// $Id: FileBuffer.hpp,v 1.3 2005/03/03 09:25:20 cozman Exp $ #ifndef PHOTON_UTIL_FILEBUFFER_HPP #define PHOTON_UTIL_FILEBUFFER_HPP @@ -45,7 +45,6 @@ public: // Destructor, calls . ~FileBuffer(); - // Group: General public: // Function: open diff --git a/include/util/RandGen.hpp b/include/util/RandGen.hpp index aaff9cd..60d78e0 100644 --- a/include/util/RandGen.hpp +++ b/include/util/RandGen.hpp @@ -5,23 +5,23 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: RandGen.hpp,v 1.2 2005/02/16 06:58:06 cozman Exp $ +// $Id: RandGen.hpp,v 1.3 2005/03/03 09:25:20 cozman Exp $ #ifndef PHOTON_UTIL_RANDGEN_HPP #define PHOTON_UTIL_RANDGEN_HPP -namespace photon { -namespace util { +namespace photon +{ +namespace util +{ // Class: RandGen // Psuedorandom number generator class which uses Mersenne Twister. // MT19937 is described at . class RandGen { +// Group: (Con/De)structors public: - - // Group: (Con/De)structors - // Function: RandGen // Constructor for random generator, using time as seed. RandGen(); @@ -37,7 +37,8 @@ public: // RandGen(unsigned long seedVal); - // Group: General +// Group: General +public: // Function: seed // Reseed random generator, a given seed will always turn out same string diff --git a/include/util/Singleton.hpp b/include/util/Singleton.hpp index f8144cd..6d6ba5a 100644 --- a/include/util/Singleton.hpp +++ b/include/util/Singleton.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Singleton.hpp,v 1.4 2005/03/01 07:51:23 cozman Exp $ +// $Id: Singleton.hpp,v 1.5 2005/03/03 09:25:20 cozman Exp $ #ifndef PHOTON_UTIL_SINGLETON_HPP #define PHOTON_UTIL_SINGLETON_HPP @@ -13,6 +13,8 @@ #include #include +#include "exceptions.hpp" + namespace photon { namespace util @@ -67,7 +69,7 @@ public: static T& getInstance(); protected: - virtual ~Singleton()=0; + virtual ~Singleton()=0; // allow inheritance private: static std::auto_ptr instance_; @@ -84,7 +86,10 @@ Singleton::~Singleton() template void Singleton::initialize() { - assert(instance_.get() == 0); + if(instance_.get() != 0) + { + throw PreconditionException("Attempt to double-initialize singleton."); + } instance_ = std::auto_ptr(new T); } @@ -92,7 +97,10 @@ void Singleton::initialize() template void Singleton::destroy() { - assert(instance_.get() != 0); + if(instance_.get() == 0) + { + throw PreconditionException("Attempt to destroy null singleton."); + } instance_.reset(); } @@ -100,9 +108,13 @@ void Singleton::destroy() template T& Singleton::getInstance() { - assert(instance_.get() != 0); + if(instance_.get() == 0) + { + throw PreconditionException("Attempt to get instance of uninitialized " + "singleton."); + } - return *instance_; + return *instance_; //return dereferenced version } template diff --git a/include/util/VersionInfo.hpp b/include/util/VersionInfo.hpp index 1b32ef7..867efd3 100644 --- a/include/util/VersionInfo.hpp +++ b/include/util/VersionInfo.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: VersionInfo.hpp,v 1.4 2005/03/01 07:51:24 cozman Exp $ +// $Id: VersionInfo.hpp,v 1.5 2005/03/03 09:25:20 cozman Exp $ #ifndef PHOTON_UTIL_VERSIONINFO_HPP #define PHOTON_UTIL_VERSIONINFO_HPP @@ -13,8 +13,10 @@ #include #include -namespace photon { -namespace util { +namespace photon +{ +namespace util +{ // Class: VersionInfo // Class which stores version information, such as release numbers. diff --git a/include/video/Pen.hpp b/include/video/Pen.hpp index a58c260..5bcf850 100644 --- a/include/video/Pen.hpp +++ b/include/video/Pen.hpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Pen.hpp,v 1.1 2005/03/02 10:55:29 cozman Exp $ +// $Id: Pen.hpp,v 1.2 2005/03/03 09:25:47 cozman Exp $ #ifndef PHOTON_VIDEO_PEN_HPP #define PHOTON_VIDEO_PEN_HPP @@ -56,7 +56,7 @@ public: // // See Also: // - Pen(Color color); + Pen(const Color& color); // Group: Color public: @@ -75,7 +75,7 @@ public: // // Parameters: // color - to use for drawing. - void setColor(Color color); + void setColor(const Color& color); // Group: Drawing public: @@ -84,7 +84,7 @@ public: // // Parameters: // point - Point to draw. - void drawPoint(math::Point2 point) const; + void drawPoint(const math::Point2& point) const; // Function: drawLine // Draw a line from one point to another. @@ -92,7 +92,7 @@ public: // Parameters: // p1 - First endpoint of line. // p2 - Second endpoint of line. - void drawLine(math::Point2 p1, math::Point2 p2) const; + void drawLine(const math::Point2& p1, const math::Point2& p2) const; // Function: drawVector // Draw a vector, including small arrow, with base at a given point. @@ -100,7 +100,8 @@ public: // Parameters: // point - Base point for vector. // vector - Vector to draw. - void drawVector(math::Point2 point, math::Vector2 vector) const; + void drawVector(const math::Point2& point, + const math::Vector2& vector) const; // Function: drawRectangle // Draw an empty rectangle. diff --git a/src/audio/AudioCore.cpp b/src/audio/AudioCore.cpp index 9427b76..107287f 100644 --- a/src/audio/AudioCore.cpp +++ b/src/audio/AudioCore.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: AudioCore.cpp,v 1.1 2005/02/27 05:55:18 cozman Exp $ +// $Id: AudioCore.cpp,v 1.2 2005/03/03 09:25:47 cozman Exp $ #include "audio/AudioCore.hpp" @@ -27,8 +27,8 @@ std::string AudioCore::getAudioDeviceName() const util::VersionInfo AudioCore::initOpenAL() { - ALCdevice* device; - ALCcontext* context; + ALCdevice* device(0); + ALCcontext* context(0); std::stringstream ss; std::string junks; char junkc; @@ -53,8 +53,9 @@ util::VersionInfo AudioCore::initOpenAL() checkOpenALError()); } - alcMakeContextCurrent(context); + alcMakeContextCurrent(context); // context must be current to get version + // Version is in format "OpenAL 1.0" ss << alGetString(AL_VERSION); ss >> junks >> major >> junkc >> minor; return util::VersionInfo(major,minor,0); @@ -86,7 +87,7 @@ std::string AudioCore::checkOpenALError() err = "OpenAL out of memory"; break; default: - err = "Unknown OpenAL error."; + err = "Unknown OpenAL error"; break; } @@ -95,6 +96,7 @@ std::string AudioCore::checkOpenALError() void AudioCore::setDesiredDevice(const std::string& name) { + // deviceName_ is used inside initOpenAL, must be set prior to construction deviceName_ = name; } @@ -102,13 +104,14 @@ std::string AudioCore::deviceName_; AudioCore::AudioCore() { - util::VersionInfo oalReq(1,0,0); // requires OpenAL 1.0 + util::VersionInfo oalReq(1,0,0); // requires OpenAL 1.0 (TODO: check?) util::ensureVersion("OpenAL", initOpenAL(), oalReq); } AudioCore::~AudioCore() { + // retrieve both the context and device ALCcontext* context( alcGetCurrentContext() ); ALCdevice* device( alcGetContextsDevice(context) ); diff --git a/src/math/Circle.cpp b/src/math/Circle.cpp index a262e7b..a01b972 100644 --- a/src/math/Circle.cpp +++ b/src/math/Circle.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Circle.cpp,v 1.1 2005/02/27 09:00:13 cozman Exp $ +// $Id: Circle.cpp,v 1.2 2005/03/03 09:25:47 cozman Exp $ #include "math/Circle.hpp" @@ -68,7 +68,7 @@ bool Circle::intersects(const Rect &rect) const { scalar newX; scalar newY; - Rect circBound(center_-Vector2(radius_,radius_),2*radius_,2*radius_); + Rect circBound(center_-Point2(radius_,radius_),2*radius_,2*radius_); //reference of rects, 'rect' is shown as rect 5 // _____________ @@ -124,6 +124,18 @@ Point2 Circle::getCenter() const return center_; } +scalar Circle::getCenterX() const +{ + return center_.x; +} + + +scalar Circle::getCenterY() const +{ + return center_.y; +} + + scalar Circle::getRadius() const { return radius_; diff --git a/src/math/Rect.cpp b/src/math/Rect.cpp index 30fcfeb..54bca86 100644 --- a/src/math/Rect.cpp +++ b/src/math/Rect.cpp @@ -5,12 +5,14 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Rect.cpp,v 1.1 2005/02/27 09:00:13 cozman Exp $ +// $Id: Rect.cpp,v 1.2 2005/03/03 09:25:47 cozman Exp $ #include "math/Rect.hpp" #include +#include "math/Circle.hpp" + namespace photon { namespace math @@ -75,6 +77,11 @@ bool Rect::intersects(const Rect &rect) const rect.topLeft_.y > bottomRight_.y); } +bool Rect::intersects(const Circle &circle) const +{ + return circle.intersects(*this); +} + bool Rect::contains(const Point2 &point) const { return point.x > topLeft_.x && point.x < bottomRight_.x && diff --git a/src/math/math.cpp b/src/math/math.cpp index 4f96675..0a07c70 100644 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: math.cpp,v 1.1 2005/02/27 09:00:13 cozman Exp $ +// $Id: math.cpp,v 1.2 2005/03/03 09:25:47 cozman Exp $ #include "math/math.hpp" @@ -21,7 +21,7 @@ bool scalarCompare(scalar val1, scalar val2, scalar epsilon) return std::fabs(val1-val2) < epsilon; } -scalar distance(Vector2 v1, Vector2 v2) +scalar distance(const Vector2& v1, const Vector2& v2) { return magnitude(v1-v2); } diff --git a/src/util/ConfigFile.cpp b/src/util/ConfigFile.cpp index ce603da..355dc89 100644 --- a/src/util/ConfigFile.cpp +++ b/src/util/ConfigFile.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: ConfigFile.cpp,v 1.4 2005/02/16 06:58:26 cozman Exp $ +// $Id: ConfigFile.cpp,v 1.5 2005/03/03 09:25:47 cozman Exp $ #include "util/ConfigFile.hpp" #include "exceptions.hpp" @@ -17,8 +17,6 @@ namespace photon namespace util { - - //(Con/De)structors ConfigFile::ConfigFile() @@ -42,7 +40,7 @@ void ConfigFile::open(const std::string& filename) filename_ = filename; if(filename_.empty()) { - throw PreconditionException("No filename in ConfigFile::open"); + throw PreconditionException("Empty filename in ConfigFile::open"); } std::string section, var, val, str, clean; diff --git a/src/util/RandGen.cpp b/src/util/RandGen.cpp index 65631ff..e205c17 100644 --- a/src/util/RandGen.cpp +++ b/src/util/RandGen.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: RandGen.cpp,v 1.4 2005/02/16 06:58:26 cozman Exp $ +// $Id: RandGen.cpp,v 1.5 2005/03/03 09:25:47 cozman Exp $ // The source in this file is based on MT19937, with much of the source // replicated from mt19937ar.c, because of this the original license @@ -57,8 +57,10 @@ #include "util/RandGen.hpp" #include -namespace photon { -namespace util { +namespace photon +{ +namespace util +{ //static consts const unsigned long RandGen::N; diff --git a/src/util/VersionInfo.cpp b/src/util/VersionInfo.cpp index b74e10d..9a01040 100644 --- a/src/util/VersionInfo.cpp +++ b/src/util/VersionInfo.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: VersionInfo.cpp,v 1.5 2005/02/27 05:53:36 cozman Exp $ +// $Id: VersionInfo.cpp,v 1.6 2005/03/03 09:25:47 cozman Exp $ #include "util/VersionInfo.hpp" @@ -13,8 +13,10 @@ #include "exceptions.hpp" -namespace photon { -namespace util { +namespace photon +{ +namespace util +{ VersionInfo::VersionInfo(unsigned int maj, unsigned int min, unsigned int pat, std::string ext) : @@ -27,20 +29,29 @@ VersionInfo::VersionInfo() : bool VersionInfo::operator<(const VersionInfo &rhs) const { + bool less(false); + //chained compares, compare numbers in order of importance if(this->major < rhs.major) - return true; + { + less = true; + } else if(this->major == rhs.major) { if(this->minor < rhs.minor) - return true; + { + less = true; + } else if(this->minor == rhs.minor) { if(this->patch < rhs.patch) - return true; + { + less = true; + } } } - return false; //if it reaches this point rhs is >= + + return less; //false unless set to true within if-chain } bool VersionInfo::operator<=(const VersionInfo &rhs) const @@ -66,6 +77,7 @@ bool VersionInfo::operator>(const VersionInfo &rhs) const std::ostream& operator<<(std::ostream &o, const VersionInfo &rhs) { + // output major.minor.path [extra] (extra is only printed if not empty) return o << rhs.major << '.' << rhs.minor << '.' << rhs.patch << (rhs.extra.empty() ? "" : " [" + rhs.extra + "]"); } @@ -80,7 +92,7 @@ void ensureVersion(const std::string& library, { ss << library << " version " << required << " required; " << version << " used, please update."; - throw APIError(ss.str()); + throw APIError(ss.str()); // throw APIError if requirement isn't met } } diff --git a/src/video/Pen.cpp b/src/video/Pen.cpp index 3e551f6..fd32cb9 100644 --- a/src/video/Pen.cpp +++ b/src/video/Pen.cpp @@ -5,7 +5,7 @@ // James Turk (jpt2433@rit.edu) // // Version: -// $Id: Pen.cpp,v 1.1 2005/03/02 10:55:29 cozman Exp $ +// $Id: Pen.cpp,v 1.2 2005/03/03 09:25:47 cozman Exp $ #include "video/Pen.hpp" @@ -28,7 +28,7 @@ Pen::Pen(ubyte r, ubyte g, ubyte b, ubyte a) : { } -Pen::Pen(Color color) : +Pen::Pen(const Color& color) : color_(color) { } @@ -38,12 +38,12 @@ void Pen::setColor(ubyte r, ubyte g, ubyte b, ubyte a) color_.setColor(r,g,b,a); } -void Pen::setColor(Color color) +void Pen::setColor(const Color& color) { color_ = color; } -void Pen::drawPoint(math::Point2 point) const +void Pen::drawPoint(const math::Point2& point) const { glBindTexture(GL_TEXTURE_2D,0); color_.makeGLColor(); @@ -53,7 +53,7 @@ void Pen::drawPoint(math::Point2 point) const glColor4ub(255,255,255,255); } -void Pen::drawLine(math::Point2 p1, math::Point2 p2) const +void Pen::drawLine(const math::Point2& p1, const math::Point2& p2) const { glBindTexture(GL_TEXTURE_2D,0); color_.makeGLColor(); @@ -64,17 +64,18 @@ void Pen::drawLine(math::Point2 p1, math::Point2 p2) const glColor4ub(255,255,255,255); } -void Pen::drawVector(math::Point2 point, math::Vector2 vector) const +void Pen::drawVector(const math::Point2& point, + const math::Vector2& vector) const { double x2,y2,x3,y3,x4,y4; math::Vector2 v; x2 = point.x+vector.x; y2 = point.y+vector.y; //calculate an arrow (5pi/6) - v.resolveRad(vector.getMagnitude()/5,vector.getAngleRad()+(5./6)*math::Pi); + v.resolveRad(vector.getMagnitude()/5,vector.getAngleRad()+(5./6)*math::PI); x3 = x2+v.x; y3 = y2-v.y; - v.resolveRad(vector.getMagnitude()/5,vector.getAngleRad()-(5./6)*math::Pi); + v.resolveRad(vector.getMagnitude()/5,vector.getAngleRad()-(5./6)*math::PI); x4 = x2+v.x; y4 = y2-v.y;