Merge pull request #24262 from mnesarco/pyi-fixes-1
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export
|
||||
from PyObjectBase import PyObjectBase
|
||||
from Vector import Vector
|
||||
from Placement import Placement
|
||||
from Axis import Axis
|
||||
from typing import overload
|
||||
|
||||
@export(
|
||||
@@ -49,16 +50,12 @@ class Axis(PyObjectBase):
|
||||
|
||||
def copy(self) -> Axis:
|
||||
"""
|
||||
copy() -> Base.Axis
|
||||
|
||||
Returns a copy of this Axis.
|
||||
"""
|
||||
...
|
||||
|
||||
def move(self, vector: Vector) -> None:
|
||||
def move(self, vector: Vector, /) -> None:
|
||||
"""
|
||||
move(vector) -> None
|
||||
|
||||
Move the axis base along the given vector.
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -66,10 +63,8 @@ class Axis(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def multiply(self, placement: Placement) -> Axis:
|
||||
def multiply(self, placement: Placement, /) -> Axis:
|
||||
"""
|
||||
multiply(placement) -> Base.Axis
|
||||
|
||||
Multiply this axis by a placement.
|
||||
|
||||
placement : Base.Placement
|
||||
@@ -79,8 +74,6 @@ class Axis(PyObjectBase):
|
||||
|
||||
def reversed(self) -> Axis:
|
||||
"""
|
||||
reversed() -> Base.Axis
|
||||
|
||||
Compute the reversed axis. This returns a new Base.Axis with
|
||||
the original direction reversed.
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import constmethod
|
||||
from PyObjectBase import PyObjectBase
|
||||
from typing import List, Final
|
||||
@@ -19,7 +21,7 @@ class BaseClass(PyObjectBase):
|
||||
"""Module in which this class is defined"""
|
||||
|
||||
@constmethod
|
||||
def isDerivedFrom(self, typeName: str) -> bool:
|
||||
def isDerivedFrom(self, typeName: str, /) -> bool:
|
||||
"""
|
||||
Returns true if given type is a father
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, constmethod
|
||||
from PyObjectBase import PyObjectBase
|
||||
from Vector import Vector
|
||||
@@ -107,19 +109,17 @@ class BoundBox(PyObjectBase):
|
||||
xMax: float = 0,
|
||||
yMax: float = 0,
|
||||
zMax: float = 0,
|
||||
) -> None: ...
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
min: Union[Vector, Tuple[float, float, float]],
|
||||
max: Union[Vector, Tuple[float, float, float]],
|
||||
) -> None: ...
|
||||
) -> None: ...
|
||||
# fmt: on
|
||||
|
||||
def setVoid(self) -> None:
|
||||
"""
|
||||
setVoid() -> None
|
||||
|
||||
Invalidate the bounding box.
|
||||
"""
|
||||
...
|
||||
@@ -127,23 +127,18 @@ class BoundBox(PyObjectBase):
|
||||
@constmethod
|
||||
def isValid(self) -> bool:
|
||||
"""
|
||||
isValid() -> bool
|
||||
|
||||
Checks if the bounding box is valid.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def add(self, minMax: Vector) -> None: ...
|
||||
def add(self, minMax: Vector, /) -> None: ...
|
||||
@overload
|
||||
def add(self, minMax: Tuple[float, float, float]) -> None: ...
|
||||
def add(self, minMax: Tuple[float, float, float], /) -> None: ...
|
||||
@overload
|
||||
def add(self, x: float, y: float, z: float) -> None: ...
|
||||
def add(self, x: float, y: float, z: float, /) -> None: ...
|
||||
def add(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""
|
||||
add(minMax) -> None
|
||||
add(x, y, z) -> None
|
||||
|
||||
Increase the maximum values or decrease the minimum values of this BoundBox by
|
||||
replacing the current values with the given values, so the bounding box can grow
|
||||
but not shrink.
|
||||
@@ -160,10 +155,8 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getPoint(self, index: int) -> Vector:
|
||||
def getPoint(self, index: int, /) -> Vector:
|
||||
"""
|
||||
getPoint(index) -> Base.Vector
|
||||
|
||||
Get the point of the given index.
|
||||
The index must be in the range of [0, 7].
|
||||
|
||||
@@ -172,10 +165,8 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getEdge(self, index: int) -> Tuple[Vector, ...]:
|
||||
def getEdge(self, index: int, /) -> Tuple[Vector, ...]:
|
||||
"""
|
||||
getEdge(index) -> tuple of Base.Vector
|
||||
|
||||
Get the edge points of the given index.
|
||||
The index must be in the range of [0, 11].
|
||||
|
||||
@@ -184,15 +175,12 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def closestPoint(self, point: Vector) -> Vector: ...
|
||||
def closestPoint(self, point: Vector, /) -> Vector: ...
|
||||
@overload
|
||||
def closestPoint(self, x: float, y: float, z: float) -> Vector: ...
|
||||
def closestPoint(self, x: float, y: float, z: float, /) -> Vector: ...
|
||||
@constmethod
|
||||
def closestPoint(self, *args: Any, **kwargs: Any) -> Vector:
|
||||
"""
|
||||
closestPoint(point) -> Base.Vector
|
||||
closestPoint(x, y, z) -> Base.Vector
|
||||
|
||||
Get the closest point of the bounding box to the given point.
|
||||
|
||||
point : Base.Vector, tuple
|
||||
@@ -207,18 +195,16 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def intersect(self, boundBox2: "BoundBox") -> bool: ...
|
||||
def intersect(self, boundBox2: "BoundBox", /) -> bool: ...
|
||||
@overload
|
||||
def intersect(
|
||||
self,
|
||||
base: Union[Vector, Tuple[float, float, float]],
|
||||
dir: Union[Vector, Tuple[float, float, float]],
|
||||
/,
|
||||
) -> bool: ...
|
||||
def intersect(self, *args: Any) -> bool:
|
||||
"""
|
||||
intersect(boundBox2) -> bool
|
||||
intersect(base, dir) -> bool
|
||||
|
||||
Checks if the given object intersects with this bounding box. That can be
|
||||
another bounding box or a line specified by base and direction.
|
||||
|
||||
@@ -228,30 +214,24 @@ class BoundBox(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def intersected(self, boundBox2: "BoundBox") -> "BoundBox":
|
||||
def intersected(self, boundBox2: "BoundBox", /) -> "BoundBox":
|
||||
"""
|
||||
intersected(boundBox2) -> Base.BoundBox
|
||||
|
||||
Returns the intersection of this and the given bounding box.
|
||||
|
||||
boundBox2 : Base.BoundBox
|
||||
"""
|
||||
...
|
||||
|
||||
def united(self, boundBox2: "BoundBox") -> "BoundBox":
|
||||
def united(self, boundBox2: "BoundBox", /) -> "BoundBox":
|
||||
"""
|
||||
united(boundBox2) -> Base.BoundBox
|
||||
|
||||
Returns the union of this and the given bounding box.
|
||||
|
||||
boundBox2 : Base.BoundBox
|
||||
"""
|
||||
...
|
||||
|
||||
def enlarge(self, variation: float) -> None:
|
||||
def enlarge(self, variation: float, /) -> None:
|
||||
"""
|
||||
enlarge(variation) -> None
|
||||
|
||||
Decrease the minimum values and increase the maximum values by the given value.
|
||||
A negative value shrinks the bounding box.
|
||||
|
||||
@@ -259,10 +239,8 @@ class BoundBox(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def getIntersectionPoint(self, base: Vector, dir: Vector, epsilon: float = 0.0001) -> Vector:
|
||||
def getIntersectionPoint(self, base: Vector, dir: Vector, epsilon: float = 0.0001, /) -> Vector:
|
||||
"""
|
||||
getIntersectionPoint(base, dir, epsilon=0.0001) -> Base.Vector
|
||||
|
||||
Calculate the intersection point of a line with the bounding box.
|
||||
The base point must lie inside the bounding box, if not an exception is thrown.
|
||||
|
||||
@@ -276,16 +254,13 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def move(self, displacement: Vector) -> None: ...
|
||||
def move(self, displacement: Vector, /) -> None: ...
|
||||
@overload
|
||||
def move(self, displacement: Tuple[float, float, float]) -> None: ...
|
||||
def move(self, displacement: Tuple[float, float, float], /) -> None: ...
|
||||
@overload
|
||||
def move(self, x: float, y: float, z: float) -> None: ...
|
||||
def move(self, x: float, y: float, z: float, /) -> None: ...
|
||||
def move(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""
|
||||
move(displacement) -> None
|
||||
move(x, y, z) -> None
|
||||
|
||||
Move the bounding box by the given values.
|
||||
|
||||
displacement : Base.Vector, tuple
|
||||
@@ -300,16 +275,13 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def scale(self, factor: Vector) -> None: ...
|
||||
def scale(self, factor: Vector, /) -> None: ...
|
||||
@overload
|
||||
def scale(self, factor: Tuple[float, float, float]) -> None: ...
|
||||
def scale(self, factor: Tuple[float, float, float], /) -> None: ...
|
||||
@overload
|
||||
def scale(self, x: float, y: float, z: float) -> None: ...
|
||||
def scale(self, x: float, y: float, z: float, /) -> None: ...
|
||||
def scale(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""
|
||||
scale(factor) -> None
|
||||
scale(x, y, z) -> None
|
||||
|
||||
Scale the bounding box by the given values.
|
||||
|
||||
factor : Base.Vector, tuple
|
||||
@@ -323,10 +295,8 @@ class BoundBox(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def transformed(self, matrix: Matrix) -> "BoundBox":
|
||||
def transformed(self, matrix: Matrix, /) -> "BoundBox":
|
||||
"""
|
||||
transformed(matrix) -> Base.BoundBox
|
||||
|
||||
Returns a new BoundBox containing the transformed rectangular cuboid
|
||||
represented by this BoundBox.
|
||||
|
||||
@@ -335,10 +305,8 @@ class BoundBox(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def isCutPlane(self, base: Vector, normal: Vector) -> bool:
|
||||
def isCutPlane(self, base: Vector, normal: Vector, /) -> bool:
|
||||
"""
|
||||
isCutPlane(base, normal) -> bool
|
||||
|
||||
Check if the plane specified by base and normal intersects (cuts) this bounding
|
||||
box.
|
||||
|
||||
@@ -348,16 +316,13 @@ class BoundBox(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def isInside(self, object: Vector) -> bool: ...
|
||||
def isInside(self, object: Vector, /) -> bool: ...
|
||||
@overload
|
||||
def isInside(self, object: "BoundBox") -> bool: ...
|
||||
def isInside(self, object: "BoundBox", /) -> bool: ...
|
||||
@overload
|
||||
def isInside(self, x: float, y: float, z: float) -> bool: ...
|
||||
def isInside(self, x: float, y: float, z: float, /) -> bool: ...
|
||||
def isInside(self, *args: Any) -> bool:
|
||||
"""
|
||||
isInside(object) -> bool
|
||||
isInside(x, y, z) -> bool
|
||||
|
||||
Check if a point or a bounding box is inside this bounding box.
|
||||
|
||||
object : Base.Vector, Base.BoundBox
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, constmethod
|
||||
from PyObjectBase import PyObjectBase
|
||||
from Axis import Axis as AxisPy
|
||||
@@ -40,10 +42,8 @@ class CoordinateSystem(PyObjectBase):
|
||||
Position: Vector = None
|
||||
"""Set or get position."""
|
||||
|
||||
def setAxes(self, axis: Union[AxisPy, Vector], xDir: Vector) -> None:
|
||||
def setAxes(self, axis: Union[AxisPy, Vector], xDir: Vector, /) -> None:
|
||||
"""
|
||||
setAxes(axis, xDir) -> None
|
||||
|
||||
Set axis or Z-direction, and X-direction.
|
||||
The X-direction is determined from the orthonormal compononent of `xDir`
|
||||
with respect to `axis` direction.
|
||||
@@ -54,40 +54,32 @@ class CoordinateSystem(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def displacement(self, coordSystem2: "CoordinateSystem") -> Placement:
|
||||
def displacement(self, coordSystem2: "CoordinateSystem", /) -> Placement:
|
||||
"""
|
||||
displacement(coordSystem2) -> Base.Placement
|
||||
|
||||
Computes the placement from this to the passed coordinate system `coordSystem2`.
|
||||
|
||||
coordSystem2 : Base.CoordinateSystem
|
||||
"""
|
||||
...
|
||||
|
||||
def transformTo(self, vector: Vector) -> Vector:
|
||||
def transformTo(self, vector: Vector, /) -> Vector:
|
||||
"""
|
||||
transformTo(vector) -> Base.Vector
|
||||
|
||||
Computes the coordinates of the point in coordinates of this coordinate system.
|
||||
|
||||
vector : Base.Vector
|
||||
"""
|
||||
...
|
||||
|
||||
def transform(self, trans: Union[Rotation, Placement]) -> None:
|
||||
def transform(self, trans: Union[Rotation, Placement], /) -> None:
|
||||
"""
|
||||
transform(trans) -> None
|
||||
|
||||
Applies a transformation on this coordinate system.
|
||||
|
||||
trans : Base.Rotation, Base.Placement
|
||||
"""
|
||||
...
|
||||
|
||||
def setPlacement(self, placement: Placement) -> None:
|
||||
def setPlacement(self, placement: Placement, /) -> None:
|
||||
"""
|
||||
setPlacement(placement) -> None
|
||||
|
||||
Set placement to the coordinate system.
|
||||
|
||||
placement : Base.Placement
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Vector import Vector
|
||||
from Metadata import export, constmethod, class_declarations, no_args
|
||||
from PyObjectBase import PyObjectBase
|
||||
@@ -105,14 +107,11 @@ class Matrix(PyObjectBase):
|
||||
"""The matrix elements."""
|
||||
|
||||
@overload
|
||||
def move(self, vector: Vector) -> None: ...
|
||||
def move(self, vector: Vector, /) -> None: ...
|
||||
@overload
|
||||
def move(self, x: float, y: float, z: float) -> None: ...
|
||||
def move(self, x: float, y: float, z: float, /) -> None: ...
|
||||
def move(self, *args) -> None:
|
||||
"""
|
||||
move(vector) -> None
|
||||
move(x, y, z) -> None
|
||||
|
||||
Move the matrix along a vector, equivalent to left multiply the matrix
|
||||
by a pure translation transformation.
|
||||
|
||||
@@ -127,17 +126,13 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def scale(self, vector: Vector) -> None: ...
|
||||
def scale(self, vector: Vector, /) -> None: ...
|
||||
@overload
|
||||
def scale(self, x: float, y: float, z: float) -> None: ...
|
||||
def scale(self, x: float, y: float, z: float, /) -> None: ...
|
||||
@overload
|
||||
def scale(self, factor: float) -> None: ...
|
||||
def scale(self, factor: float, /) -> None: ...
|
||||
def scale(self, *args) -> None:
|
||||
"""
|
||||
scale(vector) -> None
|
||||
scale(x, y, z) -> None
|
||||
scale(factor) -> None
|
||||
|
||||
Scale the first three rows of the matrix.
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -153,10 +148,8 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def hasScale(self, tol: float = 0) -> ScaleType:
|
||||
def hasScale(self, tol: float = 0, /) -> ScaleType:
|
||||
"""
|
||||
hasScale(tol=0) -> ScaleType
|
||||
|
||||
Return an enum value of ScaleType. Possible values are:
|
||||
Uniform, NonUniformLeft, NonUniformRight, NoScaling or Other
|
||||
if it's not a scale matrix.
|
||||
@@ -168,8 +161,6 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def decompose(self) -> Tuple["Matrix", "Matrix", "Matrix", "Matrix"]:
|
||||
"""
|
||||
decompose() -> Base.Matrix, Base.Matrix, Base.Matrix, Base.Matrix
|
||||
|
||||
Return a tuple of matrices representing shear, scale, rotation and move.
|
||||
So that matrix = move * rotation * scale * shear.
|
||||
"""
|
||||
@@ -178,8 +169,6 @@ class Matrix(PyObjectBase):
|
||||
@no_args
|
||||
def nullify(self) -> None:
|
||||
"""
|
||||
nullify() -> None
|
||||
|
||||
Make this the null matrix.
|
||||
"""
|
||||
...
|
||||
@@ -188,8 +177,6 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def isNull(self) -> bool:
|
||||
"""
|
||||
isNull() -> bool
|
||||
|
||||
Check if this is the null matrix.
|
||||
"""
|
||||
...
|
||||
@@ -197,25 +184,19 @@ class Matrix(PyObjectBase):
|
||||
@no_args
|
||||
def unity(self) -> None:
|
||||
"""
|
||||
unity() -> None
|
||||
|
||||
Make this matrix to unity (4D identity matrix).
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isUnity(self, tol: float = 0.0) -> bool:
|
||||
def isUnity(self, tol: float = 0.0, /) -> bool:
|
||||
"""
|
||||
isUnity([tol=0.0]) -> bool
|
||||
|
||||
Check if this is the unit matrix (4D identity matrix).
|
||||
"""
|
||||
...
|
||||
|
||||
def transform(self, vector: Vector, matrix2: "Matrix") -> None:
|
||||
def transform(self, vector: Vector, matrix2: "Matrix", /) -> None:
|
||||
"""
|
||||
transform(vector, matrix2) -> None
|
||||
|
||||
Transform the matrix around a given point.
|
||||
Equivalent to left multiply the matrix by T*M*T_inv, where M is `matrix2`, T the
|
||||
translation generated by `vector` and T_inv the inverse translation.
|
||||
@@ -228,10 +209,8 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def col(self, index: int) -> Vector:
|
||||
def col(self, index: int, /) -> Vector:
|
||||
"""
|
||||
col(index) -> Base.Vector
|
||||
|
||||
Return the vector of a column, that is, the vector generated by the three
|
||||
first elements of the specified column.
|
||||
|
||||
@@ -240,10 +219,8 @@ class Matrix(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def setCol(self, index: int, vector: Vector) -> None:
|
||||
def setCol(self, index: int, vector: Vector, /) -> None:
|
||||
"""
|
||||
setCol(index, vector) -> None
|
||||
|
||||
Set the vector of a column, that is, the three first elements of the specified
|
||||
column by index.
|
||||
|
||||
@@ -254,10 +231,8 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def row(self, index: int) -> Vector:
|
||||
def row(self, index: int, /) -> Vector:
|
||||
"""
|
||||
row(index) -> Base.Vector
|
||||
|
||||
Return the vector of a row, that is, the vector generated by the three
|
||||
first elements of the specified row.
|
||||
|
||||
@@ -266,10 +241,8 @@ class Matrix(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def setRow(self, index: int, vector: Vector) -> None:
|
||||
def setRow(self, index: int, vector: Vector, /) -> None:
|
||||
"""
|
||||
setRow(index, vector) -> None
|
||||
|
||||
Set the vector of a row, that is, the three first elements of the specified
|
||||
row by index.
|
||||
|
||||
@@ -283,26 +256,20 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def diagonal(self) -> Vector:
|
||||
"""
|
||||
diagonal() -> Base.Vector
|
||||
|
||||
Return the diagonal of the 3x3 leading principal submatrix as vector.
|
||||
"""
|
||||
...
|
||||
|
||||
def setDiagonal(self, vector: Vector) -> None:
|
||||
def setDiagonal(self, vector: Vector, /) -> None:
|
||||
"""
|
||||
setDiagonal(vector) -> None
|
||||
|
||||
Set the diagonal of the 3x3 leading principal submatrix.
|
||||
|
||||
vector : Base.Vector
|
||||
"""
|
||||
...
|
||||
|
||||
def rotateX(self, angle: float) -> None:
|
||||
def rotateX(self, angle: float, /) -> None:
|
||||
"""
|
||||
rotateX(angle) -> None
|
||||
|
||||
Rotate around X axis.
|
||||
|
||||
angle : float
|
||||
@@ -310,10 +277,8 @@ class Matrix(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def rotateY(self, angle: float) -> None:
|
||||
def rotateY(self, angle: float, /) -> None:
|
||||
"""
|
||||
rotateY(angle) -> None
|
||||
|
||||
Rotate around Y axis.
|
||||
|
||||
angle : float
|
||||
@@ -321,10 +286,8 @@ class Matrix(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def rotateZ(self, angle: float) -> None:
|
||||
def rotateZ(self, angle: float, /) -> None:
|
||||
"""
|
||||
rotateZ(angle) -> None
|
||||
|
||||
Rotate around Z axis.
|
||||
|
||||
angle : float
|
||||
@@ -333,15 +296,12 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def multiply(self, matrix: "Matrix") -> "Matrix": ...
|
||||
def multiply(self, matrix: "Matrix", /) -> "Matrix": ...
|
||||
@overload
|
||||
def multiply(self, vector: Vector) -> Vector: ...
|
||||
def multiply(self, vector: Vector, /) -> Vector: ...
|
||||
@constmethod
|
||||
def multiply(self, obj: Union["Matrix", Vector]) -> Union["Matrix", Vector]:
|
||||
def multiply(self, obj: Union["Matrix", Vector], /) -> Union["Matrix", Vector]:
|
||||
"""
|
||||
multiply(matrix) -> Base.Matrix
|
||||
multiply(vector) -> Base.Vector
|
||||
|
||||
Right multiply the matrix by the given object.
|
||||
If the argument is a vector, this is augmented to the 4D vector (`vector`, 1).
|
||||
|
||||
@@ -351,10 +311,8 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def multVec(self, vector: Vector) -> Vector:
|
||||
def multVec(self, vector: Vector, /) -> Vector:
|
||||
"""
|
||||
multVec(vector) -> Base.Vector
|
||||
|
||||
Compute the transformed vector using the matrix.
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -364,8 +322,6 @@ class Matrix(PyObjectBase):
|
||||
@no_args
|
||||
def invert(self) -> None:
|
||||
"""
|
||||
invert() -> None
|
||||
|
||||
Compute the inverse matrix in-place, if possible.
|
||||
"""
|
||||
...
|
||||
@@ -374,8 +330,6 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def inverse(self) -> "Matrix":
|
||||
"""
|
||||
inverse() -> Base.Matrix
|
||||
|
||||
Compute the inverse matrix, if possible.
|
||||
"""
|
||||
...
|
||||
@@ -383,8 +337,6 @@ class Matrix(PyObjectBase):
|
||||
@no_args
|
||||
def transpose(self) -> None:
|
||||
"""
|
||||
transpose() -> None
|
||||
|
||||
Transpose the matrix in-place.
|
||||
"""
|
||||
...
|
||||
@@ -393,8 +345,6 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def transposed(self) -> "Matrix":
|
||||
"""
|
||||
transposed() -> Base.Matrix
|
||||
|
||||
Returns a transposed copy of this matrix.
|
||||
"""
|
||||
...
|
||||
@@ -403,17 +353,13 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def determinant(self) -> float:
|
||||
"""
|
||||
determinant() -> float
|
||||
|
||||
Compute the determinant of the matrix.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isOrthogonal(self, tol: float = 1e-6) -> float:
|
||||
def isOrthogonal(self, tol: float = 1e-6, /) -> float:
|
||||
"""
|
||||
isOrthogonal(tol=1e-6) -> float
|
||||
|
||||
Checks if the matrix is orthogonal, i.e. M * M^T = k*I and returns
|
||||
the multiple of the identity matrix. If it's not orthogonal 0 is returned.
|
||||
|
||||
@@ -423,10 +369,8 @@ class Matrix(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def submatrix(self, dim: int) -> "Matrix":
|
||||
def submatrix(self, dim: int, /) -> "Matrix":
|
||||
"""
|
||||
submatrix(dim) -> Base.Matrix
|
||||
|
||||
Get the leading principal submatrix of the given dimension.
|
||||
The (4 - `dim`) remaining dimensions are completed with the
|
||||
corresponding identity matrix.
|
||||
@@ -440,8 +384,6 @@ class Matrix(PyObjectBase):
|
||||
@constmethod
|
||||
def analyze(self) -> str:
|
||||
"""
|
||||
analyze() -> str
|
||||
|
||||
Analyzes the type of transformation.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
"""
|
||||
This file keeps auxiliary metadata to be used by the Python API stubs.
|
||||
"""
|
||||
@@ -10,8 +12,8 @@ def export(**kwargs):
|
||||
"""
|
||||
...
|
||||
|
||||
def constmethod(): ...
|
||||
def no_args(): ...
|
||||
def constmethod(method): ...
|
||||
def no_args(method): ...
|
||||
def forward_declarations(source_code):
|
||||
"""
|
||||
A decorator to attach forward declarations to a class.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import constmethod
|
||||
from BaseClass import BaseClass
|
||||
from typing import Final
|
||||
@@ -21,10 +23,8 @@ class Persistence(BaseClass):
|
||||
"""Memory size of the object in bytes."""
|
||||
|
||||
@constmethod
|
||||
def dumpContent(self, *, Compression: int = 3) -> bytearray:
|
||||
def dumpContent(self, Compression: int = 3) -> bytearray:
|
||||
"""
|
||||
dumpContent(Compression=3) -> bytearray
|
||||
|
||||
Dumps the content of the object, both the XML representation and the additional
|
||||
data files required, into a byte representation.
|
||||
|
||||
@@ -33,11 +33,9 @@ class Persistence(BaseClass):
|
||||
"""
|
||||
...
|
||||
|
||||
def restoreContent(self, obj: object) -> None:
|
||||
def restoreContent(self, obj: object, /) -> None:
|
||||
# TODO: Starting with Python 3.12, collections.abc.Buffer can be used for type hinting
|
||||
"""
|
||||
restoreContent(obj) -> None
|
||||
|
||||
Restore the content of the object from a byte representation as stored by `dumpContent`.
|
||||
It could be restored from any Python object implementing the buffer protocol.
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, constmethod, class_declarations
|
||||
from PyObjectBase import PyObjectBase
|
||||
from Matrix import Matrix as MatrixPy
|
||||
@@ -86,16 +88,12 @@ class Placement(PyObjectBase):
|
||||
@constmethod
|
||||
def copy(self) -> "Placement":
|
||||
"""
|
||||
copy() -> Base.Placement
|
||||
|
||||
Returns a copy of this placement.
|
||||
"""
|
||||
...
|
||||
|
||||
def move(self, vector: Vector) -> None:
|
||||
def move(self, vector: Vector, /) -> None:
|
||||
"""
|
||||
move(vector) -> None
|
||||
|
||||
Move the placement along a vector.
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -103,10 +101,8 @@ class Placement(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def translate(self, vector: Vector) -> None:
|
||||
def translate(self, vector: Vector, /) -> None:
|
||||
"""
|
||||
translate(vector) -> None
|
||||
|
||||
Alias to move(), to be compatible with TopoShape.translate().
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -118,10 +114,9 @@ class Placement(PyObjectBase):
|
||||
def rotate(
|
||||
self, center: Sequence[float], axis: Sequence[float], angle: float, *, comp: bool = False
|
||||
) -> None: ...
|
||||
@overload
|
||||
def rotate(self, center: Vector, axis: Vector, angle: float, *, comp: bool = False) -> None:
|
||||
"""
|
||||
rotate(center, axis, angle, comp) -> None
|
||||
|
||||
Rotate the current placement around center and axis with the given angle.
|
||||
This method is compatible with TopoShape.rotate() if the (optional) keyword
|
||||
argument comp is True (default=False).
|
||||
@@ -136,13 +131,11 @@ class Placement(PyObjectBase):
|
||||
optional keyword only argument, if True (default=False),
|
||||
behave like TopoShape.rotate() (i.e. the resulting placements are interchangeable).
|
||||
"""
|
||||
...
|
||||
|
||||
def rotate(self, *args, **kwargs) -> None: ...
|
||||
@constmethod
|
||||
def multiply(self, placement: "Placement") -> "Placement":
|
||||
def multiply(self, placement: "Placement", /) -> "Placement":
|
||||
"""
|
||||
multiply(placement) -> Base.Placement
|
||||
|
||||
Right multiply this placement with another placement.
|
||||
Also available as `*` operator.
|
||||
|
||||
@@ -152,10 +145,8 @@ class Placement(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def multVec(self, vector: Vector) -> Vector:
|
||||
def multVec(self, vector: Vector, /) -> Vector:
|
||||
"""
|
||||
multVec(vector) -> Base.Vector
|
||||
|
||||
Compute the transformed vector using the placement.
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -166,8 +157,6 @@ class Placement(PyObjectBase):
|
||||
@constmethod
|
||||
def toMatrix(self) -> MatrixPy:
|
||||
"""
|
||||
toMatrix() -> Base.Matrix
|
||||
|
||||
Compute the matrix representation of the placement.
|
||||
"""
|
||||
...
|
||||
@@ -175,17 +164,13 @@ class Placement(PyObjectBase):
|
||||
@constmethod
|
||||
def inverse(self) -> "Placement":
|
||||
"""
|
||||
inverse() -> Base.Placement
|
||||
|
||||
Compute the inverse placement.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def pow(self, t: float, shorten: bool = True) -> "Placement":
|
||||
def pow(self, t: float, shorten: bool = True, /) -> "Placement":
|
||||
"""
|
||||
pow(t, shorten=True) -> Base.Placement
|
||||
|
||||
Raise this placement to real power using ScLERP interpolation.
|
||||
Also available as `**` operator.
|
||||
|
||||
@@ -198,10 +183,8 @@ class Placement(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def sclerp(self, placement2: "Placement", t: float, shorten: bool = True) -> "Placement":
|
||||
def sclerp(self, placement2: "Placement", t: float, shorten: bool = True, /) -> "Placement":
|
||||
"""
|
||||
sclerp(placement2, t, shorten=True) -> Base.Placement
|
||||
|
||||
Screw Linear Interpolation (ScLERP) between this placement and `placement2`.
|
||||
Interpolation is a continuous motion along a helical path parametrized by `t`
|
||||
made of equal transforms if discretized.
|
||||
@@ -219,10 +202,8 @@ class Placement(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def slerp(self, placement2: "Placement", t: float) -> "Placement":
|
||||
def slerp(self, placement2: "Placement", t: float, /) -> "Placement":
|
||||
"""
|
||||
slerp(placement2, t) -> Base.Placement
|
||||
|
||||
Spherical Linear Interpolation (SLERP) between this placement and `placement2`.
|
||||
This function performs independent interpolation of rotation and movement.
|
||||
Result of such interpolation might be not what application expects, thus this tool
|
||||
@@ -236,10 +217,8 @@ class Placement(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isIdentity(self, tol: float = 0.0) -> bool:
|
||||
def isIdentity(self, tol: float = 0.0, /) -> bool:
|
||||
"""
|
||||
isIdentity([tol=0.0]) -> bool
|
||||
|
||||
Returns True if the placement has no displacement and no rotation.
|
||||
Matrix representation is the 4D identity matrix.
|
||||
tol : float
|
||||
@@ -249,10 +228,8 @@ class Placement(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isSame(self, other: "Placement", tol: float = 0.0) -> bool:
|
||||
def isSame(self, other: "Placement", tol: float = 0.0, /) -> bool:
|
||||
"""
|
||||
isSame(Base.Placement, [tol=0.0]) -> bool
|
||||
|
||||
Checks whether this and the given placement are the same.
|
||||
The default tolerance is set to 0.0
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from PyObjectBase import PyObjectBase
|
||||
|
||||
class Precision(PyObjectBase):
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
class PyObjectBase:
|
||||
"""
|
||||
The most base class for Python bindings.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, constmethod
|
||||
from PyObjectBase import PyObjectBase
|
||||
from typing import overload, Final, Tuple, Union
|
||||
@@ -52,20 +54,18 @@ class Quantity(PyObjectBase):
|
||||
def __init__(self, string: str) -> None: ...
|
||||
# fmt: on
|
||||
|
||||
@overload
|
||||
def toStr(self, /) -> str: ...
|
||||
@overload
|
||||
def toStr(self, decimals: int, /) -> str: ...
|
||||
@constmethod
|
||||
def toStr(self, decimals: int = ...) -> str:
|
||||
def toStr(self, decimals: int = ..., /) -> str:
|
||||
"""
|
||||
toStr([decimals])
|
||||
|
||||
Returns a string representation rounded to number of decimals. If no decimals are specified then
|
||||
the internal precision is used
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def toStr(self) -> str: ...
|
||||
@overload
|
||||
def toStr(self, decimals: int) -> str: ...
|
||||
@constmethod
|
||||
def getUserPreferred(self) -> Tuple["Quantity", str]:
|
||||
"""
|
||||
@@ -74,13 +74,13 @@ class Quantity(PyObjectBase):
|
||||
...
|
||||
|
||||
@overload
|
||||
def getValueAs(self, unit: str) -> float: ...
|
||||
def getValueAs(self, unit: str, /) -> float: ...
|
||||
@overload
|
||||
def getValueAs(self, translation: float, unit_signature: int) -> float: ...
|
||||
def getValueAs(self, translation: float, unit_signature: int, /) -> float: ...
|
||||
@overload
|
||||
def getValueAs(self, unit: UnitPy) -> float: ...
|
||||
def getValueAs(self, unit: UnitPy, /) -> float: ...
|
||||
@overload
|
||||
def getValueAs(self, quantity: "Quantity") -> float: ...
|
||||
def getValueAs(self, quantity: "Quantity", /) -> float: ...
|
||||
@constmethod
|
||||
def getValueAs(self, *args) -> float:
|
||||
"""
|
||||
@@ -95,15 +95,14 @@ class Quantity(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def __round__(self, /) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int, /) -> float: ...
|
||||
@constmethod
|
||||
def __round__(self, ndigits: int = ...) -> Union[int, float]:
|
||||
def __round__(self, ndigits: int = ..., /) -> Union[int, float]:
|
||||
"""
|
||||
Returns the Integral closest to x, rounding half toward even.
|
||||
When an argument is passed, work like built-in round(x, ndigits).
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def __round__(self) -> int: ...
|
||||
@overload
|
||||
def __round__(self, ndigits: int) -> float: ...
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, constmethod, class_declarations
|
||||
from PyObjectBase import PyObjectBase
|
||||
from Vector import Vector
|
||||
@@ -129,8 +131,6 @@ class Rotation(PyObjectBase):
|
||||
|
||||
def invert(self) -> None:
|
||||
"""
|
||||
invert() -> None
|
||||
|
||||
Sets the rotation to its inverse.
|
||||
"""
|
||||
...
|
||||
@@ -138,16 +138,12 @@ class Rotation(PyObjectBase):
|
||||
@constmethod
|
||||
def inverted(self) -> "Rotation":
|
||||
"""
|
||||
inverted() -> Base.Rotation
|
||||
|
||||
Returns the inverse of the rotation.
|
||||
"""
|
||||
...
|
||||
|
||||
def isSame(self, rotation: "Rotation", tol: float = 0) -> bool:
|
||||
def isSame(self, rotation: "Rotation", tol: float = 0, /) -> bool:
|
||||
"""
|
||||
isSame(rotation, tol=0) -> bool
|
||||
|
||||
Checks if `rotation` perform the same transformation as this rotation.
|
||||
|
||||
rotation : Base.Rotation
|
||||
@@ -158,10 +154,8 @@ class Rotation(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def multiply(self, rotation: "Rotation") -> "Rotation":
|
||||
def multiply(self, rotation: "Rotation", /) -> "Rotation":
|
||||
"""
|
||||
multiply(rotation) -> Base.Rotation
|
||||
|
||||
Right multiply this rotation with another rotation.
|
||||
|
||||
rotation : Base.Rotation
|
||||
@@ -170,10 +164,8 @@ class Rotation(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def multVec(self, vector: Vector) -> Vector:
|
||||
def multVec(self, vector: Vector, /) -> Vector:
|
||||
"""
|
||||
multVec(vector) -> Base.Vector
|
||||
|
||||
Compute the transformed vector using the rotation.
|
||||
|
||||
vector : Base.Vector
|
||||
@@ -182,10 +174,8 @@ class Rotation(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def slerp(self, rotation2: "Rotation", t: float) -> "Rotation":
|
||||
def slerp(self, rotation2: "Rotation", t: float, /) -> "Rotation":
|
||||
"""
|
||||
slerp(rotation2, t) -> Base.Rotation
|
||||
|
||||
Spherical Linear Interpolation (SLERP) of this rotation and `rotation2`.
|
||||
|
||||
t : float
|
||||
@@ -193,10 +183,8 @@ class Rotation(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def setYawPitchRoll(self, angle1: float, angle2: float, angle3: float) -> None:
|
||||
def setYawPitchRoll(self, angle1: float, angle2: float, angle3: float, /) -> None:
|
||||
"""
|
||||
setYawPitchRoll(angle1, angle2, angle3) -> None
|
||||
|
||||
Set the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.
|
||||
|
||||
angle1 : float
|
||||
@@ -211,17 +199,13 @@ class Rotation(PyObjectBase):
|
||||
@constmethod
|
||||
def getYawPitchRoll(self) -> Tuple[float, float, float]:
|
||||
"""
|
||||
getYawPitchRoll() -> tuple
|
||||
|
||||
Get the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.
|
||||
The angles are given in degrees.
|
||||
"""
|
||||
...
|
||||
|
||||
def setEulerAngles(self, seq: str, angle1: float, angle2: float, angle3: float) -> None:
|
||||
def setEulerAngles(self, seq: str, angle1: float, angle2: float, angle3: float, /) -> None:
|
||||
"""
|
||||
setEulerAngles(seq, angle1, angle2, angle3) -> None
|
||||
|
||||
Set the Euler angles in a given sequence for this rotation.
|
||||
The angles must be given in degrees.
|
||||
|
||||
@@ -234,10 +218,8 @@ class Rotation(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def toEulerAngles(self, seq: str = "") -> List[float]:
|
||||
def toEulerAngles(self, seq: str = "", /) -> List[float]:
|
||||
"""
|
||||
toEulerAngles(seq) -> list
|
||||
|
||||
Get the Euler angles in a given sequence for this rotation.
|
||||
|
||||
seq : str
|
||||
@@ -249,8 +231,6 @@ class Rotation(PyObjectBase):
|
||||
@constmethod
|
||||
def toMatrix(self) -> Matrix:
|
||||
"""
|
||||
toMatrix() -> Base.Matrix
|
||||
|
||||
Convert the rotation to a 4D matrix representation.
|
||||
"""
|
||||
...
|
||||
@@ -258,17 +238,13 @@ class Rotation(PyObjectBase):
|
||||
@constmethod
|
||||
def isNull(self) -> bool:
|
||||
"""
|
||||
isNull() -> bool
|
||||
|
||||
Returns True if all values in the quaternion representation are zero.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isIdentity(self, tol: float = 0) -> bool:
|
||||
def isIdentity(self, tol: float = 0, /) -> bool:
|
||||
"""
|
||||
isIdentity(tol=0) -> bool
|
||||
|
||||
Returns True if the rotation equals the 4D identity matrix.
|
||||
tol : float
|
||||
Tolerance used to check for identity.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, forward_declarations, constmethod
|
||||
from PyObjectBase import PyObjectBase
|
||||
from typing import List, Final
|
||||
@@ -35,10 +37,8 @@ class Type(PyObjectBase):
|
||||
"""Module in which this class is defined."""
|
||||
|
||||
@staticmethod
|
||||
def fromName(name: str) -> "Type":
|
||||
def fromName(name: str, /) -> "Type":
|
||||
"""
|
||||
fromName(name) -> Base.BaseType
|
||||
|
||||
Returns a type object by name.
|
||||
|
||||
name : str
|
||||
@@ -46,10 +46,8 @@ class Type(PyObjectBase):
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def fromKey(key: int) -> "Type":
|
||||
def fromKey(key: int, /) -> "Type":
|
||||
"""
|
||||
fromKey(key) -> Base.BaseType
|
||||
|
||||
Returns a type id object by key.
|
||||
|
||||
key : int
|
||||
@@ -59,8 +57,6 @@ class Type(PyObjectBase):
|
||||
@staticmethod
|
||||
def getNumTypes() -> int:
|
||||
"""
|
||||
getNumTypes() -> int
|
||||
|
||||
Returns the number of type ids created so far.
|
||||
"""
|
||||
...
|
||||
@@ -68,17 +64,13 @@ class Type(PyObjectBase):
|
||||
@staticmethod
|
||||
def getBadType() -> "Type":
|
||||
"""
|
||||
getBadType() -> Base.BaseType
|
||||
|
||||
Returns an invalid type id.
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def getAllDerivedFrom(type: str) -> List[str]:
|
||||
def getAllDerivedFrom(type: str, /) -> List[str]:
|
||||
"""
|
||||
getAllDerivedFrom(type) -> list
|
||||
|
||||
Returns all descendants from the given type id.
|
||||
|
||||
type : str, Base.BaseType
|
||||
@@ -88,8 +80,6 @@ class Type(PyObjectBase):
|
||||
@constmethod
|
||||
def getParent(self) -> "Type":
|
||||
"""
|
||||
getParent() -> Base.BaseType
|
||||
|
||||
Returns the parent type id.
|
||||
"""
|
||||
...
|
||||
@@ -97,17 +87,13 @@ class Type(PyObjectBase):
|
||||
@constmethod
|
||||
def isBad(self) -> bool:
|
||||
"""
|
||||
isBad() -> bool
|
||||
|
||||
Checks if the type id is invalid.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isDerivedFrom(self, type: str) -> bool:
|
||||
def isDerivedFrom(self, type: str, /) -> bool:
|
||||
"""
|
||||
isDerivedFrom(type) -> bool
|
||||
|
||||
Returns true if given type id is a father of this type id.
|
||||
|
||||
type : str, Base.BaseType
|
||||
@@ -117,25 +103,19 @@ class Type(PyObjectBase):
|
||||
@constmethod
|
||||
def getAllDerived(self) -> List[object]:
|
||||
"""
|
||||
getAllDerived() -> list
|
||||
|
||||
Returns all descendants from this type id.
|
||||
"""
|
||||
...
|
||||
|
||||
def createInstance(self) -> object:
|
||||
"""
|
||||
createInstance() -> object
|
||||
|
||||
Creates an instance of this type id.
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def createInstanceByName(name: str, load: bool = False) -> object:
|
||||
def createInstanceByName(name: str, load: bool = False, /) -> object:
|
||||
"""
|
||||
createInstanceByName(name, load=False) -> object
|
||||
|
||||
Creates an instance of the named type id.
|
||||
|
||||
name : str
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export
|
||||
from PyObjectBase import PyObjectBase
|
||||
from Quantity import Quantity
|
||||
from Unit import Unit
|
||||
from typing import Final, Tuple, overload
|
||||
|
||||
@export(
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Metadata import export, constmethod, sequence_protocol, class_declarations
|
||||
from PyObjectBase import PyObjectBase
|
||||
from typing import overload, Sequence, TYPE_CHECKING
|
||||
from typing import overload, Sequence
|
||||
|
||||
@export(
|
||||
TwinPointer="Vector3d",
|
||||
@@ -76,7 +78,7 @@ class Vector(PyObjectBase):
|
||||
|
||||
# fmt: off
|
||||
@overload
|
||||
def __init__(self, *, x: float = 0, y: float = 0, z: float = 0) -> None: ...
|
||||
def __init__(self, x: float = 0, y: float = 0, z: float = 0) -> None: ...
|
||||
@overload
|
||||
def __init__(self, vector: "Vector") -> None: ...
|
||||
@overload
|
||||
@@ -86,17 +88,13 @@ class Vector(PyObjectBase):
|
||||
@constmethod
|
||||
def __reduce__(self) -> tuple:
|
||||
"""
|
||||
__reduce__() -> tuple
|
||||
|
||||
Serialization of Vector objects.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def add(self, vector2: "Vector") -> "Vector":
|
||||
def add(self, vector2: "Vector", /) -> "Vector":
|
||||
"""
|
||||
add(vector2) -> Base.Vector
|
||||
|
||||
Returns the sum of this vector and `vector2`.
|
||||
|
||||
vector2 : Base.Vector
|
||||
@@ -104,10 +102,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def sub(self, vector2: "Vector") -> "Vector":
|
||||
def sub(self, vector2: "Vector", /) -> "Vector":
|
||||
"""
|
||||
sub(vector2) -> Base.Vector
|
||||
|
||||
Returns the difference of this vector and `vector2`.
|
||||
|
||||
vector2 : Base.Vector
|
||||
@@ -117,16 +113,12 @@ class Vector(PyObjectBase):
|
||||
@constmethod
|
||||
def negative(self) -> "Vector":
|
||||
"""
|
||||
negative() -> Base.Vector
|
||||
|
||||
Returns the negative (opposite) of this vector.
|
||||
"""
|
||||
...
|
||||
|
||||
def scale(self, x: float, y: float, z: float) -> "Vector":
|
||||
def scale(self, x: float, y: float, z: float, /) -> "Vector":
|
||||
"""
|
||||
scale(x, y, z) -> Base.Vector
|
||||
|
||||
Scales in-place this vector by the given factor in each component.
|
||||
|
||||
x : float
|
||||
@@ -138,10 +130,8 @@ class Vector(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def multiply(self, factor: float) -> "Vector":
|
||||
def multiply(self, factor: float, /) -> "Vector":
|
||||
"""
|
||||
multiply(factor) -> Base.Vector
|
||||
|
||||
Multiplies in-place each component of this vector by a single factor.
|
||||
Equivalent to scale(factor, factor, factor).
|
||||
|
||||
@@ -150,10 +140,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def dot(self, vector2: "Vector") -> float:
|
||||
def dot(self, vector2: "Vector", /) -> float:
|
||||
"""
|
||||
dot(vector2) -> float
|
||||
|
||||
Returns the scalar product (dot product) between this vector and `vector2`.
|
||||
|
||||
vector2 : Base.Vector
|
||||
@@ -161,10 +149,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def cross(self, vector2: "Vector") -> "Vector":
|
||||
def cross(self, vector2: "Vector", /) -> "Vector":
|
||||
"""
|
||||
cross(vector2) -> Base.Vector
|
||||
|
||||
Returns the vector product (cross product) between this vector and `vector2`.
|
||||
|
||||
vector2 : Base.Vector
|
||||
@@ -172,10 +158,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isOnLineSegment(self, vector1: "Vector", vector2: "Vector") -> bool:
|
||||
def isOnLineSegment(self, vector1: "Vector", vector2: "Vector", /) -> bool:
|
||||
"""
|
||||
isOnLineSegment(vector1, vector2) -> bool
|
||||
|
||||
Checks if this vector is on the line segment generated by `vector1` and `vector2`.
|
||||
|
||||
vector1 : Base.Vector
|
||||
@@ -184,10 +168,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getAngle(self, vector2: "Vector") -> float:
|
||||
def getAngle(self, vector2: "Vector", /) -> float:
|
||||
"""
|
||||
getAngle(vector2) -> float
|
||||
|
||||
Returns the angle in radians between this vector and `vector2`.
|
||||
|
||||
vector2 : Base.Vector
|
||||
@@ -196,17 +178,13 @@ class Vector(PyObjectBase):
|
||||
|
||||
def normalize(self) -> "Vector":
|
||||
"""
|
||||
normalize() -> Base.Vector
|
||||
|
||||
Normalizes in-place this vector to the length of 1.0.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isEqual(self, vector2: "Vector", tol: float = 0) -> bool:
|
||||
def isEqual(self, vector2: "Vector", tol: float = 0, /) -> bool:
|
||||
"""
|
||||
isEqual(vector2, tol=0) -> bool
|
||||
|
||||
Checks if the distance between the points represented by this vector
|
||||
and `vector2` is less or equal to the given tolerance.
|
||||
|
||||
@@ -216,10 +194,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isParallel(self, vector2: "Vector", tol: float = 0) -> bool:
|
||||
def isParallel(self, vector2: "Vector", tol: float = 0, /) -> bool:
|
||||
"""
|
||||
isParallel(vector2, tol=0) -> bool
|
||||
|
||||
Checks if this vector and `vector2` are
|
||||
parallel less or equal to the given tolerance.
|
||||
|
||||
@@ -229,10 +205,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isNormal(self, vector2: "Vector", tol: float = 0) -> bool:
|
||||
def isNormal(self, vector2: "Vector", tol: float = 0, /) -> bool:
|
||||
"""
|
||||
isNormal(vector2, tol=0) -> bool
|
||||
|
||||
Checks if this vector and `vector2` are
|
||||
normal less or equal to the given tolerance.
|
||||
|
||||
@@ -241,10 +215,8 @@ class Vector(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def projectToLine(self, point: "Vector", dir: "Vector") -> "Vector":
|
||||
def projectToLine(self, point: "Vector", dir: "Vector", /) -> "Vector":
|
||||
"""
|
||||
projectToLine(point, dir) -> Base.Vector
|
||||
|
||||
Projects `point` on a line that goes through the origin with the direction `dir`.
|
||||
The result is the vector from `point` to the projected point.
|
||||
The operation is equivalent to dir_n.cross(dir_n.cross(point)), where `dir_n` is
|
||||
@@ -257,10 +229,8 @@ class Vector(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def projectToPlane(self, base: "Vector", normal: "Vector") -> "Vector":
|
||||
def projectToPlane(self, base: "Vector", normal: "Vector", /) -> "Vector":
|
||||
"""
|
||||
projectToPlane(base, normal) -> Base.Vector
|
||||
|
||||
Projects in-place this vector on a plane defined by a base point
|
||||
represented by `base` and a normal defined by `normal`.
|
||||
|
||||
@@ -270,10 +240,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def distanceToPoint(self, point2: "Vector") -> float:
|
||||
def distanceToPoint(self, point2: "Vector", /) -> float:
|
||||
"""
|
||||
distanceToPoint(point2) -> float
|
||||
|
||||
Returns the distance to another point represented by `point2`.
|
||||
.
|
||||
point : Base.Vector
|
||||
@@ -281,10 +249,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def distanceToLine(self, base: "Vector", dir: "Vector") -> float:
|
||||
def distanceToLine(self, base: "Vector", dir: "Vector", /) -> float:
|
||||
"""
|
||||
distanceToLine(base, dir) -> float
|
||||
|
||||
Returns the distance between the point represented by this vector
|
||||
and a line defined by a base point represented by `base` and a
|
||||
direction `dir`.
|
||||
@@ -295,10 +261,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def distanceToLineSegment(self, point1: "Vector", point2: "Vector") -> "Vector":
|
||||
def distanceToLineSegment(self, point1: "Vector", point2: "Vector", /) -> "Vector":
|
||||
"""
|
||||
distanceToLineSegment(point1, point2) -> Base.Vector
|
||||
|
||||
Returns the vector between the point represented by this vector and the point
|
||||
on the line segment with the shortest distance. The line segment is defined by
|
||||
`point1` and `point2`.
|
||||
@@ -309,10 +273,8 @@ class Vector(PyObjectBase):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def distanceToPlane(self, base: "Vector", normal: "Vector") -> float:
|
||||
def distanceToPlane(self, base: "Vector", normal: "Vector", /) -> float:
|
||||
"""
|
||||
distanceToPlane(base, normal) -> float
|
||||
|
||||
Returns the distance between this vector and a plane defined by a
|
||||
base point represented by `base` and a normal defined by `normal`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user