Ipelib
|
#include <ipegeo.h>
Public Member Functions | |
Vector () | |
Vector (Angle alpha) | |
Vector (double x0, double y0) | |
double | sqLen () const |
double | len () const |
Angle | angle () const |
Vector | normalized () const |
Vector | orthogonal () const |
double | factorize (Vector &unit) const |
bool | snap (const Vector &mouse, Vector &pos, double &bound) const |
bool | operator== (const Vector &rhs) const |
bool | operator!= (const Vector &rhs) const |
void | operator+= (const Vector &rhs) |
void | operator-= (const Vector &rhs) |
void | operator*= (double rhs) |
Vector | operator+ (const Vector &rhs) const |
Vector | operator- (const Vector &rhs) const |
Vector | operator* (double rhs) const |
Vector | operator- () const |
Public Attributes | |
double | x |
double | y |
Static Public Attributes | |
static Vector | ZERO = Vector(0.0, 0.0) |
Related Symbols | |
(Note that these are not member symbols.) | |
Stream & | operator<< (Stream &stream, const Vector &rhs) |
Vector | operator* (double lhs, const Vector &rhs) |
double | dot (const Vector &lhs, const Vector &rhs) |
Two-dimensional vector.
Unlike some other libraries, I don't make a difference between points and vectors.
|
inline |
Uninitialized vector.
Referenced by dot(), factorize(), normalized(), operator!=(), operator*(), operator*(), operator+(), operator+=(), operator-(), operator-(), operator-=(), operator<<(), operator==(), orthogonal(), and snap().
|
explicit |
|
inlineexplicit |
|
inline |
Return square of Euclidean length.
Return square of vector's length.
Referenced by ipe::TransformTool::compute(), factorize(), len(), normalized(), and ipe::Snap::snap().
double Vector::len | ( | ) | const |
References sqLen().
Referenced by ipe::Path::draw(), factorize(), ipe::Snap::getLine(), normalized(), and snap().
Angle Vector::angle | ( | ) | const |
Return angle of the vector (with positive x-direction).
The returned angle lies between -pi and +pi. Returns zero for the zero vector.
Referenced by ipe::TransformTool::compute(), ipe::Arc::distance(), ipe::Snap::getLine(), ipe::Arc::intersect(), and ipe::Snap::setEdge().
Vector Vector::normalized | ( | ) | const |
Return this vector normalized (with length one).
Normalizing the zero vector returns the vector (1,0).
References len(), sqLen(), and Vector().
Referenced by ipe::Arc::distance(), and ipe::Arc::intersect().
Vector Vector::orthogonal | ( | ) | const |
double Vector::factorize | ( | Vector & | unit | ) | const |
Normalizes this vector into unit and returns length. If this is the zero vector, unit is set to (1,0).
References len(), sqLen(), and Vector().
Referenced by ipe::Segment::distance(), and ipe::Segment::project().
Snap to nearby vertex.
If distance between mouse and this vector is less than bound, set pos to this vector and bound to the distance, and return true
.
References len(), and Vector().
Referenced by ipe::CanvasBase::snapToPaperAndFrame().
|
inline |
|
inline |
|
inline |
|
inline |
Vector-addition.
References Vector().
Vector-subtraction.
References Vector().
The origin (zero vector).
Referenced by ipe::CanvasBase::CanvasBase(), ipe::CairoPainter::doDrawText(), ipe::CanvasBase::drawGrid(), ipe::PanTool::PanTool(), ipe::PdfViewBase::PdfViewBase(), ipe::Reference::Reference(), ipe::Reference::saveAsXml(), ipe::CanvasBase::snapToPaperAndFrame(), and ipe::Text::Text().
double ipe::Vector::x |
Coordinates are public.
Referenced by ipe::Rect::addPoint(), ipe::Rect::addRect(), angle(), ipe::Rect::certainClearance(), ipe::Rect::clipTo(), ipe::TransformTool::compute(), ipe::CanvasBase::computeFifi(), ipe::Rect::contains(), ipe::Rect::contains(), ipe::CanvasBase::devToUser(), ipe::PdfViewBase::devToUser(), ipe::CairoPainter::doCurveTo(), ipe::CairoPainter::doDrawPath(), ipe::CairoPainter::doDrawText(), ipe::CairoPainter::doLineTo(), ipe::CairoPainter::doMoveTo(), dot(), ipe::CanvasBase::drawAxes(), ipe::CanvasBase::drawFrame(), ipe::CanvasBase::drawGrid(), ipe::CanvasBase::drawObjects(), ipe::CanvasBase::drawPaper(), ipe::Rect::intersects(), ipe::Matrix::Matrix(), ipe::Matrix::Matrix(), operator!=(), ipe::Linear::operator*(), ipe::Matrix::operator*(), operator*(), operator*=(), operator+=(), operator-=(), operator==(), orthogonal(), ipe::ImlParser::parseStyle(), ipe::QPt(), ipe::Thumbnail::render(), ipe::Thumbnail::saveRender(), ipe::Shape::Shape(), ipe::Shape::Shape(), ipe::Snap::simpleSnap(), ipe::Bezier::spiroSpline(), sqLen(), ipe::Painter::translate(), ipe::CanvasBase::userToDev(), ipe::PdfViewBase::userToDev(), Vector(), and Vector().
double ipe::Vector::y |
Coordinates are public.
Referenced by ipe::Rect::addPoint(), ipe::Rect::addRect(), angle(), ipe::Rect::certainClearance(), ipe::Rect::clipTo(), ipe::TransformTool::compute(), ipe::CanvasBase::computeFifi(), ipe::Rect::contains(), ipe::Rect::contains(), ipe::CanvasBase::devToUser(), ipe::PdfViewBase::devToUser(), ipe::CairoPainter::doCurveTo(), ipe::CairoPainter::doDrawPath(), ipe::CairoPainter::doDrawText(), ipe::CairoPainter::doLineTo(), ipe::CairoPainter::doMoveTo(), dot(), ipe::CanvasBase::drawAxes(), ipe::CanvasBase::drawFrame(), ipe::CanvasBase::drawGrid(), ipe::CanvasBase::drawObjects(), ipe::CanvasBase::drawPaper(), ipe::Rect::intersects(), ipe::Matrix::Matrix(), ipe::Matrix::Matrix(), operator!=(), ipe::Linear::operator*(), ipe::Matrix::operator*(), operator*(), operator*=(), operator+=(), operator-=(), operator==(), orthogonal(), ipe::ImlParser::parseStyle(), ipe::QPt(), ipe::Thumbnail::render(), ipe::Thumbnail::saveRender(), ipe::Shape::Shape(), ipe::Shape::Shape(), ipe::Snap::simpleSnap(), ipe::Bezier::spiroSpline(), sqLen(), ipe::Painter::translate(), ipe::CanvasBase::userToDev(), ipe::PdfViewBase::userToDev(), Vector(), and Vector().