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

#include <LineS2.h>

Public Member Functions

 LineS2 ()
 
 LineS2 (const PointS2< FT > &p, const PointS2< FT > &q)
 
 LineS2 (const FT &a, const FT &b, const FT &c)
 
 LineS2 (const SegmentS2< FT > &s)
 
 LineS2 (const RayS2< FT > &r)
 
 LineS2 (const PointS2< FT > &p, const DirectionS2< FT > &d)
 
bool operator== (const LineS2< FT > &l) const
 
bool operator!= (const LineS2< FT > &l) const
 
FT a () const
 
FT b () const
 
FT c () const
 
FT x_at_y (const FT &y) const
 
FT y_at_x (const FT &x) const
 
LineS2< FT > perpendicular (const PointS2< FT > &p) const
 
LineS2< FT > opposite () const
 
PointS2< FT > point (int i) const
 
PointS2< FT > point () const
 
PointS2< FT > projection (const PointS2< FT > &p) const
 
DirectionS2< FT > direction () const
 
Oriented_side oriented_side (const PointS2< FT > &p) const
 
bool has_on_boundary (const PointS2< FT > &p) const
 
bool has_on_positive_side (const PointS2< FT > &p) const
 
bool has_on_negative_side (const PointS2< FT > &p) const
 
bool is_horizontal () const
 
bool is_vertical () const
 
bool is_degenerate () const
 
LineS2< FT > transform (const Aff_transformationS2< FT > &t) const
 
void new_rep (const PointS2< FT > &p, const PointS2< FT > &q)
 
void new_rep (const FT &a, const FT &b, const FT &c)
 

Public Attributes

FT e0
 
FT e1
 
FT e2
 

Detailed Description

template<class FT>
class LineS2< FT >

Definition at line 62 of file LineS2.h.

Constructor & Destructor Documentation

LineS2 ( )
inline

Definition at line 117 of file LineS2.h.

118 {}
LineS2 ( const PointS2< FT > &  p,
const PointS2< FT > &  q 
)
inline

Definition at line 140 of file LineS2.h.

141 { new_rep(p,q); }
void new_rep(const PointS2< FT > &p, const PointS2< FT > &q)
Definition: LineS2.h:122
LineS2 ( const FT &  a,
const FT &  b,
const FT &  c 
)
inline

Definition at line 145 of file LineS2.h.

146 { new_rep(a,b,c); }
FT b() const
Definition: LineS2.h:193
void new_rep(const PointS2< FT > &p, const PointS2< FT > &q)
Definition: LineS2.h:122
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198
LineS2 ( const SegmentS2< FT > &  s)
inline

Definition at line 150 of file LineS2.h.

References SegmentS2< FT >::end(), and SegmentS2< FT >::start().

151 { new_rep( s.start(), s.end()); }
void new_rep(const PointS2< FT > &p, const PointS2< FT > &q)
Definition: LineS2.h:122
const PointS2< FT > & start() const
Definition: SegmentS2.h:128
const PointS2< FT > & end() const
Definition: SegmentS2.h:134

Here is the call graph for this function:

LineS2 ( const RayS2< FT > &  r)
inline

Definition at line 155 of file LineS2.h.

References RayS2< FT >::second_point(), and RayS2< FT >::start().

156 { new_rep(r.start(), r.second_point()); }
void new_rep(const PointS2< FT > &p, const PointS2< FT > &q)
Definition: LineS2.h:122
PointS2< FT > second_point() const
Definition: RayS2.h:128
const PointS2< FT > & start() const
Definition: RayS2.h:116

Here is the call graph for this function:

CGAL_KERNEL_INLINE LineS2 ( const PointS2< FT > &  p,
const DirectionS2< FT > &  d 
)

Definition at line 160 of file LineS2.h.

References DirectionS2< FT >::dx(), DirectionS2< FT >::dy(), PointS2< FT >::x(), and PointS2< FT >::y().

161 { new_rep(-d.dy(), d.dx(), -d.dx()* p.y() + d.dy() * p.x()); }
void new_rep(const PointS2< FT > &p, const PointS2< FT > &q)
Definition: LineS2.h:122
FT dx() const
Definition: DirectionS2.h:217
FT dy() const
Definition: DirectionS2.h:223

Here is the call graph for this function:

Member Function Documentation

FT a ( ) const
inline

Definition at line 188 of file LineS2.h.

Referenced by LineS2< FT >::operator==().

189 { return e0; }
FT e0
Definition: LineS2.h:108

Here is the caller graph for this function:

FT b ( ) const
inline

Definition at line 193 of file LineS2.h.

Referenced by LineS2< FT >::operator==().

194 { return e1; }
FT e1
Definition: LineS2.h:109

Here is the caller graph for this function:

FT c ( ) const
inline

Definition at line 198 of file LineS2.h.

Referenced by LineS2< FT >::operator==().

199 { return e2; }
FT e2
Definition: LineS2.h:110

Here is the caller graph for this function:

DirectionS2< FT > direction ( ) const
inline

Definition at line 270 of file LineS2.h.

