March 2017
Intermediate to advanced
480 pages
11h 3m
English
A line is the shortest straight path that goes through two points. A line extends infinitely in both directions. Like its 2D counterpart, the 3D line we are going to implement will actually be a Line Segment. We define this line segment using a Start point and an End point:

We are going to define a Line structure that holds start and end points. This structure represents a line segment. We will also implement two helper functions, Length and LengthSq. These functions will help us find the length and squared length of the line segment.
Follow these steps to implement a 3D line segment:
Read now
Unlock full access