proland::seg2< type > Struct Template Reference
[math]

A 2D segment. More...

#include <seg2.h>

List of all members.

Public Member Functions

 seg2 (const vec2< type > &a, const vec2< type > &b)
 Creates a new segment with the given extremities.
type lineDistSq (const vec2< type > &p) const
 Returns the square distance between the given point and the line defined by this segment.
type segmentDistSq (const vec2< type > &p) const
 Returns the square distance between the given point and this segment.
bool intersects (const seg2 &s) const
 Returns true if this segment intersects the given segment.
bool intersects (const seg2 &s, vec2< type > *i) const
 Returns true if this segment intersects the given segment.
bool intersects (const box2< type > &r) const
 Returns true if this segment is inside or intersects the given bounding box.
bool contains (const vec2< type > &p, type w) const
 Returns true if this segment, with the given width, contains the given point.

Public Attributes

vec2< type > a
 One of the segment extremity.
vec2< type > ab
 The vector joining a to the other segment extremity.

Detailed Description

template<typename type>
struct proland::seg2< type >

A 2D segment.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

template<typename type >
proland::seg2< type >::seg2 ( const vec2< type > &  a,
const vec2< type > &  b 
) [inline]

Creates a new segment with the given extremities.

Parameters:
a a segment extremity.
b the other segment extremity.

Member Function Documentation

template<typename type >
bool proland::seg2< type >::contains ( const vec2< type > &  p,
type  w 
) const [inline]

Returns true if this segment, with the given width, contains the given point.

More precisely this method returns true if the stroked path defined from this segment, with a cap "butt" style, contains the given point.

Parameters:
p a point.
w width of this segment.
template<typename type >
bool proland::seg2< type >::intersects ( const box2< type > &  r  )  const [inline]

Returns true if this segment is inside or intersects the given bounding box.

Parameters:
r a bounding box.
template<typename type >
bool proland::seg2< type >::intersects ( const seg2< type > &  s,
vec2< type > *  i 
) const [inline]

Returns true if this segment intersects the given segment.

If there is an intersection it is returned in the vector.

Parameters:
s a segment.
i where to store the intersection point, if any.
template<typename type >
bool proland::seg2< type >::intersects ( const seg2< type > &  s  )  const [inline]

Returns true if this segment intersects the given segment.

Parameters:
s a segment.
template<typename type >
type proland::seg2< type >::lineDistSq ( const vec2< type > &  p  )  const [inline]

Returns the square distance between the given point and the line defined by this segment.

Parameters:
p a point.
template<typename type >
type proland::seg2< type >::segmentDistSq ( const vec2< type > &  p  )  const [inline]

Returns the square distance between the given point and this segment.

Parameters:
p a point.

Member Data Documentation

template<typename type >
vec2<type> proland::seg2< type >::a

One of the segment extremity.

template<typename type >
vec2<type> proland::seg2< type >::ab

The vector joining a to the other segment extremity.


Generated on Sat May 12 09:41:36 2012 for proland by  doxygen 1.6.1