Referenced by Aff_transformationS2< FT >::transform().

271 { return DirectionS2<FT>( b(), -a() ); }
FT b() const
Definition: LineS2.h:193
FT a() const
Definition: LineS2.h:188

Here is the caller graph for this function:

bool has_on_boundary ( const PointS2< FT > &  p) const
inline

Definition at line 280 of file LineS2.h.

References PointS2< FT >::x(), and PointS2< FT >::y().

281 { return (a()*p.x() + b()*p.y() + c()) == FT(0); }
FT b() const
Definition: LineS2.h:193
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198

Here is the call graph for this function:

CGAL_KERNEL_INLINE bool has_on_negative_side ( const PointS2< FT > &  p) const

Definition at line 290 of file LineS2.h.

References PointS2< FT >::x(), and PointS2< FT >::y().

291 { return (a()*p.x() + b()*p.y() + c()) < FT(0); }
FT b() const
Definition: LineS2.h:193
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198

Here is the call graph for this function:

bool has_on_positive_side ( const PointS2< FT > &  p) const
inline

Definition at line 285 of file LineS2.h.

References PointS2< FT >::x(), and PointS2< FT >::y().

286 { return (a()*p.x() + b()*p.y() + c()) > FT(0); }
FT b() const
Definition: LineS2.h:193
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198

Here is the call graph for this function:

bool is_degenerate ( ) const
inline

Definition at line 305 of file LineS2.h.

306 { return (a() == FT(0)) && (b() == FT(0)) ; }
FT b() const
Definition: LineS2.h:193
FT a() const
Definition: LineS2.h:188
bool is_horizontal ( ) const
inline

Definition at line 295 of file LineS2.h.

296 { return a() == FT(0) ; }
FT a() const
Definition: LineS2.h:188
bool is_vertical ( ) const
inline

Definition at line 300 of file LineS2.h.

301 { return b() == FT(0) ; }
FT b() const
Definition: LineS2.h:193
CGAL_KERNEL_INLINE void new_rep ( const PointS2< FT > &  p,
const PointS2< FT > &  q 
)

Definition at line 122 of file LineS2.h.

References PointS2< FT >::x(), and PointS2< FT >::y().

123 {
124  e0 = p.y() - q.y();
125  e1 = q.x() - p.x();
126  e2 = p.x()*q.y() - p.y()*q.x();
127 }
FT e1
Definition: LineS2.h:109
FT e2
Definition: LineS2.h:110
FT e0
Definition: LineS2.h:108

Here is the call graph for this function:

CGAL_KERNEL_INLINE void new_rep ( const FT &  a,
const FT &  b,
const FT &  c 
)

Definition at line 131 of file LineS2.h.

132 {
133  e0 = a;
134  e1 = b;
135  e2 = c;
136 }
FT b() const
Definition: LineS2.h:193
FT e1
Definition: LineS2.h:109
FT e2
Definition: LineS2.h:110
FT e0
Definition: LineS2.h:108
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198
bool operator!= ( const LineS2< FT > &  l) const
inline

Definition at line 183 of file LineS2.h.

184 { return !(*this == l); }
CGAL_KERNEL_MEDIUM_INLINE bool operator== ( const LineS2< FT > &  l) const

Definition at line 166 of file LineS2.h.

References LineS2< FT >::a(), LineS2< FT >::b(), LineS2< FT >::c(), CGAL_NTS, and sign().

167 {
168  if ( (a() * l.c() != l.a() * c())
169  ||(b() * l.c() != l.b() * c()) )
170  return false;
171  int sc = CGAL_NTS sign(c());
172  int slc = CGAL_NTS sign(l.c());
173  if ( sc == slc )
174  return (sc == 0) ? ( a()*l.b() == b()*l.a() )
175  && (CGAL_NTS sign(a() ) == CGAL_NTS sign( l.a() ))
176  && (CGAL_NTS sign(b() ) == CGAL_NTS sign( l.b() ))
177  : true;
178  return false;
179 }
FT b() const
Definition: LineS2.h:193
static SURF_BEGIN_NAMESPACE double sign(double x)
FT a() const
Definition: LineS2.h:188
#define CGAL_NTS
FT c() const
Definition: LineS2.h:198

Here is the call graph for this function:

LineS2< FT > opposite ( ) const
inline

Definition at line 226 of file LineS2.h.

227 { return LineS2<FT>( -a(), -b(), -c() ); }
FT b() const
Definition: LineS2.h:193
Definition: LineS2.h:62
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198
CGAL_KERNEL_INLINE Oriented_side oriented_side ( const PointS2< FT > &  p) const

Definition at line 275 of file LineS2.h.

References CGAL_NTS, sign(), PointS2< FT >::x(), and PointS2< FT >::y().

276 { return Oriented_side(CGAL_NTS sign(a()*p.x() + b()*p.y() + c())); }
FT b() const
Definition: LineS2.h:193
static SURF_BEGIN_NAMESPACE double sign(double x)
Oriented_side
Definition: enum.h:78
FT a() const
Definition: LineS2.h:188
#define CGAL_NTS
FT c() const
Definition: LineS2.h:198

Here is the call graph for this function:

LineS2< FT > perpendicular ( const PointS2< FT > &  p) const
inline

Definition at line 221 of file LineS2.h.

References PointS2< FT >::x(), and PointS2< FT >::y().

222 { return LineS2<FT>( -b() , a() , b() * p.x() - a() * p.y() ); }
FT b() const
Definition: LineS2.h:193
Definition: LineS2.h:62
FT a() const
Definition: LineS2.h:188

Here is the call graph for this function:

CGAL_KERNEL_MEDIUM_INLINE PointS2< FT > point ( int  i) const

Definition at line 231 of file LineS2.h.

Referenced by Aff_transformationS2< FT >::transform().

232 {
233  if (i == 0)
234  return is_vertical() ? PointS2<FT>( (-b()-c())/a(), FT(1) )
235  : PointS2<FT>( FT(1), -(a()+c())/b());
236  if (i == 1)
237  return is_vertical() ? PointS2<FT>( (-b()-c())/a() + b(), FT(1) - a() )
238  : PointS2<FT>( FT(1) + b(), -(a()+c())/b() - a() );
239  // we add i times the direction
240  if (is_vertical())
241  return PointS2<FT>( (-b()-c())/a() + FT(i)*b(), FT(1) - FT(i)*a() );
242  return PointS2<FT>( FT(1) + FT(i)*b(), -(a()+c())/b() - FT(i)*a() );
243 }
FT b() const
Definition: LineS2.h:193
bool is_vertical() const
Definition: LineS2.h:300
blockLoc i
Definition: read.cpp:79
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198

Here is the caller graph for this function:

CGAL_KERNEL_INLINE PointS2< FT > point ( ) const

Definition at line 247 of file LineS2.h.

248 {
249  return is_vertical() ? PointS2<FT>( (-b()-c())/a(), FT(1) )
250  : PointS2<FT>( FT(1), -(a()+c())/b());
251 }
FT b() const
Definition: LineS2.h:193
bool is_vertical() const
Definition: LineS2.h:300
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198
CGAL_KERNEL_MEDIUM_INLINE PointS2< FT > projection ( const PointS2< FT > &  p) const

Definition at line 255 of file LineS2.h.

References PointS2< FT >::x(), PointS2< FT >::y(), and y.

256 {
257  if (is_horizontal())
258  return PointS2<FT>(p.x(), -c()/b());
259 
260  if (is_vertical())
261  return PointS2<FT>( -c()/a(), p.y());
262 
263  FT ab = a()/b(), ba = b()/a(), ca = c()/a();
264  FT y = ( -p.x() + ab*p.y() - ca ) / ( ba + ab );
265  return PointS2<FT>(-ba * y - ca, y);
266 }
FT b() const
Definition: LineS2.h:193
void int int REAL REAL * y
Definition: read.cpp:74
bool is_vertical() const
Definition: LineS2.h:300
bool is_horizontal() const
Definition: LineS2.h:295
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198

Here is the call graph for this function:

LineS2< FT > transform ( const Aff_transformationS2< FT > &  t) const
inline

Definition at line 310 of file LineS2.h.

References Aff_transformationS2< FT >::transform().

311 { return LineS2<FT>( t.transform(point(0) ), t.transform(direction() )); }
DirectionS2< FT > direction() const
Definition: LineS2.h:270
PointS2< FT > point() const
Definition: LineS2.h:247
Definition: LineS2.h:62
PointS2< FT > transform(const PointS2< FT > &p) const

Here is the call graph for this function:

CGAL_KERNEL_INLINE FT x_at_y ( const FT &  y) const

Definition at line 203 of file LineS2.h.

References CGAL_kernel_precondition_msg.

204 {
205  CGAL_kernel_precondition_msg( (a() != FT(0)),
206  "Line::x_at_y(const FT& y) is undefined for horizontal line" );
207  return ( -b()*y - c() ) / a();
208 }
#define CGAL_kernel_precondition_msg(EX, MSG)
FT b() const
Definition: LineS2.h:193
void int int REAL REAL * y
Definition: read.cpp:74
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198
CGAL_KERNEL_INLINE FT y_at_x ( const FT &  x) const

Definition at line 212 of file LineS2.h.

References CGAL_kernel_precondition_msg.

213 {
214  CGAL_kernel_precondition_msg( (b() != FT(0)),
215  "Line::x_at_y(const FT& y) is undefined for vertical line");
216  return ( -a()*x - c() ) / b();
217 }
#define CGAL_kernel_precondition_msg(EX, MSG)
FT b() const
Definition: LineS2.h:193
void int int REAL * x
Definition: read.cpp:74
FT a() const
Definition: LineS2.h:188
FT c() const
Definition: LineS2.h:198

Member Data Documentation

FT e0

Definition at line 108 of file LineS2.h.

FT e1

Definition at line 109 of file LineS2.h.

FT e2

Definition at line 110 of file LineS2.h.


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