CVB.Net 15.0
Loading...
Searching...
No Matches
LineSegment Struct Reference

A line segment between two points. More...

Public Member Functions

 LineSegment (Point2D p0, Point2D p1)
 Creates a line segment based on the two given points p0 and p1 .
 
 LineSegment (int x0, int y0, int x1, int y1)
 Creates a line segment based on the given coordinates.
 
Point2D[] CalculatePointsOnLine ()
 Calculates all the points on this line.
 

Properties

Point2D P0 [get, set]
 Start point.
 
Point2D P1 [get, set]
 End point.
 
double Length [get]
 Gets the length of this line segment.
 

Detailed Description

A line segment between two points.

Constructor & Destructor Documentation

◆ LineSegment() [1/2]

Creates a line segment based on the two given points p0 and p1 .

Parameters
p0Start point.
p1End point.

◆ LineSegment() [2/2]

LineSegment ( int x0,
int y0,
int x1,
int y1 )

Creates a line segment based on the given coordinates.

Parameters
x0Start point X.
y0Start point Y.
x1End point X.
y1End point Y.

Member Function Documentation

◆ CalculatePointsOnLine()

Point2D[] CalculatePointsOnLine ( )

Calculates all the points on this line.

Uses the Bresenham algorithm to calculate the points on this segment.

Returns
Array containing the points on this line.