- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

# IpeVector Class Reference
[Ipe Geometry]

Two-dimensional vector. More...

List of all members.

## Public Member Functions

- IpeVector ()
- IpeVector (IpeAngle alpha)
- IpeVector (IpeScalar x, IpeScalar y)
- double SqLen () const
- double Len () const
- IpeAngle Angle () const
- IpeVector Normalized () const
- IpeVector Orthogonal () const
- double Factorize (IpeVector &unit) const
- bool snap (const IpeVector &mouse, IpeVector &pos, double &bound) const
- bool operator== (const IpeVector &rhs) const
- bool operator!= (const IpeVector &rhs) const
- void operator+= (const IpeVector &rhs)
- void operator-= (const IpeVector &rhs)
- void operator *= (double rhs)
- IpeVector operator+ (const IpeVector &rhs) const
- IpeVector operator- (const IpeVector &rhs) const
- IpeVector operator * (double rhs) const

## Public Attributes

- IpeScalar iX
- IpeScalar iY

## Static Public Attributes

- static IpeVector Zero

## Related Functions

(Note that these are not member functions.)

- IpeVector operator * (double lhs, const IpeVector &rhs)
- double Dot (const IpeVector &lhs, const IpeVector &rhs)

## Detailed Description

Two-dimensional vector.

Unlike some other libraries, I don't make a difference between points and vectors.

## Constructor & Destructor Documentation

IpeVector::IpeVector | ( |  | ) | `[inline]`

Uninitialized vector.

IpeVector::IpeVector | ( | IpeAngle | alpha | ) | `[explicit]`

Construct a unit vector with this direction.

IpeVector::IpeVector | ( | IpeScalar | x,
|  | IpeScalar | y |
| ) |  |  | `[inline, explicit]`

Construct a vector.

## Member Function Documentation

double IpeVector::SqLen | ( |  | ) | const`[inline]`

Return square of Euclidean length.

IpeAngle IpeVector::Angle | ( |  | ) | const

Return angle of the vector (with positive x-direction).

Returns zero for the zero vector.

IpeVector IpeVector::Normalized | ( |  | ) | const

Return this vector normalized (with length one).

IpeVector IpeVector::Orthogonal | ( |  | ) | const

Return this vector turned 90 degrees to the left.

double IpeVector::Factorize | ( | IpeVector & | unit | ) | const

Normalizes this vector into unit and returns length. If this is the zero vector, unit is set to (1,0).

bool IpeVector::snap | ( | const IpeVector & | mouse,
|  | IpeVector & | pos,
|  | double & | bound |
| ) |  |  | const

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`.

bool IpeVector::operator== | ( | const IpeVector & | rhs | ) | const`[inline]`

Equality.

bool IpeVector::operator!= | ( | const IpeVector & | rhs | ) | const`[inline]`

Inequality.

void IpeVector::operator+= | ( | const IpeVector & | rhs | ) | `[inline]`

Vector-addition.

void IpeVector::operator-= | ( | const IpeVector & | rhs | ) | `[inline]`

Vector-subtraction.

void IpeVector::operator *= | ( | double | rhs | ) | `[inline]`

Multiply vector by scalar.

IpeVector IpeVector::operator+ | ( | const IpeVector & | rhs | ) | const`[inline]`

Vector-addition.

IpeVector IpeVector::operator- | ( | const IpeVector & | rhs | ) | const`[inline]`

Vector-subtraction.

IpeVector IpeVector::operator * | ( | double | rhs | ) | const`[inline]`

Vector * scalar.

## Friends And Related Function Documentation

IpeVector operator * | ( | double | lhs,
|  | const IpeVector & | rhs |
| ) |  |  | `[related]`

Scalar * vector.

double Dot | ( | const IpeVector & | lhs,
|  | const IpeVector & | rhs |
| ) |  |  | `[related]`

Dotproduct of two vectors.

## Member Data Documentation

IpeVector IpeVector::Zero`[static]`

The origin (zero vector).

IpeScalar IpeVector::iX

Vector coordinates are public.

The documentation for this class was generated from the following files:

- ipegeo.h
- ipegeo.cpp