Class: QgsLineSegment2D¶
Represents a single 2D line segment, consisting of a 2D start and end vertex only.
Added in version 3.2.
Methods
Returns the segment's end point.  | 
|
Returns the segment's end x-coordinate.  | 
|
Returns the segment's end y-coordinate.  | 
|
Returns the length of the segment.  | 
|
Returns the squared length of the segment.  | 
|
Tests if a point is to the left of the line segment.  | 
|
Reverses the line segment, so that the start and end points are flipped.  | 
|
Sets the segment's end point.  | 
|
Sets the segment's end x coordinate.  | 
|
Sets the segment's end y coordinate.  | 
|
Sets the segment's start point.  | 
|
Sets the segment's start x coordinate.  | 
|
Sets the segment's start y coordinate.  | 
|
Returns the segment's start point.  | 
|
Returns the segment's start x-coordinate.  | 
|
Returns the segment's start y-coordinate.  | 
- class qgis.core.QgsLineSegment2D[source]¶
 Bases:
object- __init__(start: QgsPointXY, end: QgsPointXY)
 Constructor for a QgsLineSegment2D from the specified
startpoint to theendpoint.- Parameters:
 start (QgsPointXY)
end (QgsPointXY)
- __init__(x1: float, y1: float, x2: float, y2: float)
 Constructor for a QgsLineSegment2D from the point (
x1,y2) to (x2,y2).- Parameters:
 x1 (float)
y1 (float)
x2 (float)
y2 (float)
- __init__(a0: QgsLineSegment2D)
 - Parameters:
 a0 (QgsLineSegment2D)
- end(self) QgsPointXY[source]¶
 Returns the segment’s end point.
See also
See also
See also
- Return type:
 
- endX(self) float[source]¶
 Returns the segment’s end x-coordinate.
See also
See also
- Return type:
 float
- endY(self) float[source]¶
 Returns the segment’s end y-coordinate.
See also
See also
- Return type:
 float
- lengthSquared(self) float[source]¶
 Returns the squared length of the segment.
See also
- Return type:
 float
- pointLeftOfLine(self, point: QgsPointXY) int[source]¶
 Tests if a
pointis to the left of the line segment.Returns -1 if the point falls to the left of the line, or +1 if the point is to the right.
If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly on the line, or exactly in line with the segment) and the result is undefined.
See also
- Parameters:
 point (QgsPointXY)
- Return type:
 int
- setEnd(self, end: QgsPointXY)[source]¶
 Sets the segment’s
endpoint.See also
See also
See also
- Parameters:
 end (QgsPointXY)
- setEndX(self, x: float)[source]¶
 Sets the segment’s end
xcoordinate.See also
See also
See also
- Parameters:
 x (float)
- setEndY(self, y: float)[source]¶
 Sets the segment’s end
ycoordinate.See also
See also
See also
- Parameters:
 y (float)
- setStart(self, start: QgsPointXY)[source]¶
 Sets the segment’s
startpoint.See also
See also
See also
- Parameters:
 start (QgsPointXY)
- setStartX(self, x: float)[source]¶
 Sets the segment’s start
xcoordinate.See also
See also
See also
- Parameters:
 x (float)
- setStartY(self, y: float)[source]¶
 Sets the segment’s start
ycoordinate.See also
See also
See also
- Parameters:
 y (float)
- start(self) QgsPointXY[source]¶
 Returns the segment’s start point.
See also
See also
See also
- Return type: