A line segment is the finite straight path connecting two points. Unlike a line, it does not continue forever; its endpoints define where it starts and stops. On a screen, segments appear as canvas strokes, element edges, and direct movement paths. section 1.4.7 section 10.1
Describe a segment with two coordinate points, such as A(x1, y1) and B(x2, y2). It can also be described by one endpoint plus a direction vector: the vector from A to B gives both the direction and displacement of an element moving along the segment. section 10.1
Draw a canvas segment
For a drawing interface, mouse coordinates provide points on the canvas. Start a path at one point, then call lineTo() with the next point to create the visible straight segment. Repeating this as the pointer moves builds a sketch from connected segments. section 1.4.7
Table 1.7 Some geometric examples
Use the canvas example to verify how start and end coordinates become a rendered line segment, alongside related coordinate and rotation tasks. section 1.4.7
Segments also help model layout. An element edge is a segment, while a bounding box can be understood from a top-left point and a size vector extending toward its bottom-right corner. This makes positions, dimensions, and motion comparable in the same coordinate system. section 10.1



