Commit 0c77d318 authored by Jan Möbius's avatar Jan Möbius
Browse files

Moved some functions to ACG/Geometry/Algorithms.hh

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9331 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b573ec4c
...@@ -73,42 +73,6 @@ inline bool isNan(double x) { ...@@ -73,42 +73,6 @@ inline bool isNan(double x) {
} }
template < typename VectorT >
VectorT project_to_edge(const VectorT& _start , const VectorT& _end , const VectorT& _point )
{
VectorT direction = ( _end - _start );
assert( fabs(direction.norm()) > 0.0000000001) ;
const VectorT projected_point = ( ( _point - _start ) | direction ) * direction + _start;
if ( ( ( projected_point - _start ) | direction ) > ( ( _end - _start ) | direction ) )
return _end;
if ( ( ( projected_point - _start ) | direction ) < 0 )
return _start;
return projected_point;
}
template < typename VectorT , typename ValueT >
inline
ValueT
dist_plane(const VectorT& _porigin,
const VectorT& _pnormal,
const VectorT& _point)
{
assert( fabs(_pnormal.norm()) > 0.0000000001) ;
return( ((_point-_porigin) | _pnormal));
}
template < typename VectorT >
inline
VectorT
project_to_plane(const VectorT& _porigin,
const VectorT& _pnormal,
const VectorT& _point)
{
return (_point - _pnormal * dist_plane< VectorT , double >( _porigin , _pnormal , _point ) );
}
template < typename VectorT , typename ValueT > template < typename VectorT , typename ValueT >
ValueT ValueT
...@@ -124,6 +88,7 @@ get_fullangle( VectorT _vector1 , VectorT _vector2 , const VectorT& _normal , bo ...@@ -124,6 +88,7 @@ get_fullangle( VectorT _vector1 , VectorT _vector2 , const VectorT& _normal , bo
const double right = ( ( _normal % _vector1 ) | _vector2 ) ; const double right = ( ( _normal % _vector1 ) | _vector2 ) ;
double sp = ( _vector1 | _vector2 ); double sp = ( _vector1 | _vector2 );
//Catch some errors with scalar product and the following acos //Catch some errors with scalar product and the following acos
if (sp < -1.0) { if (sp < -1.0) {
sp = -1.0; sp = -1.0;
......
...@@ -69,45 +69,6 @@ namespace GeometryFunctions { ...@@ -69,45 +69,6 @@ namespace GeometryFunctions {
//== CLASS DEFINITION ========================================================= //== CLASS DEFINITION =========================================================
/**
project one point to an edge. If its projection is not on the edge itself, the start or the endpoint is returned
@param _start beginning of edge
@param _end end of the edge
@param _point point to be projected
*/
template < typename VectorT >
VectorT project_to_edge(const VectorT& _start ,
const VectorT& _end ,
const VectorT& _point );
/**
Checks the distance from a point to a plane
@param _porigin Planes origin
@param _pnormal Plane normal
@param _point point to test
@return distance
*/
template < typename VectorT , typename ValueT >
inline
ValueT
dist_plane(const VectorT& _porigin,
const VectorT& _pnormal,
const VectorT& _point);
/**
projects a point to a plane
@param _porigin Planes origin
@param _pnormal Plane normal
@param _point point to project
@return projected point
*/
template < typename VectorT >
inline
VectorT
project_to_plane(const VectorT& _porigin,
const VectorT& _pnormal,
const VectorT& _point);
/** Return a fully parametrized angle /** Return a fully parametrized angle
@param _vector1 vector pointing away from center, angle = 0 @param _vector1 vector pointing away from center, angle = 0
@param _vector2 vector for which the angle should be calculated @param _vector2 vector for which the angle should be calculated
...@@ -117,9 +78,9 @@ project_to_plane(const VectorT& _porigin, ...@@ -117,9 +78,9 @@ project_to_plane(const VectorT& _porigin,
*/ */
template < typename VectorT , typename ValueT > template < typename VectorT , typename ValueT >
ValueT ValueT
get_fullangle( VectorT _vector1 , get_fullangle( VectorT _vector1,
VectorT _vector2 , VectorT _vector2,
const VectorT& _normal , const VectorT& _normal,
bool& skip ); bool& skip );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment