1 Introduction

Distance computations are fundamental in computational geometry, and there are well-known formulas for them. Nevertheless, due to differences in object representations, there are alternative solutions to choose from. We will give some of these and indicate the situations they apply to.

We present several basic methods for representing planes in 3D space, and how to compute the distance of a point to a plane.

The intersection of geometric primitives is a fundamental construct in many computer graphics and modeling applications. Here we look at the algorithms for the simplest 2D and 3D linear primitives: lines, segments and planes.

2 Distance of a point and a line

2.1 2D space, find the closest point to a line

Pic_segment.gif

2.2 2D space, calculate the distance

Pic_dparametric.gif

3 Distance of a point and a plane

3.1 3D space, calculate the distance

Pic_dplane.gif

4 Intersections of lines and planes

4.1 2D space, intersection of two segments

Pic_line-line.gif

4.2 3D space, intersection of a segment and a plane

Pic_line-plane.gif

4.3 3D space, intersection of two planes

Pic_2-planes.gif

5 Compile this Project

mkdir build
cd build
cmake ..
make 

6 Run

./build/point2Line
./build/point2Plane
./build/geometryIntersection

Reference

Lines and distance of a point and a line
Planes and distance of a point and a line
Intersections of lines and planes
Operator Overloading for 3D Vector