class Line2

A line in 2D space represented with an origin and direction.

Public

Constructors

Line2

Line2() = default

Line2

Line2(const Vector2 &origin, const Vector2 &direction)

Methods

SetOrigin

void SetOrigin(const Vector2 &origin)

GetOrigin

const Vector2 &GetOrigin() const

SetDirection

void SetDirection(const Vector2 &dir)

GetDirection

const Vector2 &GetDirection() const

GetPoint

Vector2 GetPoint(float t) const

Gets the position of a point t units along the line.

Intersects

std::pair<bool, float> Intersects(const Line2 &line) const

Line/Line intersection, returns boolean result and distance to intersection point.

Operators

operator*

Vector2 operator*(float t) const

Gets the position of a point t units along the line.

Protected

Fields

mOrigin

Vector2 mOrigin

mDirection

Vector2 mDirection