PyANGKernel.GKSegment¶
- class GKSegment¶
Synopsis¶
Methods¶
def
__init__()def
distToPoint2D()def
distToPoint3D()def
expand2D()def
getLength2D()def
getLength3D()def
intersects2D()def
isPointAtLeft()def
isPointAtRight()def
onSegment2D()def
onSegment3D()def
parallelDist()def
pointAtDist()def
pointAtDist2D()def
rotate()def
set()def
toRectangle()def
translate()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
These points can contain the (x, y, z) coordinates. It can be used to contain a 2d segment as most of the methods for points have a default z value assigned to 0.
- PyANGKernel.GKSegment.from¶
- PyANGKernel.GKSegment.to¶
- __init__()¶
Creates a going with both initial and ending points set at (0, 0)
Creates a segment defining the initial (from) and end (to) points of this segment
It returns the angle between this segment and the segment ‘segment’ in radians between (-GKPI, GKPI). The convention followed is: the angle is positive if from the first segment to the second one the direction is counterclockwise. If the segments are parallel it returns 0.0
Returns the minimum distance from any point of the segment to the point p
Returns the minimum distance from any point of the segment to the point p
- expand2D(factor)¶
- Parameters:
factor – float
It enlarges the segment a distance equal to factor*segmentLength in each extreme. That is, when factor is 2 it will be added a part equal to twice the segment’s length in each end of the segment.
- expandFromBackOnwards(aIncrement)¶
- Parameters:
aIncrement – float
It enlarges the segment a distance equal to aIncrement from the back position onwards.
- getExpandedPointByLength(point, length)¶
getExpandedPointByLength. Finds the coordinates of the point, which belongs to the line (and is a prolongation of the segment) and the distance between it and the initial point equals to length UnknownCommand point - initial point UnknownCommand length - length between the initial point and the point we want to find UnknownCommand the expanded point
It returns the segment’s length taking into account only the x and y coordinates
It returns the segment’s length taking into account all 3 coordinates (x, y and z)
- getPerpendicularIntersectionPoint(point, segmentC)¶
getPerpendicularIntersectionPoint. Finds intersection point of a perpendicular to the segmentC (going through the point) with an initial segment UnknownCommand point - a point from which a perpendicular goes UnknownCommand segmentC - segment to which we find a perpendicular UnknownCommand the coordinates of intersection
getPointByLength. Finds the coordinates of the point, which belongs to the segment and the distance between it and the initial point equals to length UnknownCommand point - initial point UnknownCommand length - length between the initial point and the point we want to find UnknownCommand the found point
getPointProjection. Returns a projection of the point to the line that goes through the segment UnknownCommand point - initial point UnknownCommand - a projection point
- intersects2D(segment2[, inter=None[, includeVertexs=true[, epsilon=0.001]]])¶
It returns true if this segment intersects with segment2. If inter is provided the intersection point, if any, will be also returned. If includeVertexs is true, if the intersection point is one of the segment’s vertexes then true will also be returned. Epsilon is the error difference allowed to consider two values equal.
It returns true when the point p is located on then imaginary line that appears expanding the segment and at the left side of the “from” point of the segment. It returns false otherwise. The epsilon is defined to set the accuracy of the point on the line, that is, the distance at which the point can be located outside the line and considered as inside
It returns true when the point p is located on then imaginary line that appears expanding the segment and at the right side of the “to” point of the segment. It returns false otherwise. The epsilon is defined to set the accuracy of the point on the line, that is, the distance at which the point can be located outside the line and considered as inside
It return true is p is located at the right area of the segment, and false otherwise. If only x and y corrdinates are taken into account, the vectorial product between the vector that goes from ‘from’ to ‘p’ and the vector that goes from ‘from’ to ‘to’ will have the z positive if true is returned
If the point p is in the segment then the value returned is between 0 and 1, 0 when p equals to “from” and 1 when p equals to “to”. If p is in the segment line but outside the segment, it returns a value less than 0 when the nearest point is “from” and a value greater than 1 when the nearest point is “to”.
- onSegment2D(p, epsilon[, useVertexs=true])¶
This function returns true if the point “p” is on the segment taking into account the coordinates in the 2D space and with a maximum distance ‘epsilon’ to the segment. If useVertexs is true and p is a vertex of the segment it will return true and false otherwise
This function returns true if the point “p” is on the segment taking into account the coordinates in the 3D space and with a maximum distance ‘epsilon’ to the segment
Finds the parallel segment at distance “dist”, either at the right or at the left side.
It finds the point in the segment located at distance “dist” from the beginning of the segment. Note that the beginning is the point called “from”
It finds the point in the segment located at distance “dist” from the beginning of the segment, without taking into account the z coordinate, that is, in 2D. Note that the beginning is the point called “from”
It rotates this segment “angle” radians using “center” as the center point of the rotation
It sets the initial and end points of the segment to p1 and p2 respectively
Converts the segment into a rectangle expanding it width/2.0 in all four rectangle faces
Applies a translation delta