mrpt.math
Package Contents
- class mrpt.math.CHistogram(min: float, max: float, nBins: int)
C++ API: class mrpt::math::CHistogram
A histogram of a real-valued variable, with equally-sized bins.
- add(arg0: float) None
Add an element to the histogram. If element is out of [min,max] it is ignored.
- clear() None
Resets all bins to zero.
- getBinCount(arg0: int) int
Returns the elements count into the selected bin index, where first one is 0.
- getBinRatio(arg0: int) float
Returns the ratio in [0,1] range for the selected bin index, where first one is 0.
- getHistogram() tuple
Returns (bin_centers, hit_counts) as two lists
- getHistogramNormalized() tuple
Returns (bin_centers, normalized_hits) — integral equals 1 as PDF
- class mrpt.math.CMatrixDouble
- class mrpt.math.CMatrixDouble(arg0: int, arg1: int)
- class mrpt.math.CMatrixDouble(arg0: numpy.ndarray)
A dynamic-size matrix of doubles, convertible to and from NumPy arrays.
- as_numpy() numpy.ndarray
Returns the matrix as a NumPy array.
- class mrpt.math.CPolygon
C++ API: class mrpt::math::CPolygon
Bases:
mrpt.serialization.CSerializableA 2D polygon, serializable.
- add_vertex(x: float, y: float) None
Add a new vertex to polygon.
- get_vertex_x(arg0: int) float
Returns the x coordinate of the i-th vertex.
- get_vertex_y(arg0: int) float
Returns the y coordinate of the i-th vertex.
- get_vertices() tuple
Returns (xs, ys) as two lists of vertex coordinates
- set_vertices(arg0: list[float], arg1: list[float]) None
Set all vertices at once.
- class mrpt.math.CQuaternionDouble
- class mrpt.math.CQuaternionDouble(r: float, x: float, y: float, z: float)
A unit quaternion (r, x, y, z) for 3D rotations, with r the real part.
- property r: float
Real part
- property x: float
Imaginary part, i
- property y: float
Imaginary part, j
- property z: float
Imaginary part, k
- as_numpy() numpy.ndarray
Returns the components [r, x, y, z] as a NumPy array.
- conj() CQuaternionDouble
Returns the conjugate quaternion (the inverse rotation).
- ensurePositiveRealPart() None
Flips the sign of all components if needed, so that r >= 0 (same rotation).
- normSqr() float
Squared norm of the quaternion.
- normalize() None
Normalizes the quaternion to unit norm.
- rotatePoint(x: float, y: float, z: float) tuple
Rotates a 3D point; returns (x, y, z).
- rotationMatrix() CMatrixDouble33
Returns the equivalent 3x3 rotation matrix.
- rpy() tuple
Returns the equivalent (roll, pitch, yaw) angles, in radians.
- class mrpt.math.CVectorDouble
- class mrpt.math.CVectorDouble(arg0: int)
- class mrpt.math.CVectorDouble(arg0: numpy.ndarray)
A dynamic-size vector of doubles, convertible to and from NumPy arrays.
- as_numpy() numpy.ndarray
Returns the vector as a NumPy array.
- class mrpt.math.TBoundingBox(arg0: TPoint3D, arg1: TPoint3D)
A 3D axis-aligned bounding box, defined by its min and max corners.
- static PlusMinusInfinity() TBoundingBox
Initialize with min=+Infinity, max=-Infinity. This is useful as an initial value before processing a list of points to keep their minimum/maximum.
- containsPoint(arg0: TPoint3D) bool
Returns true if the point lies within the bounding box (including the exact border)
- intersection(arg0: TBoundingBox) Any
Returns the intersection of this bounding box with “b”, or std::nullopt if no intersection exists.
- unionWith(arg0: TBoundingBox) TBoundingBox
Returns the union of this bounding box with “b”, i.e. a new bounding box comprising both this and b.
- volume() float
Returns the volume of the box.
- class mrpt.math.TBoundingBoxf(arg0: TPoint3Df, arg1: TPoint3Df)
A 3D axis-aligned bounding box with float coordinates, defined by its min and max corners.
- static PlusMinusInfinity() TBoundingBoxf
Initialize with min=+Infinity, max=-Infinity. This is useful as an initial value before processing a list of points to keep their minimum/maximum.
- containsPoint(arg0: TPoint3Df) bool
Returns true if the point lies within the bounding box (including the exact border)
- unionWith(arg0: TBoundingBoxf) TBoundingBoxf
Returns the union of this bounding box with “b”, i.e. a new bounding box comprising both this and b.
- volume() float
Returns the volume of the box.
- class mrpt.math.TLine2D
C++ API: struct mrpt::math::TLine2D
TLine2D(arg0: TPoint2D, arg1: TPoint2D) TLine2D(A: float, B: float, C: float)
2D line without bounds, represented by its equation Ax+By+C=0.
- coefs: list[float]
- unitarize() None
Unitarize line’s normal vector.
- class mrpt.math.TLine3D
C++ API: struct mrpt::math::TLine3D
TLine3D(arg0: TPoint3D, arg1: TPoint3D)
3D line, represented by a base point and a director vector.
- closestPointTo(arg0: TPoint3D) TPoint3D
Closest point to p along the line. It is computed as the intersection of this with the plane perpendicular to this that passes through p.
- unitarize() None
Unitarize director vector.
- class mrpt.math.TPlane
C++ API: struct mrpt::math::TPlane
TPlane(A: float, B: float, C: float, D: float) TPlane(arg0: TPoint3D, arg1: TPoint3D, arg2: TPoint3D)
3D Plane, represented by its equation Ax+By+Cz+D=0.
- coefs: list[float]
- static From3Points(arg0: TPoint3D, arg1: TPoint3D, arg2: TPoint3D) TPlane
Returns the plane that contains three points.
- unitarize() None
Unitarize normal vector.
- class mrpt.math.TPoint2D
- class mrpt.math.TPoint2D(arg0: float, arg1: float)
- class mrpt.math.TPoint2D(arg0: list[float])
A 2D point (x, y), with double coordinates.
- x: float
- y: float
- norm() float
Returns the norm sqrt(x^2 + y^2).
- sqrNorm() float
Returns the squared norm x^2 + y^2.
- class mrpt.math.TPoint2Df
- class mrpt.math.TPoint2Df(arg0: float, arg1: float)
- class mrpt.math.TPoint2Df(arg0: list[float])
A 2D point (x, y), with float coordinates.
- x: float
- y: float
- norm() float
Returns the norm sqrt(x^2 + y^2).
- sqrNorm() float
Returns the squared norm x^2 + y^2.
- class mrpt.math.TPoint3D
- class mrpt.math.TPoint3D(arg0: float, arg1: float, arg2: float)
- class mrpt.math.TPoint3D(arg0: list[float])
A 3D point (x, y, z), with double coordinates.
- x: float
- y: float
- z: float
- norm() float
Returns the norm sqrt(x^2 + y^2 + z^2).
- sqrNorm() float
Returns the squared norm x^2 + y^2 + z^2.
- class mrpt.math.TPoint3Df
- class mrpt.math.TPoint3Df(arg0: float, arg1: float, arg2: float)
- class mrpt.math.TPoint3Df(arg0: list[float])
A 3D point (x, y, z), with float coordinates.
- x: float
- y: float
- z: float
- norm() float
Returns the norm sqrt(x^2 + y^2 + z^2).
- sqrNorm() float
Returns the squared norm x^2 + y^2 + z^2.
- class mrpt.math.TPose2D
C++ API: struct mrpt::math::TPose2D
TPose2D(arg0: float, arg1: float, arg2: float) TPose2D(arg0: list[float])
Lightweight 2D pose (x, y, phi): an element of SE(2).
- phi: float
- x: float
- y: float
- composePoint(arg0: TPoint2D) TPoint2D
Transforms a point from the local frame of this pose into the global (world) frame.
- inverseComposePoint(arg0: TPoint2D) TPoint2D
Transforms a point from the global (world) frame into the local frame of this pose.
- norm() float
Euclidean norm of the translation (x, y); phi is ignored.
- normalizePhi() None
Wraps phi to the canonical range (-pi, pi].
- class mrpt.math.TPose3D
C++ API: struct mrpt::math::TPose3D
TPose3D(arg0: float, arg1: float, arg2: float, arg3: float, arg4: float, arg5: float) TPose3D(arg0: list[float])
Lightweight 3D pose (x, y, z, yaw, pitch, roll): an element of SE(3).
- pitch: float
- roll: float
- x: float
- y: float
- yaw: float
- z: float
- composePoint(arg0: TPoint3D) TPoint3D
Transforms a point from the local frame of this pose into the global (world) frame.
- getHomogeneousMatrix() CMatrixDouble44
Returns the 4x4 homogeneous transformation matrix.
- getRotationMatrix() CMatrixDouble33
Returns the 3x3 rotation matrix.
- inverseComposePoint(arg0: TPoint3D) TPoint3D
Transforms a point from the global (world) frame into the local frame of this pose.
- norm() float
Euclidean norm of the translation (x, y, z); angles are ignored.
- class mrpt.math.TPose3DQuat
C++ API: struct mrpt::math::TPose3DQuat
TPose3DQuat(x: float, y: float, z: float, qr: float, qx: float, qy: float, qz: float)
Lightweight 3D pose (three spatial coordinates, plus a quaternion ).
- qr: float
- qx: float
- qy: float
- qz: float
- x: float
- y: float
- z: float
- class mrpt.math.TSegment2D
C++ API: struct mrpt::math::TSegment2D
TSegment2D(arg0: TPoint2D, arg1: TPoint2D)
2D segment, consisting of two points.
- static FromPoints(arg0: TPoint2D, arg1: TPoint2D) TSegment2D
Static method, returns segment from two points.
- length() float
Segment length.
- class mrpt.math.TSegment3D
C++ API: struct mrpt::math::TSegment3D
TSegment3D(arg0: TPoint3D, arg1: TPoint3D)
3D segment, consisting of two points.
- length() float
Segment length.
- class mrpt.math.TTwist2D
C++ API: struct mrpt::math::TTwist2D
TTwist2D(vx: float, vy: float, omega: float)
2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)
- omega: float
- vx: float
- vy: float
- asString() str
Returns a human-readable textual representation of the object (eg: “[vx vy omega]”, omega in deg/s)
- rotate(arg0: float) None
Transform the (vx,vy) components for a counterclockwise rotation of ang radians.
- class mrpt.math.TTwist3D
C++ API: struct mrpt::math::TTwist3D
TTwist3D(vx: float, vy: float, vz: float, wx: float, wy: float, wz: float)
3D twist: 3D velocity vector (vx,vy,vz) + angular velocity (wx,wy,wz)
- vx: float
- vy: float
- vz: float
- wx: float
- wy: float
- wz: float
- asString() str
Returns a human-readable textual representation of the object (eg: “[vx vy vz wx wy wz]”, omegas in deg/s)
- mrpt.math.wrapTo2Pi(arg0: float) float
Wrap angle to [0, 2*pi]
- mrpt.math.wrapToPi(arg0: float) float
Wrap angle to [-pi, pi]