ray.h revision b63c6af7aa7f869de42730cf0ffd8b6077d778c5
/**
* \file
* \brief Infinite straight ray
*//*
* Copyright 2008 Marco Cecchetti <mrcekets at gmail.com>
*
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*/
#ifndef LIB2GEOM_SEEN_RAY_H
#define LIB2GEOM_SEEN_RAY_H
#include <vector>
{
/**
* @brief Straight ray from a specific point to infinity.
*
* Rays are "half-lines" - they begin at some specific point and extend in a straight line
* to infinity.
*
* @ingroup Primitives
*/
{
}
setPoints(A, B);
}
_origin = a;
_vector = b - a;
else
}
bool isDegenerate() const {
}
}
}
if ( _vector[d] != 0 ) {
}
return result;
}
if ( isDegenerate() ) return 0;
if (t < 0) t = 0;
return t;
}
return result;
}
}
}
}
}; // end class Ray
inline
}
inline
}
inline
}
// evaluate the angle between r1 and r2 rotating r1 in cw or ccw direction on r2
// the returned value is an angle in the interval [0, 2PI[
inline
return angle;
}
/**
* @brief Returns the angle bisector for the two given rays.
*
* @a r1 is rotated half the way to @a r2 in either clockwise or counter-clockwise direction.
*
* @pre Both passed rays must have the same origin.
*
* @remarks If the versors of both given rays point in the same direction, the direction of the
* angle bisector ray depends on the third parameter:
* - If @a cw is set to @c true, the returned ray will equal the passed rays @a r1 and @a r2.
* - If @a cw is set to @c false, the returned ray will go in the opposite direction.
*
* @throws RangeError if the given rays do not have the same origins
*/
inline
{
{
THROW_RANGEERROR("passed rays do not have the same origin");
}
}
} // end namespace Geom
#endif // LIB2GEOM_SEEN_RAY_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :