PyANGKernel.GKLine

class GKLine

Synopsis

Methods

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

Class that defines a 2D line and contains methods for the most common greometrical operations over a line.

PyANGKernel.GKLine.slope
PyANGKernel.GKLine.coef
PyANGKernel.GKLine.fromX
PyANGKernel.GKLine.fromY
PyANGKernel.GKLine.toX
PyANGKernel.GKLine.toY
__init__()
__init__(p, v)
Parameters:
__init__(p1, p2)
Parameters:
__init__(p1, slope)
Parameters:
angleBetweenLines(line2)
Parameters:

line2GKLine

Return type:

float

Returns the minimum angle in radians ( between 0 and GKPI/2) this two lines make. If lines are parallel DBL_MAX is returned. If lines are the same 0 is returned.

angleBetweenLinesComplete(line2)
Parameters:

line2GKLine

Return type:

float

Returns the minimum angle in radians (between -GKPI and GKPI) this two lines make. If lines are parallel DBL_MAX is returned. If lines are the same 0 is returned.

contains(p[, epsilon=0.1])
Parameters:
Return type:

bool

It returns true if p is located inside the line or false otherwise.

distToPoint2D(p)
Parameters:

pGKPoint

Return type:

float

Returns the minimum distance from any point of the line to the point p.

intersects(line2, point[, epsilon=0.001])
Parameters:
Return type:

bool

If this and line2 intersect returns true and finds the intersection point p. Remember that lines perpendicular to the x axis are codified with slope = DBL_MAX and coef = x. Epsilon is the allowed difference between slopes to consider both lines parallel.

intersectsPerpendicular(p_per, p_intersec)
Parameters:
Return type:

bool

Returns true if there is a perpendicular line to this one that ges by p_per. If so, the point in this line that is the intersection (p_intersec) is also calculated and returned.

parallelLineAtDist(p1, p2, side, dist)
Parameters:
Return type:

GKLine

Given a vector in this line from p1 to p2, finds the parallel line at distance dist, either at the right (side = 0) or at the left side of the vector.

perpendicularLineAtPoint(point)
Parameters:

pointGKPoint

Return type:

GKLine

Returns the perpendicular line that goes by point. If this line is parallel to the x axis then the perpendicular that is returned is codified with slope = DBL_MAX and coef = point.x

rotate(center, angle)
Parameters:
  • centerGKPoint

  • angle – float

Rotates this line modifying it using center as the rotation point and angle (value in radians) the angle of rotation. A positive angle will be a clokwise rotation (horaria) while a negative angle will be a counterclokwise rotation (anti-horaria).

set(p1, p2)
Parameters:

Sets this line to be the one defined by these two points.