#include <qgarlib/GenSegment.H>
Inheritance diagram for qgar::GenSegment< T >:

O
+---------------> X
|\ |
| \ <-'
| \ angle (in radians, unless specified)
| \
|
v
Y
O
+---------------> X
|
| + source
| /
| /
| v
| + target
v
Y
Computational geometry equations can be found in the FAQ section of comp.graphics.algorithms and are based on [Kirk, 1992], pages 199-202, and [O'Rourke, 1994], pages 249-51.
Definition at line 131 of file _QGAR_GenSegment.H.
Public Types | |
Types | |
| typedef T | value_type |
| Type of the source and target coordinates. | |
| typedef value_type & | reference |
| Reference to qgar::GenSegment::value_type. | |
| typedef const value_type & | const_reference |
| Constant reference to qgar::GenSegment::value_type. | |
| typedef value_type * | pointer |
| Pointer to qgar::GenSegment::value_type. | |
| typedef const value_type * | const_pointer |
| Constant pointer to qgar::GenSegment::value_type. | |
Public Member Functions | |
| template<> | |
| bool | contains (const GenPoint< double > &c, double aDist) |
Access to source and target | |
| const GenPoint< value_type > & | accessSource () const |
| Get source point. | |
| GenPoint< value_type > | source () const |
| Get a copy of the source point. | |
| const GenPoint< value_type > & | accessTarget () const |
| Get target point. | |
| GenPoint< value_type > | target () const |
| Get a copy of the target point. | |
Access to separate coordinates | |
| value_type | xSource () const |
| Get X coordinate of the source point. | |
| value_type | xTarget () const |
| Get X coordinate of the target point. | |
| value_type | ySource () const |
| Get Y coordinate of the source point. | |
| value_type | yTarget () const |
| Get Y coordinate of the target point. | |
Access to geometrical characteristics | |
| value_type | dx () const |
| Difference between target and source X coordinates. | |
| value_type | dy () const |
| Difference between target and source Y coordinates. | |
Set source and/or target without update | |
| void | setSource (value_type aX, value_type aY) |
| Set source point. | |
| void | setSource (const GenPoint< value_type > &aPt) |
| Set source point. | |
| void | setTarget (value_type aX, value_type aY) |
| Set target point. | |
| void | setTarget (const GenPoint< value_type > &aPt) |
| Set target point. | |
| void | setSourceTarget (value_type aXSource, value_type aYSource, value_type aXTarget, value_type aYTarget) |
| Set both source and target points. | |
| void | setSourceTarget (const GenPoint< value_type > &aSource, const GenPoint< value_type > &aTarget) |
| Set both source and target points. | |
Set source and/or target with update | |
| void | fixSource (value_type aX, value_type aY) |
| Set source point. | |
| void | fixSource (const GenPoint< value_type > &aPt) |
| Set source point. | |
| void | fixTarget (value_type aX, value_type aY) |
| Set target point. | |
| void | fixTarget (const GenPoint< value_type > &aPt) |
| Set target point. | |
| void | fixSourceTarget (value_type aXSource, value_type aYSource, value_type aXTarget, value_type aYTarget) |
| Set both source and target points. | |
| void | fixSourceTarget (const GenPoint< value_type > &aSource, const GenPoint< value_type > &aTarget) |
| Set both source and target points. | |
Set separate (source and target) coordinates without update | |
| void | setXSource (value_type aX) |
| Set X coordinate of the source point. | |
| void | setXTarget (value_type aX) |
| Set X coordinate of the target point. | |
| void | setYSource (value_type aY) |
| Set Y coordinate of the source point. | |
| void | setYTarget (value_type aY) |
| Set Y coordinate of the target point. | |
Set separate (source and target) coordinates with update | |
| void | fixXSource (value_type aX) |
| Set X coordinate of the source point. | |
| void | fixXTarget (value_type aX) |
| Set X coordinate of the target point. | |
| void | fixYSource (value_type aY) |
| Set Y coordinate of the source point. | |
| void | fixYTarget (value_type aY) |
| Set Y coordinate of the target point. | |
Constructors | |
| GenSegment () | |
| Default constructor. | |
| GenSegment (const GenSegment< value_type > &aSeg) | |
| Copy constructor. | |
| GenSegment (const GenQgarSegment< value_type > &aQSeg) | |
| Initialize from a Qgar segment. | |
| GenSegment (const GenPoint< value_type > &aSource, const GenPoint< value_type > &aTarget) | |
| Initialize from source and target points. | |
| GenSegment (const value_type aXSource, const value_type aYSource, const value_type aXTarget, const value_type aYTarget) | |
| Initialize from coordinates. | |
Destructor | |
| virtual | ~GenSegment () |
| Virtual destructor. | |
Copy | |
| virtual GenSegment< value_type > * | clone () const |
| Return a deep copy of the surrent segment. | |
Access to geometrical features | |
| double | length () const |
| Get length of the segment. | |
| double | sqr_length () const |
| Get squared length of the segment. | |
| double | rho () const |
| Distance between point (0,0) and its perpendicular projection onto the line supporting the segment. | |
| double | theta () const |
| Angle between the X axis and the segment, in [0,2PI[ radians. | |
| double | angle () const |
| Same as qgar::GenSegment::theta. | |
| double | slope () const |
| Angle between the X axis and the segment, in [0,PI[ radians. | |
| double | thetaDegrees () const |
| Same as qgar::GenSegment::theta, but the result is given in [0,360[ degrees. | |
| double | angleDegrees () const |
| Same as qgar::GenSegment::theta, but the result is given in [0,360[ degrees. | |
| double | slopeDegrees () const |
| Same as qgar::GenSegment::slope, but the result is given in [0,180[ degrees. | |
Geometrical predicates | |
| bool | contains (const GenPoint< T > &c, double aDist=Math::epsilonD()) |
| Return true if the given point approximately belongs to the current segment. | |
Operators | |
| GenSegment< value_type > & | operator= (const GenSegment< value_type > &aSeg) |
| Assignment. | |
| bool | operator== (const GenSegment< value_type > &aSeg) const |
| Same as function qgar::GenSegment::eq. | |
| bool | operator!= (const GenSegment< value_type > &aSeg) const |
| Same as function qgar::GenSegment::notEq. | |
Functional operators | |
| bool | eq (const GenSegment< value_type > &aSeg) const |
| Equality. | |
| bool | notEq (const GenSegment< value_type > &aSeg) const |
| Inequality. | |
Geometry: Translation | |
| virtual void | translate (value_type aTransX, value_type aTransY) |
| Translate current segment along X and Y axis. | |
Serialization/deserialization | |
| virtual std::istream & | read (std::istream &anInStream) |
| Deserializes the current segment from an input stream. | |
| virtual std::ostream & | write (std::ostream &anOutStream) const |
| Serializes the current segment to an input stream. | |
Access to source and target | |
| const GenPoint< value_type > & | accessSource () const |
| Get source point. | |
| GenPoint< value_type > | source () const |
| Get a copy of the source point. | |
| const GenPoint< value_type > & | accessTarget () const |
| Get target point. | |
| GenPoint< value_type > | target () const |
| Get a copy of the target point. | |
Access to separate coordinates | |
| value_type | xSource () const |
| Get X coordinate of the source point. | |
| value_type | xTarget () const |
| Get X coordinate of the target point. | |
| value_type | ySource () const |
| Get Y coordinate of the source point. | |
| value_type | yTarget () const |
| Get Y coordinate of the target point. | |
Access to geometrical characteristics | |
| value_type | dx () const |
| Difference between target and source X coordinates. | |
| value_type | dy () const |
| Difference between target and source Y coordinates. | |
Set source and/or target without update | |
| void | setSource (value_type aX, value_type aY) |
| Set source point. | |
| void | setSource (const GenPoint< value_type > &aPt) |
| Set source point. | |
| void | setTarget (value_type aX, value_type aY) |
| Set target point. | |
| void | setTarget (const GenPoint< value_type > &aPt) |
| Set target point. | |
| void | setSourceTarget (value_type aXSource, value_type aYSource, value_type aXTarget, value_type aYTarget) |
| Set both source and target points. | |
| void | setSourceTarget (const GenPoint< value_type > &aSource, const GenPoint< value_type > &aTarget) |
| Set both source and target points. | |
Set source and/or target with update | |
| void | fixSource (value_type aX, value_type aY) |
| Set source point. | |
| void | fixSource (const GenPoint< value_type > &aPt) |
| Set source point. | |
| void | fixTarget (value_type aX, value_type aY) |
| Set target point. | |
| void | fixTarget (const GenPoint< value_type > &aPt) |
| Set target point. | |
| void | fixSourceTarget (value_type aXSource, value_type aYSource, value_type aXTarget, value_type aYTarget) |
| Set both source and target points. | |
| void | fixSourceTarget (const GenPoint< value_type > &aSource, const GenPoint< value_type > &aTarget) |
| Set both source and target points. | |
Set separate (source and target) coordinates without update | |
| void | setXSource (value_type aX) |
| Set X coordinate of the source point. | |
| void | setXTarget (value_type aX) |
| Set X coordinate of the target point. | |
| void | setYSource (value_type aY) |
| Set Y coordinate of the source point. | |
| void | setYTarget (value_type aY) |
| Set Y coordinate of the target point. | |
Set separate (source and target) coordinates with update | |
| void | fixXSource (value_type aX) |
| Set X coordinate of the source point. | |
| void | fixXTarget (value_type aX) |
| Set X coordinate of the target point. | |
| void | fixYSource (value_type aY) |
| Set Y coordinate of the source point. | |
| void | fixYTarget (value_type aY) |
| Set Y coordinate of the target point. | |
Protected Member Functions | |
Updates subsequent to source and target modifications | |
| virtual void | updateSource () |
| Update the geometrical structure when the source has been changed. | |
| virtual void | updateTarget () |
| Update the geometrical structure when the target has been changed. | |
| virtual void | updateSourceTarget () |
| Update the geometrical structure when both source and target have been changed. | |
Protected Attributes | |
Source and target | |
Apply a central symmetry to the current primitive, using the point of given coordinates as the symmetry center. Apply a central symmetry to the current primitive, using the given point as the symmetry center. Apply a mirror symmetry to the current primitive, using the line passing through the two given points for the symmetry. Apply a mirror symmetry to the current primitive, using the line supporting the given segment for the symmetry. | |
| GenPoint< value_type > | _source |
| Source point. | |
| GenPoint< value_type > | _target |
| Target point. | |
Source and target | |
Apply a central symmetry to the current primitive, using the point of given coordinates as the symmetry center. Apply a central symmetry to the current primitive, using the given point as the symmetry center. Apply a mirror symmetry to the current primitive, using the line passing through the two given points for the symmetry. Apply a mirror symmetry to the current primitive, using the line supporting the given segment for the symmetry. | |
| GenPoint< value_type > | _source |
| Source point. | |
| GenPoint< value_type > | _target |
| Target point. | |
|
|||||
|
Constant pointer to qgar::GenSegment::value_type.
Reimplemented from qgar::AbstractGenPrimitive< T >. Definition at line 170 of file _QGAR_GenSegment.H. |
|
|||||
|
Constant reference to qgar::GenSegment::value_type.
Reimplemented from qgar::AbstractGenPrimitive< T >. Definition at line 160 of file _QGAR_GenSegment.H. |
|
|||||
|
Pointer to qgar::GenSegment::value_type.
Reimplemented from qgar::AbstractGenPrimitive< T >. Definition at line 165 of file _QGAR_GenSegment.H. |
|
|||||
|
Reference to qgar::GenSegment::value_type.
Reimplemented from qgar::AbstractGenPrimitive< T >. Definition at line 155 of file _QGAR_GenSegment.H. |
|
|||||
|
Type of the source and target coordinates.
Reimplemented from qgar::AbstractGenPrimitive< T >. Definition at line 150 of file _QGAR_GenSegment.H. |
|
|||||||||
|
Default constructor. Zero-length segment located at the origin of the coordinate system.
Definition at line 59 of file _QGAR_GenSegment.TCC. |
|
||||||||||
|
Copy constructor.
|
|
||||||||||
|
Initialize from a Qgar segment.
Definition at line 80 of file _QGAR_GenSegment.TCC. |
|
||||||||||||||||
|
Initialize from source and target points.
|
|
||||||||||||||||||||||||
|
Initialize from coordinates.
Definition at line 106 of file _QGAR_GenSegment.TCC. |
|
|||||||||
|
Virtual destructor.
Definition at line 123 of file _QGAR_GenSegment.TCC. |
|
|||||||||
|
Get source point.
Definition at line 143 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::_source. Referenced by qgar::AbstractGenQgarPrimitive< T >::accessSource(). |
|
|||||||||
|
Get target point.
Definition at line 163 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::_target. Referenced by qgar::AbstractGenQgarPrimitive< T >::accessTarget(), and qgar::GenSegment< T >::slope(). |
|
|||||||||
|
Same as qgar::GenSegment::theta.
Definition at line 291 of file _QGAR_GenSegment.TCC. References qgar::GenSegment< T >::theta(). Referenced by qgar::GenQgarSegment< T >::angle(). |
|
|||||||||
|
Same as qgar::GenSegment::theta, but the result is given in [0,360[ degrees.
Definition at line 310 of file _QGAR_GenSegment.TCC. References qgar::qgRadiansToDegrees(). Referenced by qgar::GenQgarSegment< T >::angleDegrees(). |
|
|||||||||
|
Return a deep copy of the surrent segment.
Implements qgar::AbstractGenPrimitive< T >. Definition at line 136 of file _QGAR_GenSegment.TCC. |
|
||||||||||||||||
|
||||||||||||||||
|
Return true if the given point approximately belongs to the current segment. Here, ''to belong'' means to be at a distance smaller or equal to the given threshold from somed point between the source and the target of the segment.
Definition at line 345 of file _QGAR_GenSegment.TCC. References qgar::GenSegment< T >::length(), qgar::qgDist(), qgar::GenPoint< T >::x(), qgar::AbstractGenPrimitive< T >::xSource(), qgar::AbstractGenPrimitive< T >::xTarget(), qgar::GenPoint< T >::y(), qgar::AbstractGenPrimitive< T >::ySource(), and qgar::AbstractGenPrimitive< T >::yTarget(). Referenced by qgar::GenQgarSegment< T >::contains(). |
|
|||||||||
|
Difference between target and source X coordinates.
Definition at line 233 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::_source, qgar::AbstractGenPrimitive< T >::_target, and qgar::GenPoint< T >::x(). Referenced by qgar::GenSegment< T >::contains(), and qgar::AbstractGenQgarPrimitive< T >::dx(). |
|
|||||||||
|
Difference between target and source Y coordinates.
Definition at line 243 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::_source, qgar::AbstractGenPrimitive< T >::_target, and qgar::GenPoint< T >::y(). Referenced by qgar::GenSegment< T >::contains(), qgar::AbstractGenQgarPrimitive< T >::dy(), and qgar::GenSegment< T >::length(). |
|
||||||||||
|
Equality.
Referenced by qgar::GenQgarSegment< T >::eq(). |
|
||||||||||
|
Set source point.
|
|
||||||||||||||||
|
Set source point.
Definition at line 327 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setSource(), and qgar::AbstractGenPrimitive< T >::updateSource(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixSource(). |
|
||||||||||||||||
|
Set both source and target points.
|
|
||||||||||||||||||||||||
|
Set both source and target points.
Definition at line 369 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setSourceTarget(), and qgar::AbstractGenPrimitive< T >::updateSourceTarget(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixSourceTarget(). |
|
||||||||||
|
Set target point.
|
|
||||||||||||||||
|
Set target point.
Definition at line 348 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setTarget(), and qgar::AbstractGenPrimitive< T >::updateTarget(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixTarget(). |
|
||||||||||
|
Set X coordinate of the source point.
Definition at line 443 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setXSource(), and qgar::AbstractGenPrimitive< T >::updateSource(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixXSource(). |
|
||||||||||
|
Set X coordinate of the target point.
Definition at line 454 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setXTarget(), and qgar::AbstractGenPrimitive< T >::updateTarget(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixXTarget(). |
|
||||||||||
|
Set Y coordinate of the source point.
Definition at line 465 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setYSource(), and qgar::AbstractGenPrimitive< T >::updateSource(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixYSource(). |
|
||||||||||
|
Set Y coordinate of the target point.
Definition at line 476 of file _QGAR_AbstractGenPrimitive.TCC. References qgar::AbstractGenPrimitive< T >::setYTarget(), and qgar::AbstractGenPrimitive< T >::updateTarget(). Referenced by qgar::AbstractGenQgarPrimitive< T >::fixYTarget(). |
|
|||||||||
|
Get length of the segment.
Reimplemented in qgar::WDSegment. Definition at line 151 of file _QGAR_GenSegment.TCC. References qgar::AbstractGenPrimitive< T >::dy(). Referenced by qgar::GenSegment< T >::contains(), qgar::GenQgarSegment< T >::length(), qgar::GenSegment< T >::rho(), and qgar::GenSegment< T >::sqr_length(). |
|
||||||||||
|
Inequality.
|
|
||||||||||
|
Same as function qgar::GenSegment::notEq.
|
|
||||||||||
|
Assignment.
|
| |||||||