14 #ifndef OSG_LINESEGMENT
15 #define OSG_LINESEGMENT 1
18 #include <osg/BoundingBox>
19 #include <osg/BoundingSphere>
33 LineSegment(
const vec_type& s,
const vec_type& e) : _s(s),_e(e) {}
37 inline void set(
const vec_type& s,
const vec_type& e) { _s=s; _e=e; }
39 inline vec_type&
start() {
return _s; }
40 inline const vec_type&
start()
const {
return _s; }
42 inline vec_type&
end() {
return _e; }
43 inline const vec_type&
end()
const {
return _e; }
45 inline bool valid()
const {
return _s.valid() && _e.valid() && _s!=_e; }
54 bool intersectAndComputeRatios(
const BoundingBox& bb,
float& ratioFromStartToEnd1,
float& ratioFromStartToEnd2)
const;
59 bool intersectAndComputeRatios(
const BoundingBox& bb,
double& ratioFromStartToEnd1,
double& ratioFromStartToEnd2)
const;
68 bool intersectAndComputeRatios(
const BoundingSphere& bs,
float& ratioFromStartToEnd1,
float& ratioFromStartToEnd2)
const;
73 bool intersectAndComputeRatios(
const BoundingSphere& bs,
double& ratioFromStartToEnd1,
double& ratioFromStartToEnd2)
const;
78 bool intersect(
const Vec3f& v1,
const Vec3f& v2,
const Vec3f& v3,
float& ratioFromStartToEnd);
83 bool intersect(
const Vec3d& v1,
const Vec3d& v2,
const Vec3d& v3,
double& ratioFromStartToEnd);
96 static bool intersectAndClip(vec_type& s,vec_type& e,
const BoundingBox& bb);
void set(const vec_type &s, const vec_type &e)
const vec_type & start() const
vec_type::value_type value_type
void mult(const LineSegment &seg, const Matrix &m)
const vec_type & end() const
LineSegment(const vec_type &s, const vec_type &e)
void mult(const Matrix &m, const LineSegment &seg)
LineSegment(const LineSegment &seg)