Line

float x1, float y1, float x2, float y2, float lineWidth = 1.0 )

Create a new line with starting point of (x1, y1) and ending point (x2, y2).

Vec2D start, Vec2D end, float lineWidth = 1.0 )

Create a new line with the specified starting point, ending point and with.

Public fields
Vec2D start - The starting point of the line
Vec2D end - The end point of the line

See the examples of how to simply render a line to the screen by using a temporary object.

Examples

// Create a new line between x = 50.0, y = 30.0 //
// and x = 200.0, y = 100.0 ( and line width of 1.0 ) //
Line myLine( 50.030.0200.0100.0 );

// Draw that line to the screen in black //
myLine.DrawRgba::BLACK );

// Do the same as above but with a single code line //
Line50.030.0200.0100.0 ).DrawRgba::BLACK );

// Or maybe you wish to store or specify the start and ending points as vectors //
LineVec2D50.030.0 ), Vec2D200.0100.0 )).DrawRgba::BLACK );


Member functions
Draw
Draws the line to the screen filled with a color
GetIntersectionPoint
Returns the intersection point between two lines
Collides
Tests if the two line segments collide
GetNormal
Returns the normal of the line

Parent Class


Questions about Line? Click here.