mirror of https://github.com/CGAL/cgal
Initial revision
This commit is contained in:
parent
0f1a758b69
commit
ae78b51b2b
|
|
@ -0,0 +1 @@
|
|||
Packages/Distance_2/web/lis
|
||||
|
|
@ -0,0 +1 @@
|
|||
Squared distance computations for simple 2D objects.
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
\cleardoublepage
|
||||
\chapter{Squared Distances}
|
||||
|
||||
There is a family of functions called \ccStyle{CGAL_squared_distance} that
|
||||
compute the square of the Euclidean distance between two geometric objects.
|
||||
|
||||
The squared distance between two two-dimensional points \ccStyle{p1} and
|
||||
\ccStyle{p2} is defined as $d_{x}^{2} + d_{y}^{2}$, where $d_{x}$
|
||||
\ccTexHtml{$\equiv$}{==}
|
||||
\ccStyle{p2.x()-p1.x()} and $d_{y}$\ccTexHtml{$\equiv$}{==} \ccStyle{p2.y()-p1.y()}.
|
||||
|
||||
For arbitrary two-dimensional geometric objects \ccStyle{obj1} and
|
||||
\ccStyle{obj2} the squared distance is defined as the minimal
|
||||
\ccStyle{CGAL_squared_distance(p1, p2)}, where \ccStyle{p1} is a point of
|
||||
\ccStyle{obj1} and \ccStyle{p2} is a point of \ccStyle{obj2}.
|
||||
Note that for objects like triangles and polygons that have an inside (a
|
||||
bounded region), this inside is part of the object.
|
||||
So, the squared distance from a point inside a triangle to that triangle is
|
||||
zero, not the squared distance to the closest edge of the triangle.
|
||||
|
||||
The general format of the functions is:
|
||||
|
||||
\ccUnchecked{
|
||||
\ccGlobalFunctionTemplate{R}
|
||||
{R::FT CGAL_squared_distance(Type1<R> obj1, Type2<R> obj2);}
|
||||
}
|
||||
|
||||
\noindent
|
||||
where the types \ccStyle{Type1} and \ccStyle{Type2} can be any of the
|
||||
following:
|
||||
\begin{itemize}
|
||||
\item \ccStyle{CGAL_Point_2}
|
||||
\item \ccStyle{CGAL_Line_2}
|
||||
\item \ccStyle{CGAL_Ray_2}
|
||||
\item \ccStyle{CGAL_Segment_2}
|
||||
\item \ccStyle{CGAL_Triangle_2}
|
||||
%\item \ccStyle{CGAL_Iso_Rectangle_2}
|
||||
%\item \ccStyle{CGAL_Polygon_2}
|
||||
\end{itemize}
|
||||
|
||||
Those routines are defined in the header file
|
||||
\ccStyle{CGAL/squared_distance.h}.
|
||||
|
||||
\subsection{Why the square?}
|
||||
|
||||
There are routines that compute the square of the Euclidean distance, but no
|
||||
routines that compute the distance itself. Why?
|
||||
|
||||
First of all, the two values can be derived from each other quite easily (by
|
||||
taking the square root or taking the square). So, supplying only the one and
|
||||
not the other is only a minor inconvenience for the user.
|
||||
|
||||
Second, often either value can be used. This is for example the case when
|
||||
(squared) distances are compared.
|
||||
|
||||
Third, the library wants to stimulate the use of the squared distance instead
|
||||
of the distance. The squared distance can be computed in more cases and the
|
||||
computation is cheaper.
|
||||
We do this by not providing the perhaps more natural routine,
|
||||
|
||||
The problem of a distance routine is that it needs the \ccStyle{sqrt}
|
||||
operation.
|
||||
This has two drawbacks.
|
||||
\begin{itemize}
|
||||
\item
|
||||
The \ccStyle{sqrt} operation can be costly. Even if it is not very costly for
|
||||
a specific number type and platform, avoiding it is always cheaper.
|
||||
\item
|
||||
There are number types on which no \ccStyle{sqrt} operation is defined,
|
||||
especially integer types and rationals.
|
||||
\end{itemize}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
\cleardoublepage
|
||||
\chapter{Squared Distances}
|
||||
|
||||
There is a family of functions called \ccStyle{CGAL_squared_distance} that
|
||||
compute the square of the Euclidean distance between two geometric objects.
|
||||
|
||||
The squared distance between two two-dimensional points \ccStyle{p1} and
|
||||
\ccStyle{p2} is defined as $d_{x}^{2} + d_{y}^{2}$, where $d_{x}$
|
||||
\ccTexHtml{$\equiv$}{==}
|
||||
\ccStyle{p2.x()-p1.x()} and $d_{y}$\ccTexHtml{$\equiv$}{==} \ccStyle{p2.y()-p1.y()}.
|
||||
|
||||
For arbitrary two-dimensional geometric objects \ccStyle{obj1} and
|
||||
\ccStyle{obj2} the squared distance is defined as the minimal
|
||||
\ccStyle{CGAL_squared_distance(p1, p2)}, where \ccStyle{p1} is a point of
|
||||
\ccStyle{obj1} and \ccStyle{p2} is a point of \ccStyle{obj2}.
|
||||
Note that for objects like triangles and polygons that have an inside (a
|
||||
bounded region), this inside is part of the object.
|
||||
So, the squared distance from a point inside a triangle to that triangle is
|
||||
zero, not the squared distance to the closest edge of the triangle.
|
||||
|
||||
The general format of the functions is:
|
||||
|
||||
\ccUnchecked{
|
||||
\ccGlobalFunctionTemplate{R}
|
||||
{R::FT CGAL_squared_distance(Type1<R> obj1, Type2<R> obj2);}
|
||||
}
|
||||
|
||||
\noindent
|
||||
where the types \ccStyle{Type1} and \ccStyle{Type2} can be any of the
|
||||
following:
|
||||
\begin{itemize}
|
||||
\item \ccStyle{CGAL_Point_2}
|
||||
\item \ccStyle{CGAL_Line_2}
|
||||
\item \ccStyle{CGAL_Ray_2}
|
||||
\item \ccStyle{CGAL_Segment_2}
|
||||
\item \ccStyle{CGAL_Triangle_2}
|
||||
%\item \ccStyle{CGAL_Iso_Rectangle_2}
|
||||
%\item \ccStyle{CGAL_Polygon_2}
|
||||
\end{itemize}
|
||||
|
||||
Those routines are defined in the header file
|
||||
\ccStyle{CGAL/squared_distance.h}.
|
||||
|
||||
\subsection{Why the square?}
|
||||
|
||||
There are routines that compute the square of the Euclidean distance, but no
|
||||
routines that compute the distance itself. Why?
|
||||
|
||||
First of all, the two values can be derived from each other quite easily (by
|
||||
taking the square root or taking the square). So, supplying only the one and
|
||||
not the other is only a minor inconvenience for the user.
|
||||
|
||||
Second, often either value can be used. This is for example the case when
|
||||
(squared) distances are compared.
|
||||
|
||||
Third, the library wants to stimulate the use of the squared distance instead
|
||||
of the distance. The squared distance can be computed in more cases and the
|
||||
computation is cheaper.
|
||||
We do this by not providing the perhaps more natural routine,
|
||||
|
||||
The problem of a distance routine is that it needs the \ccStyle{sqrt}
|
||||
operation.
|
||||
This has two drawbacks.
|
||||
\begin{itemize}
|
||||
\item
|
||||
The \ccStyle{sqrt} operation can be costly. Even if it is not very costly for
|
||||
a specific number type and platform, avoiding it is always cheaper.
|
||||
\item
|
||||
There are number types on which no \ccStyle{sqrt} operation is defined,
|
||||
especially integer types and rationals.
|
||||
\end{itemize}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -d include ]
|
||||
then
|
||||
mkdir include
|
||||
mkdir include/CGAL
|
||||
fi
|
||||
|
||||
|
||||
cd web
|
||||
if [ ! -d lis ]
|
||||
then
|
||||
mkdir lis
|
||||
fi
|
||||
|
||||
make xsrcs
|
||||
|
||||
echo "Now adapt version and description.txt and run make_zip"
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
zip -r Distance_2.zip version description.txt include test doc_tex
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 1
|
||||
4 0 -3 -1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0 1
|
||||
0.5 0.5 2 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0 1
|
||||
0.6 0.6 2 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-1 -1.3 0 1
|
||||
1 0.5 7 -3
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 3 -1
|
||||
-0.5 2 4 3
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-8 -7 11 6
|
||||
23 -27 -17 16
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5 0 0 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
6 1 8 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 0 -3
|
||||
1 4 1 7
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 0 0
|
||||
8 1 6 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
8 1 6 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
8 0 12 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
8 1 12 1.1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 1 0
|
||||
2 1 2 -1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
4 0 -3 -1
|
||||
1 1 2 11
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
3 4 7 7
|
||||
7 0 6 5
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-1 1 3 4
|
||||
7 0 6 5
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
1 1 6 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5 0 8 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5 0 0 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0
|
||||
3 1 2.5 0.9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 1
|
||||
2 1 10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 1
|
||||
2 1 -10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 1
|
||||
-2 1 -10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 1
|
||||
-2 1 10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0
|
||||
2 1 10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0
|
||||
2 1 -10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0
|
||||
-2 1 -10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0
|
||||
-2 1 10 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0
|
||||
3 1 10 3
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 1 0
|
||||
0.9 0.9 2 2
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 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 +1,2 @@
|
|||
0 0 1 0
|
||||
-1 -1 1 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-1 -1 1 1
|
||||
0 0 1 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-1 -1 1 1
|
||||
-2 0 0 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-8 -7 11 6
|
||||
23 -27 -17 16
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 1 0
|
||||
2 1 2 -1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
4 0 -3 -1
|
||||
1 1 2 11
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0 1
|
||||
0.5 0.5 2 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0 1
|
||||
0.6 0.6 2 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-1 -1.3 0 1
|
||||
1 0.5 7 -3
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 3 -1
|
||||
-0.5 2 4 3
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-8 -7 11 6
|
||||
23 -27 -17 16
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5 0 0 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
6 1 8 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 0 -3
|
||||
1 4 1 7
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
0 0 5 0
|
||||
8 1 6 1
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
8 0 12 0
|
||||
0 0 5 0
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 1 0
|
||||
2 1 2 -1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
4 0 -3 -1
|
||||
1 1 2 11
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
3 4 7 7
|
||||
7 0 6 5
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
-1 1 3 4
|
||||
7 0 6 5
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
1 1 6 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
0 0 5 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5 0 8 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5 0 0 0
|
||||
1 1 2 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1.1 1
|
||||
0 0 0 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0.9 1
|
||||
0 -10 0 -9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0.9 -1
|
||||
0 -10 0 -9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0.9 1
|
||||
0 9 0 10
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0.9 -1
|
||||
0 9 0 10
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0.9 1
|
||||
0 10 0 9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1.1 -1
|
||||
0 0 0 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1.1 1
|
||||
0 -10 0 -9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1.1 -1
|
||||
0 -10 0 -9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1.1 -1
|
||||
0 9 0 10
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1.1 1
|
||||
0 10 0 9
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
1 0 0.9 1
|
||||
0 0 0 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 0.9 -1
|
||||
0 0 0 1
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
1 0 1 1
|
||||
0 0 0 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1 -1
|
||||
0 0 0 1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1 1
|
||||
0 -10 0 -9
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1 0 1 -1
|
||||
0 -10 0 -9
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue