CGAL 4.7 - 2D and 3D Linear Geometry Kernel: CGAL::squared_distance()

\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.7 - 2D and 3D Linear Geometry Kernel

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
CGAL::squared_distance()
Global Kernel Functions

##

#include <CGAL/squared_distance_2.h> //for 2D functions
#include <CGAL/squared_distance_3.h> //for 3D functions

## Functions

template<typename Kernel >
Kernel::FT | CGAL::squared_distance (Type1< Kernel > obj1, Type2< Kernel > obj2)
| computes the square of the Euclidean distance between two geometric objects. More...

## Function Documentation

template<typename Kernel >

Kernel::FT CGAL::squared_distance | ( | Type1< Kernel > | obj1,
|  | Type2< Kernel > | obj2
| ) |  |

computes the square of the Euclidean distance between two geometric objects.

For arbitrary geometric objects `obj1` and `obj2` the squared distance is defined as the minimal `squared_distance(p1, p2)`, where `p1` is a point of `obj1` and `p2` is a point of `obj2`. Note that for objects that have an inside (a bounded region), this inside is part of the object. So, the squared distance from a point inside is zero, not the squared distance to the closest point on the boundary.

In 2D, the types `Type1` and `Type2` can be any of the following:

- `Point_2`
- `Line_2`
- `Ray_2`
- `Segment_2`
- `Triangle_2`

In 3D, the types `Type1` and `Type2` can be any of the following:

- `Point_3`
- `Line_3`
- `Ray_3`
- `Segment_3`
- `Plane_3`

See Also
  `CGAL::compare_distance_to_point()`
  `CGAL::compare_signed_distance_to_line()`
  `CGAL::compare_signed_distance_to_plane()`
  `CGAL::has_larger_distance_to_point()`
  `CGAL::has_larger_signed_distance_to_line()`
  `CGAL::has_larger_signed_distance_to_plane()`
  `CGAL::has_smaller_distance_to_point()`
  `CGAL::has_smaller_signed_distance_to_line()`
  `CGAL::has_smaller_signed_distance_to_plane()`

`#include <CGAL/squared_distance_2.h>`