lab_inheritance
Insidious Inheritance
 All Classes Namespaces Files Functions Variables
Line Class Reference

A subclass of Drawable that represents a line in 2D space. More...

#include <line.h>

Inheritance diagram for Line:
[legend]
Collaboration diagram for Line:
[legend]

Public Member Functions

 Line (const Vector2 &a, const Vector2 &b, const cs225::HSLAPixel &color)
 Constructs a new Line going from Point a to Point b. More...
 
void draw (cs225::PNG *canvas) const
 Draws the Line onto the canvas. More...
 
Vector2 a () const
 Gets starting point of the Line. More...
 
void set_a (const Vector2 &a)
 Sets the starting point of the Line. More...
 
Vector2 b () const
 Gets the ending point of the Line. More...
 
void set_b (const Vector2 &b)
 Sets the ending point of the Line. More...
 
cs225::HSLAPixel color () const
 Gets the color of the Line. More...
 
void set_color (const cs225::HSLAPixel &color)
 Sets the color of the Line. More...
 
- Public Member Functions inherited from Drawable
 ~Drawable ()
 

Static Public Member Functions

static std::vector< double > linearInterpolation (const Vector2 &a, const Vector2 &b)
 

Private Attributes

Vector2 a_
 
Vector2 b_
 
cs225::HSLAPixel color_
 

Detailed Description

A subclass of Drawable that represents a line in 2D space.

Constructor & Destructor Documentation

Line::Line ( const Vector2 a,
const Vector2 b,
const cs225::HSLAPixel color 
)

Constructs a new Line going from Point a to Point b.

Parameters
a
b
colorof the new Line

Member Function Documentation

Vector2 Line::a ( ) const

Gets starting point of the Line.

Returns
the starting point of the Line
Vector2 Line::b ( ) const

Gets the ending point of the Line.

Returns
the ending point of the Line
HSLAPixel Line::color ( ) const

Gets the color of the Line.

Returns
the color of the Line
void Line::draw ( cs225::PNG canvas) const
virtual

Draws the Line onto the canvas.

Parameters
canvas

Implements Drawable.

vector< double > Line::linearInterpolation ( const Vector2 a,
const Vector2 b 
)
static
void Line::set_a ( const Vector2 a)

Sets the starting point of the Line.

Parameters
athe new starting point of the Line
void Line::set_b ( const Vector2 b)

Sets the ending point of the Line.

Parameters
bthe new ending point of the Line
void Line::set_color ( const cs225::HSLAPixel color)

Sets the color of the Line.

Parameters
colorthe new color of the Line

Member Data Documentation

Vector2 Line::a_
private
Vector2 Line::b_
private
cs225::HSLAPixel Line::color_
private

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