Represents a line segment between two points.
More...
#include <Segment2.h>
The Segment2
class defines a line segment between two points (Point2
objects).
◆ Segment2() [1/2]
CLASS_DECLSPEC GEOM_FADE2D::Segment2::Segment2 |
( |
const Point2 & |
src_, |
|
|
const Point2 & |
trg_ |
|
) |
| |
This constructor initializes the segment using two given Point2
objects as the source and target.
- Parameters
-
src_ | The first endpoint (source) of the segment. |
trg_ | The second endpoint (target) of the segment. |
◆ Segment2() [2/2]
CLASS_DECLSPEC GEOM_FADE2D::Segment2::Segment2 |
( |
| ) |
|
This constructor creates a default Segment2
object with the coordinates of both the source and target points initialized to -DBL_MAX.
◆ getSqLen2D()
CLASS_DECLSPEC double GEOM_FADE2D::Segment2::getSqLen2D |
( |
| ) |
const |
This function calculates the squared 2D length of the segment.
- Returns
- The squared 2D length of the segment.
◆ getSrc()
CLASS_DECLSPEC Point2 GEOM_FADE2D::Segment2::getSrc |
( |
| ) |
const |
This function returns the source point of the segment.
- Returns
- The source point as a
Point2
object.
◆ getTrg()
CLASS_DECLSPEC Point2 GEOM_FADE2D::Segment2::getTrg |
( |
| ) |
const |
This function returns the target point of the segment.
- Returns
- The target point as a
Point2
object.
◆ operator<()
bool GEOM_FADE2D::Segment2::operator< |
( |
const Segment2 & |
other | ) |
const |
|
inline |
This operator does not compare the lenghts but the source and target points for ordering purposes.
- Parameters
-
other | The other Segment2 object to compare. |
- Returns
true
if the current segment is considered less than the other segment, false
otherwise.
◆ operator==()
CLASS_DECLSPEC bool GEOM_FADE2D::Segment2::operator== |
( |
const Segment2 & |
other | ) |
const |
This operator checks whether two segments are equal. This check is undirected, it compares the points regardless of their order.
- Parameters
-
other | The other Segment2 object to compare. |
- Returns
true
if the two segments are equal, false
otherwise.
◆ swapSrcTrg()
CLASS_DECLSPEC void GEOM_FADE2D::Segment2::swapSrcTrg |
( |
| ) |
|
This function swaps the source and target points of the segment. After the operation, the previous target point becomes the source, and the previous source becomes the target.
◆ operator<<
CLASS_DECLSPEC friend std::ostream& operator<< |
( |
std::ostream & |
stream, |
|
|
Segment2 |
seg |
|
) |
| |
|
friend |
This operator prints a segment to an output stream.
- Parameters
-
stream | The output stream to which the segment is written. |
seg | The Segment2 object to output. |
- Returns
- The output stream with the segment data written to it.
The documentation for this class was generated from the following file: