PyANGKernel.GKBBox

class GKBBox

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

A bounding box is the minimum size rectangle that englobes completely a graphic shape. It is defined by two points, called from and to, for the bottom-left and top-right coordinates of the rectangle.

A bbox have two states: defined or undefined. An undefined bbox means that the bottom-left and top-right coordinates stored on it cannot be used since they have not been calculated yet. A defined bbox means that the bottom-left and top-right coordinates have been calculated for the graphical object’s shape.

A bbox is undefined when created and can be undefined (to discard the current calculated coordinates) using the method undefined().

Using the set or the expand methods an undefined bbox is defined.

PyANGKernel.GKBBox.from
PyANGKernel.GKBBox.to
__init__()
__init__(rec)
Parameters:

recGKBBox

__init__(points)
Parameters:

pointsGKPoints

__init__(from, to)
Parameters:
__init__(x, y, X, Y)
Parameters:
  • x – float

  • y – float

  • X – float

  • Y – float

__init__(x, y, z, X, Y, Z)
Parameters:
  • x – float

  • y – float

  • z – float

  • X – float

  • Y – float

  • Z – float

altitude()
Return type:

float

Returns the altitude of the bounding box.

as2DPolygon()
Return type:

GKPoints

Returns this bbox as a 2D polygon of 4 points

center()
Return type:

GKPoint

Calculates and returns the center of the bbox.

contains2D(rec)
Parameters:

recGKBBox

Return type:

bool

It returns true if p is inside the bbox without taking into account the z coordinate in the box and in the point.

contains2D(p)
Parameters:

pGKPoint

Return type:

bool

It returns true if p is inside the bbox without taking into account the z coordinate in the box and in the point.

contains2D(px, py)
Parameters:
  • px – float

  • py – float

Return type:

bool

It returns true if (px, py) is inside the bbox without taking into account the z coordinate in the box and in the point.

contains3D(rec)
Parameters:

recGKBBox

Return type:

bool

Returns true if rec is inside the bbox.

contains3D(p)
Parameters:

pGKPoint

Return type:

bool

Returns true if p is inside the bbox.

ensureMinimumSize()
Return type:

GKBBox

Makes this bbox greater if it is too small (width or height almost zero) It changes the bbox if width or height is less than 0.5 m adding 0.5 m to its size.

expand(width, height)
Parameters:
  • width – float

  • height – float

Return type:

GKBBox

Expands the bbox in both x and y limits with “width” and height

expand3D(rec)
Parameters:

recGKBBox

Expands a bbox with the bbox rec. If rec is inside the bbox nothing happen. If rec is outside the bbox it will grow to keep rec inside.

expand3D(p)
Parameters:

pGKPoint

Expands a bbox with the point p. If p is inside the bbox nothing happen. If p is outside the bbox it will grow to keep p inside.

expand3D(points)
Parameters:

pointsGKPoints

Expands a bbox with points. If all the points in points are inside the bbox nothing happen. If any point is outside it will grow to keep the point inside.

expandHeight(size)
Parameters:

size – float

Return type:

GKBBox

Expands the bbox in both y limits with “size”

expandWidth(size)
Parameters:

size – float

Return type:

GKBBox

Expands the bbox in both x limits with “size”

getAreaDimensions()
Return type:

float

Returns the area (in square m) of this bbox

height()
Return type:

float

Returns the height of the bounding box.

intersections2D(line2[, epsilon=0.00001])
Parameters:
  • line2GKLine

  • epsilon – float

Return type:

GKPoints

intersects2D(b)
Parameters:

bGKBBox

Return type:

bool

Returns true if rec is inside the bbox or if both bboxes intersect.

intersects2D(line2, point[, epsilon=0.00001])
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

intersects3D(box, resultBox[, noZ=false])
Parameters:
Return type:

bool

Returns true if the two given bounding boxes intersect

isUndefined()
Return type:

bool

Returns true if the bbox bottom-left and top-right points have not been calculated yet and false otherwise.

__ne__(c)
Parameters:

cGKBBox

Return type:

bool

Returns true if the compared bounding boxes are different

__or__(b)
Parameters:

bGKBBox

Return type:

GKBBox

radious()
Return type:

float

Calculates and returns the radious of a circle that totally encloses the bbox. This circle is centered at center() .

scale(factor)
Parameters:

factor – float

Scales the bbox. Keeps the same center.

set(points)
Parameters:

pointsGKPoints

Calculates the bbox of points. The previous bottom-left and top-right coordinates are discarded.

set(from, to)
Parameters:

Creates a bbox using two points. The previous bottom-left and top-right coordinates are discarded.

set(x, y, X, Y)
Parameters:
  • x – float

  • y – float

  • X – float

  • Y – float

Creates a bbox using two points. The previous bottom-left and top-right coordinates are discarded.

set(x, y, z, X, Y, Z)
Parameters:
  • x – float

  • y – float

  • z – float

  • X – float

  • Y – float

  • Z – float

Creates a bbox using two points. The previous bottom-left and top-right coordinates are discarded.

translate(inc)
Parameters:

incGKPoint

Translates the bbox to a new location. That is: add inc to from and to

undefine()

Marks the bbox as undefined. Values in from and to cannot be used.

width()
Return type:

float

Returns the width of the bounding box.

x()
Return type:

float

Returns the x coordinate of the “from” point of the bounding box, the minimum x of the box.

y()
Return type:

float

Returns the y coordinate of the “from” point of the bounding box, the minimum y of the box.

z()
Return type:

float

Returns the z coordinate of the “from” point of the bounding box, the minimum z of the box.