Points, Lines, Rays, and Collinearity
In geometry, a point represents an exact location, such as a coordinate \((x,y)\). Points have no length,
width, or area; they simply mark positions. When we connect points, we create different kinds of geometric objects.
A line segment is the finite part between two endpoints \(A\) and \(B\). A ray starts at one point
and extends forever in one direction (for example, from \(A\) through \(B\)). An infinite line extends without end
in both directions through two distinct points.
One of the first useful computations is distance. The length of segment \(AB\) in the coordinate plane follows
the distance formula:
\[
AB=\sqrt{(x_B-x_A)^2+(y_B-y_A)^2}.
\]
This is a direct application of the Pythagorean theorem, since the horizontal and vertical coordinate differences form the legs
of a right triangle.
Another core idea is collinearity: points \(A\), \(B\), and \(C\) are collinear if they lie on the same straight line.
A robust way to test this is the 2D cross product (equivalently, twice the signed area of triangle \(ABC\)):
\[
(\overrightarrow{AB}\times\overrightarrow{AC})=(x_B-x_A)(y_C-y_A)-(y_B-y_A)(x_C-x_A).
\]
If this value is exactly \(0\), the triangle has zero area, so the points are collinear. In real computations, rounding and
finite precision can create tiny nonzero values, so practical tools compare \(|\text{cross}|\) to a tolerance.
A good approach scales the tolerance by the sizes of \(\|AB\|\) and \(\|AC\|\), so the test remains stable even when coordinates
are large.
Once \(A\) and \(B\) are chosen, you can describe the infinite line through them in different algebraic forms.
A common one is standard form:
\[
ax+by+c=0,
\]
where the coefficients can be computed directly from the coordinates. Another is the slope form, \(y=mx+b\),
when the line is not vertical. Vertical lines are a special case: they have undefined slope and are written as \(x=\text{constant}\).
Visually, it helps to compare objects: a segment is bounded (two endpoints), a ray is half-infinite (one endpoint), and a line is
fully infinite (no endpoints). By dragging points on the interactive plot, you can see how changing coordinates affects distances,
slopes, and whether three points remain collinear.