38 if ( mHalfWidth == 0.0 )
40 QVector<QgsPointXY> points = { mStartPoint, mEndPoint };
45 QVector<QgsPointXY> points = {
46 mStartPoint + vec * mHalfWidth,
47 mEndPoint + vec * mHalfWidth,
48 mEndPoint - vec * mHalfWidth,
49 mStartPoint - vec * mHalfWidth
78void QgsCrossSection::nudge(
double distance )
84 vec = vec.normalized().perpVector();
87 mStartPoint += offset;
93 return ( mStartPoint != mEndPoint ) && ( mHalfWidth > 0.0 );
@ Reverse
Reverse/inverse transform (from destination to source).
double halfWidth() const
Returns the half-width of the cross section.
QgsCrossSection()=default
Constructs an invalid cross section.
QgsGeometry asGeometry(const QgsCoordinateTransform *ct=nullptr) const
Returns the cross section extent as a geometry (Polygon or LineString).
void nudgeRight(double distance)
Nudges the cross section to the right by the specified distance.
bool isValid() const
Returns cross section validity.
void nudgeLeft(double distance)
Nudges the cross section to the left by the specified distance.
Custom exception class for Coordinate Reference System related exceptions.
A geometry is the spatial representation of a feature.
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false)
Transforms this geometry as described by the coordinate transform ct.
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
Represent a 2-dimensional vector.
QgsVector normalized() const
Returns the vector's normalized (or "unit") vector (ie same angle but length of 1....
QgsVector perpVector() const
Returns the perpendicular vector to this vector (rotated 90 degrees counter-clockwise).