Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Line_2_Line_2_pair< R > Class Template Reference

#include <Line_2_Line_2_intersection.h>

Collaboration diagram for Line_2_Line_2_pair< R >:

Public Types

enum  Intersection_results { NO, POINT, LINE }
 

Public Member Functions

 Line_2_Line_2_pair ()
 
 Line_2_Line_2_pair (Line_2< R > const *line1, Line_2< R > const *line2)
 
 ~Line_2_Line_2_pair ()
 
Intersection_results intersection_type () const
 
bool intersection (Point_2< R > &result) const
 
bool intersection (Line_2< R > &result) const
 

Protected Attributes

Line_2< R > const * _line1
 
Line_2< R > const * _line2
 
bool _known
 
Intersection_results _result
 
Point_2< R > _intersection_point
 

Detailed Description

template<class R>
class Line_2_Line_2_pair< R >

Definition at line 61 of file Line_2_Line_2_intersection.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

Definition at line 184 of file Line_2_Line_2_intersection.h.

185 {
186  _line1 = 0;
187  _line2 = 0;
188  _known = false;
189 }
Line_2_Line_2_pair ( Line_2< R > const *  line1,
Line_2< R > const *  line2 
)

Definition at line 192 of file Line_2_Line_2_intersection.h.

194 {
195  _line1 = line1;
196  _line2 = line2;
197  _known = false;
198 }
~Line_2_Line_2_pair ( )
inline

Definition at line 67 of file Line_2_Line_2_intersection.h.

67 {}

Member Function Documentation

bool intersection ( Point_2< R > &  result) const

Definition at line 244 of file Line_2_Line_2_intersection.h.

Referenced by Segment_2_Segment_2_pair< R >::intersection_type().

245 {
246  if (!_known)
248  if (_result != POINT)
249  return false;
250  pt = _intersection_point;
251  return true;
252 }
Intersection_results _result
Intersection_results intersection_type() const

Here is the caller graph for this function:

bool intersection ( Line_2< R > &  result) const

Definition at line 256 of file Line_2_Line_2_intersection.h.

257 {
258  if (!_known)
260  if (_result != LINE)
261  return false;
262  l = *_line1;
263  return true;
264 }
Intersection_results _result
Intersection_results intersection_type() const
Line_2_Line_2_pair< R >::Intersection_results intersection_type ( ) const

Definition at line 203 of file Line_2_Line_2_intersection.h.

References construct_if_finite(), denom, and is_finite().

Referenced by Segment_2_Segment_2_pair< R >::intersection_type().

204 {
205  typedef typename R::RT RT;
206  if (_known)
207  return _result;
208  RT nom1, nom2, denom;
209  // The non const this pointer is used to cast away const.
210  _known = true;
211  denom = _line1->a()*_line2->b() - _line2->a()*_line1->b();
212  if (denom == RT(0)) {
213  if (RT(0) == (_line1->a()*_line2->c() - _line2->a()*_line1->c()) &&
214  RT(0) == (_line1->b()*_line2->c() - _line2->b()*_line1->c()))
215  _result = LINE;
216  else
217  _result = NO;
218  return _result;
219  }
220  nom1 = (_line1->b()*_line2->c() - _line2->b()*_line1->c());
221  if (!::CGAL::is_finite(nom1)) {
222  _result = NO;
223  return _result;
224  }
225  nom2 = (_line2->a()*_line1->c() - _line1->a()*_line2->c());
226  if (!::CGAL::is_finite(nom2)) {
227  _result = NO;
228  return _result;
229  }
230  R dummyR;
232  nom1, nom2, denom, dummyR)){
233  _result = NO;
234  return _result;
235  }
236  _result = POINT;
237  return _result;
238 }
CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE bool construct_if_finite(POINT &pt, RT x, RT y, RT w, R &)
Intersection_results _result
RT c() const
Definition: Line_2.h:150
bool is_finite(double d)
Definition: double.h:190
RT b() const
Definition: Line_2.h:145
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
RT a() const
Definition: Line_2.h:140

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Point_2<R> _intersection_point
mutableprotected

Definition at line 119 of file Line_2_Line_2_intersection.h.

bool _known
mutableprotected

Definition at line 117 of file Line_2_Line_2_intersection.h.

Line_2<R> const* _line1
protected

Definition at line 115 of file Line_2_Line_2_intersection.h.

Line_2<R> const* _line2
protected

Definition at line 116 of file Line_2_Line_2_intersection.h.

Intersection_results _result
mutableprotected

Definition at line 118 of file Line_2_Line_2_intersection.h.


The documentation for this class was generated from the following file: